diff --git a/README.md b/README.md index b9db1863..3e0132a1 100644 --- a/README.md +++ b/README.md @@ -186,109 +186,10 @@ JSON file: ### Component Overview -``` -┌─────────────────────────────────────────────────────────────┐ -│ User/CLI │ -└────────────┬─────────────────────────────────────┬──────────┘ - │ Operations │ Events - ↓ (user_input, exec_approval, ↑ - submission_queue interrupt, compact, ...) event_queue - │ │ - ↓ │ -┌────────────────────────────────────────────────────┐ │ -│ submission_loop (agent_loop.py) │ │ -│ ┌──────────────────────────────────────────────┐ │ │ -│ │ 1. Receive Operation from queue │ │ │ -│ │ 2. Route to handler (run_agent/compact/...) │ │ │ -│ └──────────────────────────────────────────────┘ │ │ -│ ↓ │ │ -│ ┌──────────────────────────────────────────────┐ │ │ -│ │ Handlers.run_agent() │ ├──┤ -│ │ │ │ │ -│ │ ┌────────────────────────────────────────┐ │ │ │ -│ │ │ Agentic Loop (max 300 iterations) │ │ │ │ -│ │ │ │ │ │ │ -│ │ │ ┌──────────────────────────────────┐ │ │ │ │ -│ │ │ │ Session │ │ │ │ │ -│ │ │ │ ┌────────────────────────────┐ │ │ │ │ │ -│ │ │ │ │ ContextManager │ │ │ │ │ │ -│ │ │ │ │ • Message history │ │ │ │ │ │ -│ │ │ │ │ (litellm.Message[]) │ │ │ │ │ │ -│ │ │ │ │ • Auto-compaction (170k) │ │ │ │ │ │ -│ │ │ │ │ • Session upload to HF │ │ │ │ │ │ -│ │ │ │ └────────────────────────────┘ │ │ │ │ │ -│ │ │ │ │ │ │ │ │ -│ │ │ │ ┌────────────────────────────┐ │ │ │ │ │ -│ │ │ │ │ ToolRouter │ │ │ │ │ │ -│ │ │ │ │ ├─ HF docs & research │ │ │ │ │ │ -│ │ │ │ │ ├─ HF repos, datasets, │ │ │ │ │ │ -│ │ │ │ │ │ jobs, papers │ │ │ │ │ │ -│ │ │ │ │ ├─ GitHub code search │ │ │ │ │ │ -│ │ │ │ │ ├─ Sandbox & local tools │ │ │ │ │ │ -│ │ │ │ │ ├─ Planning │ │ │ │ │ │ -│ │ │ │ │ └─ MCP server tools │ │ │ │ │ │ -│ │ │ │ └────────────────────────────┘ │ │ │ │ │ -│ │ │ └──────────────────────────────────┘ │ │ │ │ -│ │ │ │ │ │ │ -│ │ │ ┌──────────────────────────────────┐ │ │ │ │ -│ │ │ │ Doom Loop Detector │ │ │ │ │ -│ │ │ │ • Detects repeated tool patterns │ │ │ │ │ -│ │ │ │ • Injects corrective prompts │ │ │ │ │ -│ │ │ └──────────────────────────────────┘ │ │ │ │ -│ │ │ │ │ │ │ -│ │ │ Loop: │ │ │ │ -│ │ │ 1. LLM call (litellm.acompletion) │ │ │ │ -│ │ │ ↓ │ │ │ │ -│ │ │ 2. Parse tool_calls[] │ │ │ │ -│ │ │ ↓ │ │ │ │ -│ │ │ 3. Approval check │ │ │ │ -│ │ │ (jobs, sandbox, destructive ops) │ │ │ │ -│ │ │ ↓ │ │ │ │ -│ │ │ 4. Execute via ToolRouter │ │ │ │ -│ │ │ ↓ │ │ │ │ -│ │ │ 5. Add results to ContextManager │ │ │ │ -│ │ │ ↓ │ │ │ │ -│ │ │ 6. Repeat if tool_calls exist │ │ │ │ -│ │ └────────────────────────────────────────┘ │ │ │ -│ └──────────────────────────────────────────────┘ │ │ -└────────────────────────────────────────────────────┴──┘ -``` - -### Agentic Loop Flow +![alt text]() -``` -User Message - ↓ -[Add to ContextManager] - ↓ - ╔═══════════════════════════════════════════╗ - ║ Iteration Loop (max 300) ║ - ║ ║ - ║ Get messages + tool specs ║ - ║ ↓ ║ - ║ litellm.acompletion() ║ - ║ ↓ ║ - ║ Has tool_calls? ──No──> Done ║ - ║ │ ║ - ║ Yes ║ - ║ ↓ ║ - ║ Add assistant msg (with tool_calls) ║ - ║ ↓ ║ - ║ Doom loop check ║ - ║ ↓ ║ - ║ For each tool_call: ║ - ║ • Needs approval? ──Yes──> Wait for ║ - ║ │ user confirm ║ - ║ No ║ - ║ ↓ ║ - ║ • ToolRouter.execute_tool() ║ - ║ • Add result to ContextManager ║ - ║ ↓ ║ - ║ Continue loop ─────────────────┐ ║ - ║ ↑ │ ║ - ║ └───────────────────────┘ ║ - ╚═══════════════════════════════════════════╝ -``` +Agentic Loop Flow +![alt text]() ## Events diff --git a/Screenshot 2026-05-07 at 15.45.18.png b/Screenshot 2026-05-07 at 15.45.18.png new file mode 100644 index 00000000..47b8aee0 Binary files /dev/null and b/Screenshot 2026-05-07 at 15.45.18.png differ diff --git a/Screenshot 2026-05-07 at 15.48.13.png b/Screenshot 2026-05-07 at 15.48.13.png new file mode 100644 index 00000000..db72860a Binary files /dev/null and b/Screenshot 2026-05-07 at 15.48.13.png differ