Claude 3.5 Sonnet Hierarchical Multi-Agent Orchestrator
Design production multi-agent systems with deterministic supervisor routing, isolated subagent toolboxes, and shared state memory graphs.
Parametric Customizer & Compiler Live Tool
Adjust the variables below. The prompt code and API payload update dynamically in real time.
Core swarm mission
List of subagents and their tools
State fields tracked in graph
You are a Principal AI Agent Architect specializing in LangGraph, Anthropic Tool Use, and Autonomous Multi-Agent Swarms.
Architect a production hierarchical multi-agent system for {Automated Pull Request Code Review, Static Security Audit, and GitHub PR Comment Generation} using {LangGraph (TypeScript / JavaScript)}.
### MANDATORY MULTI-AGENT INVARIANTS:
1. **Supervisor Router Pattern**: A dedicated Supervisor LLM analyzes incoming tasks and routes execution to specialized subagents via structured function calling (`next_agent: 'researcher' | 'coder' | 'auditor' | '__end__'`).
2. **Tool Scoping & Least Privilege**: Subagents must only possess tools strictly required for their specific domain. Never give all tools to all agents.
3. **Shared State Graph (TypedDict / Zod)**: State updates must be explicit and immutable. Use reducer functions to append messages and update shared artifacts.
4. **Human-in-the-Loop (HITL) Gate**: Insert a mandatory pause/approval checkpoint before any destructive actions (e.g., executing transactions, deleting data, pushing to production).
5. **Infinite Loop Prevention**: Enforce a hard recursion limit (max 15 hops) with graceful degradation to supervisor explanation.
Subagent Roles: {1) DiffParserAgent (tools: fetch_pr_diff, list_files), 2) SecurityAuditorAgent (tools: scan_semgrep_ast, check_cve), 3) CommentFormatterAgent (tools: post_github_review)}
Shared State Schema: {pr_id, repo, diff_chunks, security_vulnerabilities, audit_score, approved_by_human}
Generate complete project code:
1. Shared State Definition
2. Supervisor Node & Worker Subagent definitions with tool bindings
3. Graph Compilation with conditional edges and HITL interrupt points Architect autonomous multi-agent systems and LangGraph supervisors with Claude 3.5.
Leonardo Phoenix & Flux: Generate photorealistic studio assets with 150 daily free credits. Zero setup required.
πΈ Real Sample Outputs & Verified Results
Visual evidence and benchmark responses generated using this exact prompt formula.
π¬ Prompt Engineering Anatomy
Why this prompt consistently delivers high-tier results: technical parameter breakdown.
Supervisor Router Routing Guarantees that a top-level orchestrator evaluates task completion before deciding whether to delegate or terminate.
HITL Interrupt Nodes Pauses the execution graph and persists state to SQLite / Postgres until a human operator confirms high-risk actions.
π¬ Frequently Asked Questions
Troubleshooting common edge cases, model incompatibilities, and best practices.
Why use LangGraph instead of simple sequential chains?
LangGraph supports cycles, branching, and state persistence, allowing agents to loop back for revisions when security checks fail.
How do subagents share context without bloating token limits?
Subagents read only the specific state keys they require and return concise output summaries rather than dumping entire chat histories.
Cursor AI & Claude 3.5 Sonnet Pro Bundle
Supercharge your workflow with instant codebase indexing, multi-file edits, and automated system rules.
Explore Related Coding & Architecture Prompts View all β
Claude 3.5 Sonnet Senior Staff Full-Stack Refactoring Architect
Specialized prompt framework for Claude 3.5 Sonnet and Claude 3.7. Transforms messy legacy codebases into modular, testable, high-performance systems with automated regression tests.
cursorCursor AI (.cursorrules) for Next.js 15, React 19 & Tailwind CSS
Stops Cursor from writing outdated Next.js 13 patterns, Pages Router syntax, or deprecated React hooks. Enforces strict TypeScript, Server Actions, and modular clean architecture.
deepseekDeepSeek-R1 Autonomous Deep Research & Synthesis Engine
DeepSeek-R1 chain-of-thought framework designed to force deep reflection, counterfactual auditing, and hypothesis testing before producing production-ready research reports.