BoxAgnts Introduction (6) — Agent Multi-Turn Conversation and Tool/Skill Invocation BoxAgnts implements a multi-turn agent conversation system that requires three API calls and two tool executions to complete a single user request, such as reading a config file and changing a port number. The system supports three pre-installed agent roles—build, plan, and explore—each with different permission levels and prompt characteristics that can override model selection and maximum turn limits. The core `run_query_loop()` function manages conversation history, tool execution within WASM sandboxes, streaming push, and context management across multiple API interactions. If you've only chatted with ChatGPT, you might think an AI Agent is simply "send a prompt to the API, display the response." The reality is far more complex. Here is a complete Agent interaction flow in BoxAgnts: User input: "Help me read config.toml and change port to 9090" 1. User message added to conversation history 2. Build system prompt tool list + skill list + AGENTS.md + Agent role definition 3. Call LLM API → stream receive response 4. AI decides to call tool: tool use "read", {path: "config.toml"} 5. Execute read tool within WASM sandbox 6. Tool result injected into conversation history 7. Call API again → AI analyzes config 8. AI decides to call tool: tool use "edit", {path: "config.toml", old: "port = 8080", new: "port = 9090"} 9. Execute edit tool 10. Tool result injected into conversation 11. Call API again → AI responds: "Port has been changed from 8080 to 9090" 12. end turn → Conversation ends This process involves 3 API calls, 2 tool executions, streaming push, and context management. This article dissects the design and implementation of each link. Before starting the reasoning loop, the Agent's "role" needs to be defined. BoxAgnts comes with three pre-installed Agents: // boxagnts-workspace/src/config.rs pub struct AgentDefinition { pub description: "Option