Subagent
Also: 子代理 · 子智能體 · sub-agent · worker agent
The main agent hands a subtask to a separately running agent with its own clean context; when it finishes, only the result comes back.
When you will meet it
You need it when a task outgrows one context window, or when data from different stages contaminates each other. Without understanding isolation you will build one-session-does-everything systems, then hit the incident this site documented: stock B's report containing stock A's holdings — not hallucination, context contamination.
An analogy
Like an accounting firm auditing two companies at once: not one person doing both, but two teams, each carrying only its own company's papers and handing back a report. Share one desk piled with both firms' documents and figures will eventually land in the wrong column.
Minimal example
主代理:「調研股票 A 和股票 B,各出一份報告」
├─ spawn 子代理 1(全新上下文):只拿股票 A 的資料 → 交回報告 A
├─ spawn 子代理 2(全新上下文):只拿股票 B 的資料 → 交回報告 B
└─ 主代理彙整兩份報告
關鍵:子代理 2 的上下文裡從未出現過股票 A 的數字,
所以「A 的物業基金」沒有機會混進 B 的報告。The price is right here too: every subagent needs the background re-explained (token cost); the parent gets summaries, not the process (logs must fill the gap); subagents cannot talk to each other, so all coordination lands on the parent.
What people get wrong
- Thinking a subagent is just another chat window. The point is not the extra window but the isolation: a fresh context holds no residue from earlier tasks — that is the entire contamination defence.
- Delegating everything. Every hand-off pays a re-briefing token cost and risks losing detail in the summary; simple tasks are cheaper done directly.
Related terms
Next
- Subagent Isolation Architecture: Reliability Lessons for AI Financial Applications, From the our HK research pipeline Data Contamination Incident to the Clean Context Design Pattern, A Complete Journey24 min
- A Complete Tutorial for Open Multi-Agent (OMA): A TypeScript Multi-Agent Orchestration Framework from Goal to Task DAG43 min