How should my code handle Agent API errors?
A good default:
| Status | Action |
|---|---|
| 400, 404, 405, 413 | Don't retry; fix the request |
| 401 | Don't retry; check key and Account ID |
402 out_of_credits | Stop creating runs; alert someone |
403 account_suspended | Don't retry before resets_at |
| 403 other | Fix permissions or access |
| 429 | Wait Retry-After seconds, then retry |
| 502, 503 | Retry with exponential backoff |
Always branch on error.code, log the message, and include the run id or time when you contact support.
Learn more#
Related articles
Still need help?
Tried the steps above and still stuck? Email us. We usually reply within the first hour, and always within 24 hours. A full support team is with you.
Infrastructure questions, or permanent deletion of your data
infrastructure@clatterlabs.xyzFor deleting your whole account or the data of one service.