Overview
The agent loop is the core execution cycle that runs for every incoming message. It follows a receive -> think -> act -> respond pattern, with multiple tool-use iterations possible before a final response.The Loop
Step by Step
1. Receive Message
The gateway delivers a normalized message to the agent runtime. The message includes the text content, sender identity, channel source, and any attachments.2. Context Injection
Before sending to the LLM, ArgentOS injects contextual information:- Timestamp envelope:
[Wed 2026-02-12 10:30 America/Chicago]with elapsed time since last message - Memory bootstrap: Relevant memories recalled from MemU based on the message content
- Plugin injections: Any active plugins can inject additional context
3. Send to LLM
The assembled prompt (system prompt + conversation history + new message) is sent to the LLM via the model router. The router selects the appropriate model tier based on complexity scoring.4. Process Response
The LLM response can contain:- Text blocks: Natural language responses streamed to the user
- Tool use blocks: Requests to execute tools (bash, memory, tasks, browser, etc.)
5. Tool Execution
When the model requests a tool, the agent runtime:This loop can iterate multiple times. A single user message might trigger several tool calls before the agent produces a final answer.
