Agent Surface

Make your product agent-ready

Error Handling

Structured errors that enable agents to diagnose failures and recover autonomously

Last verified 2026-09-24

Summary

Error Handling covers structured failures that tell agents what happened and what to do next. Use it for HTTP errors, tool errors, errors, retry policy, validation feedback, and recovery.

  • Owns: Problem Details, agent extensions, retry signals, idempotency keys, recovery suggestions, IDs, and CLI error contracts.
  • Does not own: authentication flows themselves; see Authentication. Tool naming and schemas; see Tool Design.
  • Agent-ready means: the failure body is structured enough for the agent to retry, change input, switch tools, wait, or escalate without parsing prose.

Start Here

  1. RFC 9457 - Use Problem Details as the base error shape, plus agent extensions (retriable flags, suggestions, trace IDs, field errors).
  2. Errors for Agents - Write failures as recovery contracts, not blame.
  3. Retry Patterns - Separate transient failures from terminal ones.
  4. Idempotency - Make write retries safe.
  5. CLI Errors - Map command failures to structured output and stable exit codes.
  1. API Surface - Expose error types as part of the HTTP contract.
  2. CLI Design - Make command failures parseable and automatable.
  3. Tool Design: Idempotency and Safety - Classify tool operations before retrying them.
  4. Authentication - Use structured auth failures instead of opaque 401/403 responses.
  5. Testing - Verify recovery and retry behavior with evals and contract tests.

On this page