Agent memory
Retrieve inbox context before an agent acts.
Assemble messages, contacts, files, activity, and audit entries before drafting, routing, or escalating an email.
Token first
Make sure the agent has these scopes.
Create a new token or update the agent's current token before trying the calls below.
Required token scopes
email:read
email:send
files:read
contacts:read
context:read
Outcome
What this gives you.
The agent answers from the operational record instead of from a disconnected prompt.
Use when
The operational shape.
- An agent needs to answer questions using prior mail, attachments, files, and contact history.
- A human reviewer needs evidence next to the draft or escalation.
- You want a repeatable retrieval pattern before any high-impact action.
API sequence
The calls to make.
01
Read the thread
GET/v1/messages/threads/{thread_id}/
Fetch the conversation, labels, participants, and recent replies.
02
Fetch related records
GET/v1/contacts/{contact_id}/
Pull contact details, relationship context, and optional enrichment.
03
Collect files and activity
GET/v1/activity/
Find linked files, prior workflow actions, approvals, and recent state changes.
04
Submit the supervised reply
POST/v1/messages/
Use an email:send token configured with requires_approval for email:send; the send attempt queues a held action and returns an approval_id.
Default example
Use this as the default shape for this step.
{
"to": [{"email": "client@example.com"}],
"reply_to_message_id": "msg_123",
"text_body": "I checked the latest document and the prior approval. The next step is ready for review."
}
Controls
Review points.
- The retrieval bundle should store IDs, not pasted blobs, so reviewers can reopen the source of truth.
- Approvals are created by the guarded action; do not POST directly to /v1/approvals/.