AI reply agent
How an inbound message becomes a sent reply, a Draft with a Task, or a hand-off to a person, and how the agent's sessions and turns work.
The reply agent answers inbound messages on every channel. In the app it is called Kit. It runs inside the backend process on the Strands Agents framework: a model that works in a loop, calling tools until it decides to reply or to hand the conversation to a person.
A second, read-only agent answers teammates’ questions from the command palette (Ask Kit). It shares the model setup and the knowledge search with the reply agent; see The Ask agent.
Key rules
- The agent keeps one session per receiving account and person, in the backend’s memory.
- A turn ends by submitting a reply or by handing off to a person. A turn that ends any other way is handed off.
- A reply goes out on its own only when its self-rated confidence reaches the workspace threshold (0.6 by default) and it passes the prompt-leak screen. Every other reply becomes a Draft with a Task.
- A person whose bot switch is off, or a suppressed contact, never gets an automatic reply.
- Every tool call is written to the person’s timeline.
The message is tied to the account that received it, the contact and the person are found or created, and the message lands on the person's timeline. Campaign reply matching sees it at the same moment.
Inbound path
Each channel (email over SES or IMAP, LinkedIn, Telegram, Zalo) reports new messages to the backend in the same shape. For each message the backend:
- finds the connected account that received it;
- finds or creates the contact and the person;
- writes the message to the person’s timeline;
- tells campaign reply matching, which may wake a waiting campaign Step (see Waits, branches and exits);
- hands the message to the reply agent.
Gates
Before any model call, the agent drops or diverts messages it should not answer:
| Message | Result |
|---|---|
| Empty, or junk such as one word repeated or a run of the same character | Skipped |
| A bare acknowledgement (“ok”, “thanks”, “vâng”), in English or Vietnamese | Skipped, unless the team’s last message asked a question and this one confirms it |
| The workspace has no chat model | Skipped, with a warning in the log |
| The person’s bot switch is off | Skipped |
| The contact is suppressed | Handed to a person as “Suppressed contact re-engaged”, with no draft |
The bot switch on a person is a system tag that every workspace gets. The Inbox thread actions, the person page, the agent’s own tool and the Hand to AI agent campaign Step all turn it on or off.
Sessions
The agent keeps one session per receiving account and person, in memory. A session is built once even when several messages arrive together; a build that fails is thrown away so the next message tries again.
Each new message refreshes what the session knows: the thread to reply in, the message to reply to, the person’s owner, the confidence threshold and the team rules. The tools read these at call time, so a reply always goes to the newest thread and a changed threshold applies from the next message.
A session is rebuilt when it is idle and out of date: the workspace chat model changed, or the AI account behind it changed, such as a rotated API key. Sessions idle for 45 minutes are dropped. A restart drops every session, and the next message builds a new one from the timeline.
Turns
A turn is one run of the agent loop for a session. Only one turn runs per session at a time.
- Messages that arrive during a turn wait in a queue. Before each model call the agent is shown them as new messages from the customer. If the agent tries to submit a reply while messages are still waiting, the submission is refused and the agent writes the reply again with the new messages in mind.
- When the agent finishes with messages still queued, it runs again at once on those messages, inside the same turn.
- A model stream that produces nothing for two minutes is treated as stalled and the turn fails.
- A turn that fails, or in which the agent never submitted a reply or handed off, is handed to a person: a Task and a draft entry without text.
Outcomes
The confidence gate decides between sending and drafting.
| Outcome | When | What is recorded |
|---|---|---|
| Sent | The reply reaches the confidence threshold and passes the screen | The outbound message, in the same thread, with up to 3 attachments and the knowledge sources it used |
| Draft | The reply is below the threshold, or the screen caught it | A Task “Review auto-reply (low confidence)” for the person’s owner, and a draft on the timeline with the text, confidence, reason and sources. The Inbox lists it under Needs review. |
| Hand-off | The agent handed off, a gate diverted the message, or the turn failed | The same Task and draft entry, without text |
A draft or a hand-off also posts a notice to Slack when the workspace has connected it.
The Ask agent
Ask Kit answers a teammate’s question from the command palette. Each question builds a fresh agent on the workspace chat model with read-only tools: knowledge search, finding people, finding deals and campaign figures. It may take up to 8 agent steps and 90 seconds, and returns an answer that links the sources, people and deals it used. Each user may ask 10 questions a minute; the limit is counted in the backend’s memory.