17 views
This guide focuses on multi-agent orchestration for production systems, with practical trade-offs for reliability, security, and cost.
Multi-agent demos look clever until three roles share one mutable system prompt and start rewriting each other’s plans. The unfair advantage is typed contracts between Planner, Implementer, and Critic — separate prompts, separate tools, separate write surfaces — so collaboration is orchestration, not soup.
⚡ TL;DR: Give each role a frozen system prompt, an input schema, and an output schema. Planner emits a plan artifact; Implementer may only write under a patch workspace; Critic may only emit ACCEPT|REJECT with evidence. Never let agents append to a shared chat blob.
multi-agent orchestration: production guidance
python
✅ The Implementer never sees the Critic’s chain-of-thought — only the structured verdict.
# agents/contracts.py
from pydantic import BaseModel, Field
from typing import Literal
class PlanStep(BaseModel):
id: str
intent: str
files: list[str] = Field(default_factory=list)
acceptance: str
class PlanArtifact(BaseModel):
goal: str
steps: list[PlanStep]
budget_tokens: int = 50_000
class CriticVerdict(BaseModel):
decision: Literal["ACCEPT", "REJECT"]
step_id: str
evidence: list[str]
required_fix: str | None = None
Isolate prompts and privileges
| Role | May read | May write | Tools |
|---|---|---|---|
| Planner | ticket + repo map | plan.json |
search, list_files |
| Implementer | plan.json + target files |
patch intents | apply_intent, test |
| Critic | plan + diff + test log | verdict.json |
read_only |
typescript
❌ One mega-prompt with “you are planner then implementer then critic” — that is how roles collapse mid-run.
// runtime/roleGate.ts
export function assertTool(role: "planner" | "implementer" | "critic", tool: string) {
const allow: Record<string, Set<string>> = {
planner: new Set(["search", "list_files", "write_plan"]),
implementer: new Set(["apply_intent", "run_tests", "read_file"]),
critic: new Set(["read_file", "read_diff", "write_verdict"]),
};
if (!allow[role].has(tool)) throw new Error(`tool_denied:${role}:${tool}`);
}
Handoff through artifacts, not chat
bash
Store artifacts with immutable keys (# ✅ Explicit artifact pipeline
python agents/planner.py --ticket T-441 --out /artifacts/plan.json
python agents/implementer.py --plan /artifacts/plan.json --out /artifacts/diff.json
python agents/critic.py --plan /artifacts/plan.json --diff /artifacts/diff.json --out /artifacts/verdict.json
run_id/step/plan.json). Auditors replay without reconstructing chat history.
Stop conditions before clever retries
python
MAX_CRITIC_ROUNDS = 3
def next_action(verdict: CriticVerdict, round_i: int) -> str:
if verdict.decision == "ACCEPT":
return "merge_gate"
if round_i >= MAX_CRITIC_ROUNDS:
return "human_queue" # ✅ escalate, don't ping-pong
return "replan_or_fix"
Closing checklist
- [ ] Separate system prompts per role
- [ ] Schema-validate every handoff artifact
- [ ] Least-privilege tool allowlists
- [ ] Cap critic rounds; escalate to humans
- [ ] Version plan artifacts immutably
Series navigation
Day 50: Project: Internal SDK Autocomplete Model · Day 52: Blackboard vs Message Bus Orchestration Last updated September 11, 2026 Related: Multi-Agent Systems: How to Build Agent Teams That Do Not Hallucinate Each Other Into Failure; Day 59: Multi-Agent Eval: Task Suites, Not Vibes; Multi-Agent Systems: Orchestrating Claude, GPT-4o, and Specialized Models Together.Watch: 100 Days of AI on YouTube
Short videos from CheatCoders, one AI engineering topic per day.
Most viewed
- Python Decorators Explained: From Simple Wrappers to Production Patterns
- Claude Code vs Cursor vs GitHub Copilot: Choose by Workflow, and Set Up One Repo That Works With All Three
- AI Agent Frameworks in 2025: LangGraph vs CrewAI vs AutoGen vs Raw API
- Python String Methods: Every str Method With Real Production Examples
- Css Animation Performance: Performance-Optimized Motion for Modern UIs
Newly added
- AWS Systems Manager Parameter Store: Hierarchical Runtime Config for Coding Agents
- Amazon Cognito Identity Pools: Federate Coding-Agent Tool Callers Without Long-Lived Keys
- Amazon Athena for Coding Agents: Query Tool Audit Logs and Eval Traces on S3 Without a Warehouse
- AWS Batch for Coding Agents: Parallel Overnight PR Reviews and Long-Running Jobs Without Lambda Timeouts
- Amazon Bedrock Prompt Management: Version and A/B Test Coding-Agent System Prompts
Deep-dive PDF
Get the expanded guide for this post — extra diagrams-style checklists, failure modes, and a production walkthrough. Free when you subscribe to CheatCoders.
Already subscribed? or open the subscribe page.
Discover more from CheatCoders
Subscribe to get the latest posts sent to your email.
