惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

雷峰网
雷峰网
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
Tailwind CSS Blog
F
Fortinet All Blogs
Microsoft Azure Blog
Microsoft Azure Blog
Jina AI
Jina AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
N
Netflix TechBlog - Medium
B
Blog RSS Feed
Blog — PlanetScale
Blog — PlanetScale
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
The Blog of Author Tim Ferriss
D
Docker
博客园 - 聂微东
博客园 - 【当耐特】
博客园 - 三生石上(FineUI控件)
L
LangChain Blog
量子位
宝玉的分享
宝玉的分享
博客园 - 司徒正美
The Cloudflare Blog
G
Google Developers Blog
Microsoft Security Blog
Microsoft Security Blog
腾讯CDC

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Building Multi-Agent Systems: When Your AI Should Spawn M...
Marc Newstead · 2026-06-22 · via DEV Community

Building Multi-Agent Systems: When Your AI Should Spawn More AIs

You've built a chatbot. It works. Now product wants it to handle legal queries, technical troubleshooting, and customer support—all in one conversation. Your first instinct? Build three specialised agents and hardcode the routing logic. But there's another pattern gaining traction: supervisor agents that dynamically spawn sub-agents on demand.

Let's talk about when each approach makes sense, because the choice will fundamentally shape your system's cost, reliability, and maintainability.

The Hardcoded Hierarchy: Routing Rules You Control

In a static architecture, your orchestration logic is explicit code:

def route_request(query):
    if contains_legal_keywords(query):
        return legal_agent.process(query)
    elif is_technical_issue(query):
        return tech_support_agent.process(query)
    else:
        return general_agent.process(query)

This is predictable. You know exactly which agent handles what, your token costs are bounded, and debugging is straightforward. When something goes wrong, you're reading deterministic code, not trying to decipher why an LLM decided to spawn a "blockchain expert" for a password reset.

The trade-off? Brittleness. Every new capability means updating your routing logic. Edge cases pile up. That legal query about API rate limits? Neither your legal agent nor your technical agent was designed for it, and your routing function won't know what to do.

Dynamic Orchestration: Let the LLM Decide

Dynamic supervisors flip the script. Instead of hardcoded rules, the supervisor reasons about which sub-agents to spawn:

# Supervisor system prompt (simplified)
supervisor_prompt = """
You have access to these specialist agents:
- LegalAgent: contract review, compliance, GDPR
- TechAgent: API debugging, infrastructure
- CustomerAgent: billing, account management

Analyse the user's request and spawn appropriate sub-agents.
You may spawn multiple agents if needed.
"""

The supervisor becomes a meta-agent that interprets intent and assembles a response pipeline at runtime. For that legal-technical hybrid query? It might spawn both agents, coordinate their outputs, and synthesise a final answer.

This is powerful. New capabilities can be added by updating the agent registry and supervisor prompt—no code changes. The system adapts to novel combinations of requirements you didn't anticipate at design time.

But it's expensive. Every request now includes:

  1. Supervisor reasoning step (100–500 tokens)
  2. Sub-agent spawning decision (variable)
  3. Coordination overhead if multiple agents run
  4. Final synthesis step

You've potentially tripled your token spend, and latency scales with the supervisor's decision complexity.

When to Choose Which

Here's the decision framework I use:

Choose static hierarchies when:

  • Your domain is well-defined and stable
  • Cost predictability matters more than flexibility
  • You need deterministic behaviour for compliance/audit
  • Your team is comfortable maintaining explicit orchestration code

Choose dynamic supervisors when:

  • Requirements evolve frequently
  • You're handling truly unpredictable user input
  • Development velocity matters more than marginal cost
  • You have robust observability to debug LLM routing decisions

The Observability Problem

Dynamic systems create a new debugging challenge: you're troubleshooting decisions made by a model, not by your code. When a supervisor routes incorrectly, you need:

  • Full prompt/response logging for every supervisor decision
  • Structured traces showing which sub-agents were spawned and why
  • Token usage broken down by orchestration vs. task execution

Without this, you're flying blind. Budget for engineering time to build proper instrumentation—it's not optional.

For teams working on AI automation and software development, investing early in observability patterns for multi-agent systems pays dividends once you're handling production traffic.

A Hybrid Approach

In practice, you don't have to pick one or the other. Consider a tiered model:

  1. Static top-level routing for broad categories (legal, technical, sales)
  2. Dynamic sub-agent spawning within each category for nuanced specialisation

This gives you cost control at the entry point while preserving flexibility where it matters. Your supervisor still makes intelligent decisions, but within a bounded domain that limits runaway token usage.

The Real Question

When building multi-agent systems, the architecture choice boils down to this: are you optimising for developer control or system adaptability?

Static hierarchies give you determinism and debuggability. Dynamic supervisors give you flexibility and emergent capabilities. Neither is inherently better—it depends on your constraints.

If you're still evaluating which pattern fits your use case, the detailed comparison on how one agent learns to delegate walks through cost modelling and reliability trade-offs worth considering before you commit.

One final tip: whichever you choose, start simple. A two-level hierarchy (supervisor + three sub-agents) is easier to reason about than a recursive tree of agents spawning agents. Get the observability and cost monitoring right at two levels before you go deeper.

Your future self—and your AWS bill—will thank you.