Error Handling Patterns for Email Agents Nylas outlines error handling patterns for email agents, distinguishing between synchronous failures (like rate limits) and asynchronous bounces detected via webhooks. The company emphasizes that only 429 errors are retryable, while 400 and 403 errors indicate states requiring manual intervention. For connected mailboxes, the message.bounce_detected webhook provides bounce details, with 5xx codes triggering suppression lists and 4xx codes allowing capped retries. A REST API fails synchronously — you get a 4xx and handle it on the spot. Email fails on a delay: the send call returns success, and the actual failure shows up minutes later as a bounce. An autonomous agent that only handles the first kind of error is half-built, and the half it's missing is the half that gets its sending paused. Here's the full failure surface for an email agent, and the retry design that survives it. The context: agents built on Agent Accounts https://developer.nylas.com/docs/v3/agent-accounts/ — hosted mailboxes the agent owns, currently in beta — where the agent itself decides when to send. That autonomy is exactly why error handling can't be an afterthought: a human notices when replies stop landing; a loop doesn't. Some failures do come back synchronously on the send request, and each maps to a different response from your code: | Status | Body | What your agent should do | |---|---|---| 429 | "rate limit exceeded" | Back off and retry; raise quotas via policy if it recurs | 400 | "domain is not verified" | Stop — finish domain verification, retrying is pointless | 400 | Text indicating sending is paused for the account | Stop all sends; a reputation pause is in effect | 403 | send blocked by abuse restriction | Stop and contact support — there's no quota to wait out | The pattern worth internalizing: only the 429 is retryable. The two 400 s and the 403 are states, not transient failures, and a naive exponential-backoff-everything loop will hammer an endpoint that can't succeed. The 403 deserves special respect — abuse restrictions can be scoped to a sender, a domain, an organization, an application, or a single grant, and Nylas applies the most specific match. An application-level block affects every account under that application, not just the one you sent from. Recovery is a support conversation, not a timer: include the application ID, the grant ID, and one example error response so the abuse team can locate the restriction. The good news is that once it's cleared, sends succeed on the next attempt — there's no propagation delay to wait through. For mail sent through connected mailboxes Google, Microsoft, iCloud, Yahoo — the 4 providers that generate Non-Delivery Reports , the message.bounce detected webhook delivers the failure your send call never saw: { "type": "message.bounce detected", "data": { "grant id": "