Skip to main content
Failures come in two kinds:
  • HTTP errors: the API rejected the request or hit a server fault. Every endpoint returns the same envelope.
  • Session failures: the request was accepted, but the run ended failed or timed_out. The session’s error_code says why.

Error object

Every error response carries the same envelope: a message that summarizes the problem, and a detail array with one entry per problem. For 422 validation errors, each detail entry keeps the failing field’s path and reason, and message flattens them into one line:
Validation error (422)
Requests rejected before they reach the API (for example 401) may carry only a message.

HTTP status codes

Success codes

Client error codes

Server error codes

Handling errors with the SDK

The SDKs raise a typed error on any non-2xx response, with status_code / statusCode and the parsed body.
Over-quota session creates need no retry logic: they queue by default and start on their own.

Session failures

A settled session reports two signals on status, the Session object, and changes, so your code can branch without parsing prose.

Outcomes

A session can end completed and still not do what you asked. outcome is the agent’s own assessment, reported with its final answer: outcome is a self-assessment, not verified ground truth: validate the answer itself for high-stakes flows. It is null when the agent ended without reporting one.

Error codes

When a session ends failed or timed_out, it carries an error_code and an error message matching it:
  • error_code is null unless the status is failed or timed_out.
  • New codes may appear: treat unknown values like internal.
  • error is a stable template derived from the code, never raw internals. Branch on error_code, log error.