feat: transform AI into Manager Agent with sub-agent delegation (Phase 7)#10
Open
coder-contrib-bot wants to merge 7 commits into
Open
feat: transform AI into Manager Agent with sub-agent delegation (Phase 7)#10coder-contrib-bot wants to merge 7 commits into
coder-contrib-bot wants to merge 7 commits into
Conversation
Rewrites manager_agent.py as a true orchestrator that delegates to specialized sub-agents via meta-tools. Updates claude_client.py to use the delegation pattern instead of running all 25 tools monolithically. The Manager Agent now has: - 3 delegation meta-tools (sales, inventory, accounting) - A few quick-lookup tools for simple queries - Claude decides routing via reasoning, not keyword matching Each sub-agent runs its own independent tool loop, executes multi-step operations autonomously, and returns a final result to the Manager. GIT_AUTHOR_NAME: Claude (AI Agent) GIT_AUTHOR_EMAIL: noreply@anthropic.com
Rewrites all agent prompts to reflect the new delegation model: - Manager knows it delegates, not executes directly - Sub-agents know they are specialized executors called by the Manager - Includes clear routing examples and multi-domain handling GIT_AUTHOR_NAME: Claude (AI Agent) GIT_AUTHOR_EMAIL: noreply@anthropic.com
The old SalesAgent, InventoryAgent, and AccountingAgent were keyword-based routing stubs with no execution loop. They are fully superseded by sub_agents.py which implements proper Claude tool loops. GIT_AUTHOR_NAME: Claude (AI Agent) GIT_AUTHOR_EMAIL: noreply@anthropic.com
GIT_AUTHOR_NAME: Claude (AI Agent) GIT_AUTHOR_EMAIL: noreply@anthropic.com
GIT_AUTHOR_NAME: Claude (AI Agent) GIT_AUTHOR_EMAIL: noreply@anthropic.com
Architecture is now: User → Manager (Planner/Router, LLM) → ToolExecutor (no LLM) → Tools/Services Changes: - NEW executor.py: pure Python execution layer, maps tool names to service functions, no LLM involved - NEW tool_schemas.py: tool definitions separated from execution logic - REWRITE manager_agent.py: planner only, delegates execution to ToolExecutor - SIMPLIFY claude_client.py: thin entry point - UPDATE system_prompts.py: Manager knows it plans, doesn't execute The LLM (Claude) only decides WHICH tools to call. The execution layer runs them without any AI involvement. GIT_AUTHOR_NAME: Claude (AI Agent) GIT_AUTHOR_EMAIL: noreply@anthropic.com
The sub-agent pattern (each domain agent running its own Claude tool loop) is replaced by the simpler architecture: Manager plans, ToolExecutor runs. No LLM in the execution path. GIT_AUTHOR_NAME: Claude (AI Agent) GIT_AUTHOR_EMAIL: noreply@anthropic.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Restructures the AI system into a clean 3-layer architecture that separates planning from execution:
Key principle: The AI only SELECTS tools. The backend EXECUTES.
New files
backend/app/ai/executor.pybackend/app/ai/tools/tool_schemas.pyRewritten files
backend/app/ai/agents/manager_agent.pybackend/app/ai/claude_client.pybackend/app/ai/prompts/system_prompts.pyDeleted files
sub_agents.pysales_agent.pyinventory_agent.pyaccounting_agent.pyHow it works now
search_customers("Ahmed"){id: 5, name: "Ahmed"}search_products("Royal Ceramica"){id: 12, price: 150}create_invoice(customer_id=5, items=[...])The LLM is only in the planning loop. Execution is deterministic Python code.
GIT_AUTHOR_NAME: Claude (AI Agent)
GIT_AUTHOR_EMAIL: noreply@anthropic.com
This PR was generated by Claude Code (AI Agent).