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

推荐订阅源

V
Visual Studio Blog
博客园 - 司徒正美
Hugging Face - Blog
Hugging Face - Blog
博客园 - 叶小钗
The Cloudflare Blog
D
DataBreaches.Net
J
Java Code Geeks
G
Google Developers Blog
L
LangChain Blog
N
Netflix TechBlog - Medium
Stack Overflow Blog
Stack Overflow Blog
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
WordPress大学
WordPress大学
小众软件
小众软件
量子位
Apple Machine Learning Research
Apple Machine Learning Research
P
Proofpoint News Feed
博客园_首页
罗磊的独立博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
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
Sub-Agents vs Tools: ADK Multi-Agent Decision Framework
Amit Malhotr · 2026-05-20 · via DEV Community

Stop Building Sub-Agents for Everything: A Decision Framework for ADK Multi-Agent Systems

Most multi-agent architecture diagrams look elegant. Clean boxes, directional arrows, specialised agents handling discrete domains. The problem? These diagrams optimise for whiteboard clarity, not production behaviour.

I've spent the last year helping SaaS teams across Canada and the US build agent systems on Google ADK. The pattern I see repeatedly: teams default to sub-agents because the architecture looks cleaner — then spend weeks debugging state passing failures, latency spikes, and cascading errors that wouldn't exist if they'd used the right abstraction from the start.

The sub-agent vs tool decision isn't cosmetic. It determines how state flows through your system, how errors propagate, how you scale, and how much latency you add per reasoning step. Get this wrong early, and you're refactoring agent architecture later — which is significantly more disruptive than refactoring code because the behaviour is harder to test.

The Hidden Cost of Over-Architected Agent Systems

When teams first adopt ADK, there's a natural pull toward the sub-agent pattern. It maps nicely to how we think about team structure — a billing agent, an infrastructure agent, a compliance agent. Clean separation of concerns. Independent reasoning domains.

But here's what the architecture diagrams don't show: every sub-agent call involves at least one additional LLM round trip. For a coordinator that orchestrates three sub-agents sequentially, you've added 3-4 LLM calls that wouldn't exist if those tasks were tools. At 500ms per call, that's 1.5-2 seconds of latency for the sub-agent coordination alone — before you even count the actual work.

I've seen teams build sub-agents for simple API lookups that should have been tools. A sub-agent to fetch project metadata. A sub-agent to check IAM bindings. Deterministic operations wrapped in reasoning overhead. The result: 2-3 LLM round trips for something that should be a function call returning structured data.

The opposite failure mode is equally common. A single agent with 30+ tools becomes unmanageable. The LLM context window fills with tool descriptions. Tool selection accuracy degrades. The agent starts calling the wrong tools or hallucinating tool capabilities that don't exist.

Neither extreme works. Production systems need a principled framework for when to use each pattern.

My Framework: Reasoning Boundaries Determine Architecture

The decision framework I use with teams is simple: sub-agents handle independent reasoning; tools handle deterministic operations.

If the task requires multi-step reasoning, maintains its own memory, or involves complex decision trees — that's a sub-agent. If the output is deterministic given the input, the task is self-contained, or you want to limit what the sub-task can access — that's a tool.

Here's how this plays out in ADK code. A coordinator with sub-agents looks like this:

coordinator = Agent(
    name="coordinator",
    model="gemini-2.0-flash",
    sub_agents=[billing_agent, infra_agent],
    tools=[get_project_metadata]
)

Enter fullscreen mode Exit fullscreen mode

Notice get_project_metadata is a tool, not a sub-agent. It returns structured data. No reasoning required.

The agent-as-tool pattern wraps an agent call in a tool interface:

analysis_tool = AgentTool(
    agent=code_analysis_agent,
    description="Analyzes Terraform code for security misconfigurations"
)
main_agent = Agent(tools=[analysis_tool, deploy_tool])

Enter fullscreen mode Exit fullscreen mode

This pattern works when you need contained reasoning that returns a structured result. The calling agent sees it as a black box. The code analysis agent does its multi-step work internally, but the main agent just gets back a report.

The critical distinction: sub-agents can access the coordinator's state and participate in broader workflows. Agent-as-tool returns a result and exits. Choose based on whether you need ongoing collaboration or isolated computation.

Patterns I've Seen Break in Production

No retry logic between sub-agents. One sub-agent failure cascades to full pipeline failure with no graceful degradation. I've watched an entire document processing pipeline fail because a metadata extraction sub-agent timed out — and there was no fallback. The fix: sub-agents should return structured error responses, not raise exceptions that propagate to the coordinator.

Large context objects passed between sub-agents. Teams try to share state by passing entire conversation histories or document contents through the coordinator. This bloats context windows and causes mysterious failures when you hit token limits mid-workflow. Use structured references instead — pass document IDs, not documents. Let each sub-agent fetch what it needs.

Agent-as-tool without observability. The pattern reduces visibility by design — the wrapped agent is a black box. I've debugged systems where no one could explain what the analysis agent was actually doing internally. Without explicit logging inside the wrapped agent, you lose traceability. Add structured logging before you need it.

Memory isolation surprises. Sub-agent memory is isolated by default in ADK. Teams assume context flows automatically, then wonder why their infrastructure agent doesn't remember what the billing agent just discovered. If you need shared context across sub-agents, you have to explicitly pass it through the coordinator.

The Trade-off Matrix

Factor Sub-Agent Agent as Tool Plain Tool
Latency Higher (1+ LLM calls) Higher (1+ LLM calls) Lowest
Independent testing Easy Easy Easiest
State access Coordinator state available Isolated N/A
Observability Good Requires explicit logging Full visibility
Use case Complex reasoning Contained reasoning Deterministic ops

Sub-agents are easier to test independently because each has a clear input/output contract. But they add latency and complexity. For time-sensitive workflows where you're measuring response time in seconds, every unnecessary LLM call hurts.

Agent-as-tool gives you contained reasoning with a clean interface, but you trade observability. Plain tools are fastest but can't reason.

Why This Matters for Platform Teams

This connects directly to the Automation pillar of the SCALE framework. Agent systems are infrastructure now. The architectural decisions you make about sub-agents vs tools compound as the system grows — affecting operational cost, debugging time, and end-user latency.

I've seen teams burn weeks refactoring agent architecture because they defaulted to sub-agents for everything. Agent behaviour is harder to test than code behaviour. When you change how reasoning flows through your system, you're not just changing code — you're changing emergent behaviour that's difficult to verify with traditional testing.

Start with tools for deterministic operations and single-purpose tasks. Add sub-agents when you need independent reasoning that can't be expressed as a function call. Use agent-as-tool when you need contained reasoning that returns a structured result to an orchestrator.

The decision framework isn't complicated. But I rarely see teams apply it systematically before building. Most start with whatever pattern they saw in a tutorial, then refactor when production behaviour surprises them.

The architecture diagram isn't the system. The latency, state flow, and error propagation are the system. Optimise for those.


Amit Malhotra is Principal GCP Architect at Buoyant Cloud Inc, helping B2B SaaS companies design production-ready platforms on GCP.

Work with a GCP specialist — book a free discovery call


Work with a GCP specialist — book a free discovery callhttps://buoyantcloudtech.com