Agent loop
The agent runs a multi-turn tool-use loop with up to 10 iterations (configurable viaAGENT_MAX_ITERATIONS). Each iteration:
- The agent receives the conversation context and available tools
- It decides whether to call a tool or finish processing
- Tool results are fed back for the next iteration
- The loop ends when the agent calls the
donetool or hits the iteration limit
Decision outcomes
The agent classifies each conversation into one of four outcomes:| Decision | Description |
|---|---|
CREATE | New task created from the conversation |
UPDATE | Existing task updated with new information |
ACK_REQUESTER | Acknowledged the requester without creating a task |
IGNORE | Conversation doesn’t contain an actionable task |
Available tools
The agent has access to these tools during processing:Task tools
| Tool | Description |
|---|---|
search_tasks | Hybrid search across existing tasks (BM25 + semantic + LLM reranking) |
create_task | Create a new task after confirming no duplicates exist |
update_task | Append to description, add labels, or change priority |
close_task | Mark a resolved task as done |
Contact tools
| Tool | Description |
|---|---|
lookup_contact | Search for known contacts by name or identity |
upsert_contact | Create or update a contact profile |
link_contact_identity | Link a new channel identity to an existing contact |
merge_contacts | Consolidate duplicate contact records |
Control tools
| Tool | Description |
|---|---|
done | Signal processing is complete and return a summary |
Deduplication
The agent uses adedupe_key system to prevent duplicate tasks. Each key follows the format:
backend::fix::login-timeout or design::create::new-landing-page.
Before creating a task, the agent searches for existing tasks with similar dedupe keys and descriptions using vector similarity. If a likely duplicate is found, the agent updates the existing task instead.
Conversation context
The agent receives:- The channel name and type (Slack, WhatsApp, etc.)
- Recent messages in the conversation with sender information
- The linked contact profiles for known senders
- A system prompt that defines the agent’s behavior and available tools