Errors and retries
Errors normally contain a stable code, a human-readable detail, and optional extra. Branch on code.
| Category | Handling |
|---|---|
| 400 / 422 | Fix request fields; do not retry unchanged |
| 401 / 403 | Check key, delegation token, project, and scope |
| 404 | Check the project and resource ID |
| 409 | Read the resource state before acting again |
| 429 | Honor Retry-After and back off |
| 5xx / network failure | Retry with a bounded backoff when safe |
The current Node SDK does not automatically retry ordinary requests. SSE reconnects are handled by the event stream, but application code decides whether a POST is safe to repeat.
When a run fails, read failure_reason, failure_detail, and terminal_reason. awaiting_input means that an interaction is required, not that the network failed. The current DoAnything duration error is max_duration_exceeded; do not use the old duration_exceeded name.
For SSE reconnects, persist the last event ID and send it back:
http
GET /api/v1/projects/{pid}/do_anything/runs/{run_id}/events
Last-Event-ID: 142Deduplicate events by ID after reconnecting.