How it works
1
Assign an agent to an inbox
Set the
agentId field on an inbox to your agent’s identifier. This can be any string, a name, a UUID, or a reference to your agent registry.2
Receive the webhook
When a message arrives at an agent-enabled inbox, Nuntly emits both
message.received and message.agent.triggered. Your server receives the
event with the message ID and thread context.3
Read and process
Your agent fetches the message content through the API, full text, HTML, and attachments. It loads any stored conversation memory, then calls your
AI model with the message and context.
4
Respond and remember
Your agent sends a reply through the API, which is added to the same thread and delivered via email. It then saves updated conversation memory so
the next message in the thread has the full context.
Assign an agent to an inbox
SetagentId when creating or updating an inbox.
Webhook event
When a message arrives at an inbox with anagentId, Nuntly emits a message.agent.triggered event in addition to message.received. Subscribe to this event in your webhook configuration.
See receiving events for the full event payload.
Agent memory
The agent memory API lets your agent persist data between messages. This is how your agent maintains context across a multi-email conversation: customer preferences, ticket status, prior summaries, or any structured data your model needs. Memory is scoped at three levels:
Memory is a JSON object with primitive values (
string, number, boolean, null, or arrays of primitives). Limits vary by scope:
The
summary string is useful for a condensed narrative of the conversation that you pass to your model without replaying the full history.
Get memory
Upsert memory
Complete example with Claude
The following example shows a complete agent handler using the Claude API. It receives themessage.agent.triggered webhook, reads the email, loads stored conversation memory, generates a reply with Claude, sends the reply, and saves updated memory.
The summary is generated by a faster model to keep latency low. It replaces the previous summary on each turn, acting as a rolling memory window
rather than a growing history.
Multi-agent platforms
You can run multiple specialized agents across different inboxes, each with its ownagentId and memory. Use namespaces to group an agent’s inboxes together.
For example, a platform with a support agent, a billing agent, and a sales agent might look like:
message.agent.triggered events and manages its own memory independently.
Next steps
Receiving events
See the full payload for agent-triggered events
Send, reply, and forward
Learn how agents can send replies from inboxes
Namespaces
Organize agent inboxes with namespaces
