Skip to content

AgentExpressError

Base error class for all Agent Express errors.

Every error in the framework extends this class, providing a machine-readable code, a retryable flag for middleware like turn.retry(), and an optional cause for error chaining.

try {
await agent.run({ input: "test" }).result
} catch (err) {
if (err instanceof AgentExpressError) {
console.log(err.code, err.retryable)
}
}
  • Error

new AgentExpressError(message, code, retryable, cause?): AgentExpressError

string

string

boolean

Error

AgentExpressError

Error.constructor

readonly optional cause?: Error

Original error that caused this one, if any.

Error.cause


code: string

Machine-readable error code (e.g., “ABORT”, “RATE_LIMIT”, “TOOL_DENIED”).


readonly retryable: boolean

Whether this error can be retried by retry middleware.