🤖lauren-ai
← Home
Export this page

Exceptions

All exception classes raised by lauren-ai.

Base

LaurenAIError

python
class LaurenAIError(message: str, cause: BaseException | None = None)

Base class for all lauren-ai exceptions.

Parameters:

NameTypeDescription
messagestrHuman-readable description of what went wrong.
causeBaseException | NoneThe underlying exception that caused this error, if any.

Transport errors

TransportError

python
class TransportError(message: str, status_code: int | None = None, provider: str | None = None, cause: BaseException | None = None)

Raised when an LLM provider returns or raises any error.

Parameters:

NameTypeDescription
messagestrHuman-readable description of the transport failure.
status_codeint | NoneHTTP status code returned by the provider, if applicable.
providerstr | NoneName of the provider (e.g. "anthropic").
causeBaseException | NoneThe underlying exception from the provider SDK.

Agent errors

AgentMaxTurnsError

python
class AgentMaxTurnsError(message: str, turns: int, agent_class: type | None = None)

Raised when an agent exceeds its configured max_turns limit.

Parameters:

NameTypeDescription
messagestrHuman-readable description of the limit exceeded.
turnsintThe number of turns that were executed before stopping.
agent_classtype | NoneThe agent class that exceeded the limit.

AgentBudgetExceededError

python
class AgentBudgetExceededError(message: str, budget_type: str, limit: float, used: float, agent_class: type | None = None)

Raised mid-run when an agent crosses its max_cost_usd or token budget.

Parameters:

NameTypeDescription
messagestrHuman-readable description of the budget exceeded.
budget_typestrEither "cost_usd" or "tokens".
limitfloatThe configured budget limit.
usedfloatThe actual amount used when the budget was exceeded.
agent_classtype | NoneThe agent class that exceeded the budget.

AgentConfigError

python
class AgentConfigError(message: str, agent_class: type | None = None, cause: BaseException | None = None)

Raised at startup when an @agent() decorator is misconfigured.

Parameters:

NameTypeDescription
messagestrHuman-readable description of the configuration error.
agent_classtype | NoneThe offending agent class, if known.
causeBaseException | NoneThe underlying exception.

Tool errors

ToolExecutionError

python
class ToolExecutionError(message: str, tool_name: str, tool_use_id: str, cause: BaseException | None = None)

Raised when a tool raises an unexpected exception during execution.

Parameters:

NameTypeDescription
messagestrHuman-readable description of the failure.
tool_namestrThe registered name of the tool that failed.
tool_use_idstrThe provider-assigned identifier for this tool call.
causeBaseException | NoneThe original exception raised by the tool.

Decorator errors

DecoratorUsageError

python
class DecoratorUsageError(message: str, decorator_name: str | None = None)

Raised when a decorator is used incorrectly, e.g. bare @tool without parentheses.

Parameters:

NameTypeDescription
messagestrHuman-readable description of the misuse.
decorator_namestr | NoneThe name of the decorator that was misused.

Parser errors

OutputParserError

python
class OutputParserError(message: str, raw_output: str | None = None, cause: BaseException | None = None)

Raised when an output parser fails to parse LLM text.

Parameters:

NameTypeDescription
messagestrHuman-readable description of the parse failure.
raw_outputstr | NoneThe raw LLM output that could not be parsed.
causeBaseException | NoneThe underlying exception.

Memory errors

MemoryConfigError

Raised when memory configuration is invalid or user_id is missing.

Tracing errors

TracingError

python
class TracingError

Base class for tracing and observability errors.

Raised when the tracing subsystem encounters an unrecoverable condition, such as a misconfigured exporter or a failed export operation.

Parameters:

NameTypeDescription
messagestrHuman-readable description of the failure.
causeBaseException | NoneThe underlying exception.