|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | +<head> |
| 4 | + <meta charset="UTF-8"> |
| 5 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 6 | + <title>Multi-Agent System - OpenAnalyst CLI Docs</title> |
| 7 | + <link rel="stylesheet" href="styles.css"> |
| 8 | + <link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet"> |
| 9 | +</head> |
| 10 | +<body> |
| 11 | + <div class="docs-layout"> |
| 12 | + |
| 13 | + <nav class="sidebar"> |
| 14 | + <div class="sidebar-logo"> |
| 15 | + <a href="../Index.html"> |
| 16 | + <img src="https://openanalyst.com/images/new-logo.png" alt="OA" > |
| 17 | + <h2>OpenAnalyst CLI</h2> |
| 18 | + </a> |
| 19 | + <span data-version-prefix="Documentation v">Documentation v1.0.106</span> |
| 20 | + </div> |
| 21 | + <div class="sidebar-section"> |
| 22 | + <div class="sidebar-section-title">Documentation</div> |
| 23 | + |
| 24 | + <a href="index.html" class="sidebar-link">Introduction</a> |
| 25 | + <a href="installation.html" class="sidebar-link">Installation</a> |
| 26 | + <a href="quickstart.html" class="sidebar-link">Quick Start</a> |
| 27 | + <a href="authentication.html" class="sidebar-link">Authentication</a> |
| 28 | + </div> |
| 29 | + <div class="sidebar-section"> |
| 30 | + <div class="sidebar-section-title">Core Concepts</div> |
| 31 | + <a href="providers.html" class="sidebar-link">LLM Providers</a> |
| 32 | + <a href="tui.html" class="sidebar-link">Terminal UI</a> |
| 33 | + <a href="commands.html" class="sidebar-link">Slash Commands</a> |
| 34 | + <a href="tools.html" class="sidebar-link">Built-in Tools</a> |
| 35 | + </div> |
| 36 | + <div class="sidebar-section"> |
| 37 | + <div class="sidebar-section-title">Advanced</div> |
| 38 | + <a href="agents.html" class="sidebar-link active">Multi-Agent System</a> |
| 39 | + <a href="configuration.html" class="sidebar-link">Configuration</a> |
| 40 | + <a href="mcp.html" class="sidebar-link">MCP Integration</a> |
| 41 | + <a href="architecture.html" class="sidebar-link">Architecture</a> |
| 42 | + </div> |
| 43 | + </nav> |
| 44 | + |
| 45 | + <main class="main-content"> |
| 46 | + |
| 47 | + <div class="page-header"> |
| 48 | + <span class="badge">Advanced</span> |
| 49 | + <h1>Multi-Agent System</h1> |
| 50 | + <p class="subtitle">Orchestrate parallel agents, autonomous loops, and swarm task decomposition for complex workflows.</p> |
| 51 | + </div> |
| 52 | + |
| 53 | + <h2 id="overview">Agent Types</h2> |
| 54 | + |
| 55 | + <div class="card-grid"> |
| 56 | + <div class="card"> |
| 57 | + <div class="card-icon">💬</div> |
| 58 | + <h3>Primary Agent</h3> |
| 59 | + <p>The interactive conversational agent. Always one active, connected to your TUI or REPL.</p> |
| 60 | + </div> |
| 61 | + <div class="card"> |
| 62 | + <div class="card-icon">🔍</div> |
| 63 | + <h3>Explore Agent</h3> |
| 64 | + <p>Fast, read-only codebase exploration. Uses search and file reading tools only.</p> |
| 65 | + </div> |
| 66 | + <div class="card"> |
| 67 | + <div class="card-icon">📋</div> |
| 68 | + <h3>Plan Agent</h3> |
| 69 | + <p>Read-only architecture and design planning. Returns step-by-step implementation plans.</p> |
| 70 | + </div> |
| 71 | + <div class="card"> |
| 72 | + <div class="card-icon">⚙</div> |
| 73 | + <h3>General Agent</h3> |
| 74 | + <p>Full-tool access general-purpose agent. Can read, write, execute, and search.</p> |
| 75 | + </div> |
| 76 | + </div> |
| 77 | + |
| 78 | + <h2 id="sub-agents">Sub-Agents</h2> |
| 79 | + <p>The primary agent can spawn sub-agents for parallel work. Each sub-agent has its own conversation runtime, tool permissions, and token budget.</p> |
| 80 | + |
| 81 | + <pre><code><span class="token-comment"># The agent tool spawns sub-agents automatically when needed.</span> |
| 82 | +<span class="token-comment"># For example, when exploring a large codebase:</span> |
| 83 | +"Search for all API endpoints in this project" |
| 84 | + |
| 85 | +<span class="token-comment"># The agent may spawn an Explore sub-agent to search in parallel</span> |
| 86 | +<span class="token-comment"># while continuing to work on the main task.</span></code></pre> |
| 87 | + |
| 88 | + <h2 id="swarm">Agent Swarm</h2> |
| 89 | + <p>Use <code>/swarm</code> to decompose a complex task into parallel sub-tasks, each handled by a separate agent:</p> |
| 90 | + |
| 91 | + <pre><code><span class="token-comment"># Spawn multiple agents for parallel task execution</span> |
| 92 | +/swarm refactor all API handlers to use the new error type</code></pre> |
| 93 | + |
| 94 | + <p>The swarm:</p> |
| 95 | + <ol> |
| 96 | + <li>Analyzes the task and decomposes it into independent sub-tasks</li> |
| 97 | + <li>Spawns a dedicated agent for each sub-task</li> |
| 98 | + <li>Runs all agents in parallel</li> |
| 99 | + <li>Collects and synthesizes results</li> |
| 100 | + </ol> |
| 101 | + |
| 102 | + <h2 id="autonomous">Autonomous Agent</h2> |
| 103 | + <p>The <code>/openanalyst</code> command runs a fully autonomous agent loop inspired by the Karpathy agentic pattern:</p> |
| 104 | + |
| 105 | + <pre><code>/openanalyst "add comprehensive error handling to the API module" --max-turns 20</code></pre> |
| 106 | + |
| 107 | + <h3>The Loop: Think → Act → Observe → Verify</h3> |
| 108 | + |
| 109 | + <div class="steps"> |
| 110 | + <div class="step"> |
| 111 | + <h3>Think</h3> |
| 112 | + <p>The agent uses extended thinking (when available) to plan the next action. It considers the goal, current state, and what it has learned so far.</p> |
| 113 | + </div> |
| 114 | + <div class="step"> |
| 115 | + <h3>Act</h3> |
| 116 | + <p>Executes one or more tool calls: reading files, editing code, running commands, or searching.</p> |
| 117 | + </div> |
| 118 | + <div class="step"> |
| 119 | + <h3>Observe</h3> |
| 120 | + <p>Processes tool results and updates its understanding of the codebase state.</p> |
| 121 | + </div> |
| 122 | + <div class="step"> |
| 123 | + <h3>Verify</h3> |
| 124 | + <p>Self-checks whether the goal has been achieved. If not, loops back to Think. If verification criteria are provided, runs them.</p> |
| 125 | + </div> |
| 126 | + </div> |
| 127 | + |
| 128 | + <h3>Options</h3> |
| 129 | + <div class="param-table"> |
| 130 | + <div class="param-row"> |
| 131 | + <span class="param-name">--goal <text></span> |
| 132 | + <span class="param-type">string</span> |
| 133 | + <span class="param-optional">Optional</span> |
| 134 | + <span class="param-desc">Explicit goal statement for the agent</span> |
| 135 | + </div> |
| 136 | + <div class="param-row"> |
| 137 | + <span class="param-name">--criteria <cmd></span> |
| 138 | + <span class="param-type">string</span> |
| 139 | + <span class="param-optional">Optional</span> |
| 140 | + <span class="param-desc">Shell command to verify success (exit code 0 = done)</span> |
| 141 | + </div> |
| 142 | + <div class="param-row"> |
| 143 | + <span class="param-name">--max-turns <n></span> |
| 144 | + <span class="param-type">number</span> |
| 145 | + <span class="param-optional">Optional</span> |
| 146 | + <span class="param-desc">Maximum loop iterations before stopping</span> |
| 147 | + </div> |
| 148 | + </div> |
| 149 | + |
| 150 | + <h2 id="moe">Mixture of Experts (MOE)</h2> |
| 151 | + <p>For complex problems, the orchestrator can dispatch to multiple specialized agents simultaneously, each using a model best suited for their task type:</p> |
| 152 | + |
| 153 | + <table> |
| 154 | + <thead><tr><th>Agent Role</th><th>Optimized For</th><th>Example Model</th></tr></thead> |
| 155 | + <tbody> |
| 156 | + <tr><td>Explorer</td><td>Fast codebase search</td><td>haiku / grok-mini</td></tr> |
| 157 | + <tr><td>Planner</td><td>Architecture design</td><td>opus / gemini-2.5-pro</td></tr> |
| 158 | + <tr><td>Coder</td><td>Code generation</td><td>sonnet / gpt-4o</td></tr> |
| 159 | + <tr><td>Writer</td><td>Documentation</td><td>sonnet / gemini-2.5-flash</td></tr> |
| 160 | + </tbody> |
| 161 | + </table> |
| 162 | + |
| 163 | + <h2 id="model-routing">Smart Model Routing</h2> |
| 164 | + <p>The <code>ModelRouter</code> automatically selects the best model for each action type. Configure routing with:</p> |
| 165 | + |
| 166 | + <pre><code><span class="token-comment"># View the routing table</span> |
| 167 | +/route |
| 168 | + |
| 169 | +<span class="token-comment"># Set routing for a category</span> |
| 170 | +/route explore haiku |
| 171 | +/route code sonnet |
| 172 | +/route plan opus</code></pre> |
| 173 | + |
| 174 | + <h2 id="effort">Effort Budget</h2> |
| 175 | + <p>Control how much "thinking" the agent invests per category:</p> |
| 176 | + |
| 177 | + <pre><code><span class="token-comment"># Set global effort</span> |
| 178 | +/effort high |
| 179 | + |
| 180 | +<span class="token-comment"># Set per-category effort</span> |
| 181 | +/effort explore low |
| 182 | +/effort plan max |
| 183 | +/effort code medium</code></pre> |
| 184 | + |
| 185 | + <table> |
| 186 | + <thead><tr><th>Level</th><th>Description</th></tr></thead> |
| 187 | + <tbody> |
| 188 | + <tr><td><code>low</code></td><td>Minimal thinking, fast responses</td></tr> |
| 189 | + <tr><td><code>medium</code></td><td>Balanced thinking and speed</td></tr> |
| 190 | + <tr><td><code>high</code></td><td>More thorough reasoning</td></tr> |
| 191 | + <tr><td><code>max</code></td><td>Extended thinking with full reasoning chains</td></tr> |
| 192 | + </tbody> |
| 193 | + </table> |
| 194 | + |
| 195 | + <h2 id="lifecycle">Agent Lifecycle Events</h2> |
| 196 | + <p>The TUI displays real-time agent events:</p> |
| 197 | + <ul> |
| 198 | + <li><strong>AgentSpawned</strong> — New agent created with parent-child relationship</li> |
| 199 | + <li><strong>AgentStatusChanged</strong> — Pending → Running → Completed/Failed</li> |
| 200 | + <li><strong>AgentCompleted</strong> — Agent finished with result summary</li> |
| 201 | + <li><strong>AgentFailed</strong> — Agent encountered an error</li> |
| 202 | + </ul> |
| 203 | + |
| 204 | + <div class="page-footer"> |
| 205 | + <a href="tools.html">← Built-in Tools</a> |
| 206 | + <a href="configuration.html">Configuration →</a> |
| 207 | + </div> |
| 208 | + |
| 209 | + </main> |
| 210 | + </div> |
| 211 | +<script src="../version.js"></script> |
| 212 | +<footer style="text-align:center;padding:32px;color:#6b6966;font-size:12px">© 2026 OpenAnalyst Inc. All rights reserved. OpenAnalyst is a registered trademark of OpenAnalyst Inc. Contact: support@openanalyst.com</footer></body> |
| 213 | +</html> |
0 commit comments