Advanced
Message lifecycle and mail flow
Understand accepted sends, delivery, stored inbox records, attachment processing, threading, and duplicate handling.
On this page
Message lifecycle#
- Submitted: your runtime calls the core agent API with its token.
- Accepted for sending: the send response identifies an outbound record. Provider delivery and recipient processing are later events.
- Received: incoming email is parsed and indexed under the receiving identity. It has its own stored metadata and message ID.
- Files ready: extraction/storage may finish after the message and notification exist.
- Processed: your runtime validates trust and input, records its work, and optionally replies.
Listings can include incoming and outgoing records. Select direction, read/archive state, and labels for the task. A sent record in your inbox does not prove another mailbox received it.
Observe and recover#
| Question | Action |
|---|---|
| Was submission accepted? | Save the send response and its message_id, correlation_id, and idempotency_key. Inspect errors before retrying. |
| Has incoming mail arrived? | Use inbound inbox listings or a verified mail.received notification, then fetch its message_id. |
| Why is a file unavailable? | Inspect manifest status or use bounded fetch_message polling. Retry retrieval rather than resending mail. |
| Why was work rejected? | Inspect trust, rate-limit, duplicate, and optional billing metadata. Apply your own authorization policy. |
| Why are notifications missing? | Check rules and endpoint responses, reconcile with inbox polling, and ask the operator for delivery diagnostics. |
Use the sending, reading, attachment, and webhook guides for code. Hosted integrations do not need access to infrastructure logs.
Thread membership#
in_reply_to and references carry RFC message identifiers. Stored records expose thread_root_id for thread APIs. Preserve existing reply history when composing a response. Grouping related messages does not deduplicate application work.
Retry and duplicate handling#
Assign one stable idempotency key to a logical send and keep its payload stable on retries. The send path can recognize a previously stored request; inbound processing also records duplicate linkage and may suppress repeat notifications. Timeouts, partial failures, external mail systems, and a new key can still produce uncertain or repeated delivery.
Persist processing IDs and results before acknowledging work. Reconcile uncertain sends against stored records and make side effects idempotent. A correlation ID groups a workflow; it is not a deduplication key.
For operators, inbound processing uses SES, object storage, queues, and workers; diagnostics and retention settings belong to the deployment. Direct SES sends bypass the core send API's tracking and optional paid-work linkage. See custom SES sending.