{"componentChunkName":"component---src-templates-post-js","path":"/pensieve/multi-agent-orchestration","result":{"data":{"markdownRemark":{"html":"<h2>One model is not a product</h2>\n<p>A single chat completion can draft text. Production workflows need <strong>routing</strong>, <strong>tools</strong>, <strong>memory</strong>, and <strong>clear ownership of failure</strong>. Multi-agent systems earn their complexity when the work naturally splits: search vs finance vs market research; plan vs code vs execute.</p>\n<p>This post captures patterns from shipping:</p>\n<ul>\n<li>a <strong>real-estate deep-agents</strong> stack (LangGraph + specialized agents + RAG)</li>\n<li>an <strong>agentic data analyst</strong> that turns natural language into sandboxed Python</li>\n</ul>\n<h2>Prefer a graph of steps over a pile of prompts</h2>\n<p><strong>LangGraph</strong>-style orchestration gives you:</p>\n<ul>\n<li>explicit nodes (agents / tools / validators)</li>\n<li>edges with conditions (route, retry, escalate, stop)</li>\n<li><strong>checkpointed state</strong> so long jobs can resume and audits can replay</li>\n</ul>\n<p>That beats an unbounded “agent loop” that mutates a blob of chat history until tokens run out.</p>\n<p>A durable shape:</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">User → Supervisor / orchestrator\n          ├─ Specialist A (tools)\n          ├─ Specialist B (tools)\n          └─ Synthesizer → final artifact</code></pre></div>\n<p>Keep the supervisor thin: classify intent, pick agents, merge results, enforce budgets (steps, tokens, wall clock).</p>\n<h2>Specialist agents beat mega-prompts</h2>\n<p>In the real-estate platform, separate agents for <strong>search</strong>, <strong>finance</strong>, and <strong>market</strong> work better than one prompt that tries to do everything:</p>\n<ul>\n<li>clearer tool permissions</li>\n<li>smaller context per call</li>\n<li>independent evaluation</li>\n<li>easier rollback when one skill regresses</li>\n</ul>\n<p>The <strong>Agentic Data Analyst</strong> follows the same idea along a pipeline: understand query → generate code → <strong>sandbox execute</strong> → present in Streamlit. Code execution is a different trust boundary than “write an answer”; isolate it.</p>\n<h2>Tool use is where systems actually fail</h2>\n<p>Common failure modes (and mitigations):</p>\n<table>\n<thead>\n<tr>\n<th>Failure</th>\n<th>Symptom</th>\n<th>Mitigation</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Tool hallucination</td>\n<td>Invented APIs / paths</td>\n<td>Strict tool schemas; reject unknown names</td>\n</tr>\n<tr>\n<td>Infinite loops</td>\n<td>Same node retries forever</td>\n<td>Max steps; circuit breakers; escalate to human</td>\n</tr>\n<tr>\n<td>Context bloat</td>\n<td>Latency and cost explode</td>\n<td>Summarize intermediate state; pass IDs not dumps</td>\n</tr>\n<tr>\n<td>Unsafe code</td>\n<td>Arbitrary exec in analyst flows</td>\n<td>Docker/host sandbox (e.g. patterns like <strong>codibox</strong>); no network by default</td>\n</tr>\n<tr>\n<td>Silent wrong answers</td>\n<td>Confident nonsense</td>\n<td>Critic / grader node; require citations or tests</td>\n</tr>\n</tbody>\n</table>\n<p>Design the graph so <strong>failure is a first-class edge</strong>, not an exception you only see in logs.</p>\n<h2>State, checkpoints, and auditability</h2>\n<p>Financial and analytical users ask “how did you get this?” Checkpointed graphs let you:</p>\n<ul>\n<li>resume after timeouts</li>\n<li>inspect which agent produced which claim</li>\n<li>A/B route models (OpenAI, Anthropic, Gemini, Bedrock, …) behind the same graph contract</li>\n</ul>\n<p>Multi-LLM routing belongs in the orchestrator, not scattered inside each agent.</p>\n<h2>When not to use multi-agent</h2>\n<p>Skip the swarm if:</p>\n<ul>\n<li>one retrieval + one generation pass solves 90% of queries</li>\n<li>you cannot define clear agent responsibilities</li>\n<li>you lack evals for the end-to-end path</li>\n</ul>\n<p>Start with a <strong>single agent + tools</strong>. Promote to multi-agent when handoffs and specialization show up in the eval set, not in a slide deck.</p>\n<h2>Practical checklist before production</h2>\n<ol>\n<li>Hard caps on steps, tokens, and wall time</li>\n<li>Typed state and validated tool I/O</li>\n<li>Sandboxed execution for any generated code</li>\n<li>Observability per node (latency, error rate, retry count)</li>\n<li>Human-readable traces for support and compliance</li>\n<li>A graceful degrade path (partial answer + uncertainty)</li>\n</ol>\n<p>Multi-agent orchestration is software architecture with LLMs in the loop — treat it like distributed systems, not magic.</p>","frontmatter":{"title":"Multi-Agent Orchestration with LangGraph — Patterns That Survive Production","description":"Supervisor routing, specialized agents, tool use, and failure modes from shipping real-estate and data-analyst multi-agent systems on LangGraph and DeepAgents.","date":"2026-03-15","slug":"/pensieve/multi-agent-orchestration","tags":["Multi-Agent","LangGraph","DeepAgents","LLM","Production"]}}},"pageContext":{}},"staticQueryHashes":["1064330971","1994492073","2009693873","3298314076"]}