하위 에이전트는 이력을 상속하지 않습니다
각 하위 에이전트 프롬프트에 필요한 컨텍스트를 모두 명시적으로 전달합니다
하위 에이전트는 이력을 상속하지 않습니다은(는) CoddyKit의 무료 Claude Architect 강의입니다. 이것은 4개 중 3번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Claude Architect 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Claude Architect 강의에는 총 4개의 강의가 포함되어 있습니다.
이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.
The Memory Trap
You build a hub-and-spoke multi-agent system. The coordinator has had a long conversation with the user: requirements, constraints, prior decisions. Then it delegates a task to a subagent and assumes the subagent already "knows" all of that.
It does not. This is the single most common multi-agent bug, and it appears directly on the Claude Certified Architect exam.
The rule: subagents do NOT inherit the coordinator's conversation history. Every piece of context a subagent needs must be passed explicitly in its prompt.
Why History Doesn't Transfer
The Claude API is stateless. The model keeps NO server-side memory between requests. On every turn you resend the FULL messages history yourself.
A subagent runs as its own independent loop, with its own messages array. The coordinator's history lives in the coordinator's request, not in some shared global memory. Nothing copies it across.
So when a subagent starts, its context is exactly what you put in its system prompt and first messages entry — and nothing more.
# Each agent owns its own messages array.
# Nothing is shared automatically between them.
resp = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=2048,
system=subagent_system_prompt, # subagent's OWN instructions
messages=subagent_messages, # subagent's OWN history (starts empty)
)Hub-and-Spoke, Restated
In the hub-and-spoke pattern the coordinator decomposes the work, delegates to subagents, then aggregates and routes the results. It owns orchestration and error handling.
But delegation is a one-way handoff of explicit instructions, not a shared brain. Think of each subagent as a brand-new contractor who has never seen your earlier emails. You must brief them fully in the work order itself.
- Coordinator: decompose, delegate, aggregate, route, handle errors.
- Subagent: receives a self-contained brief, does one focused job, returns a result.
The Failure Mode
Here is what the bug looks like in practice. The user told the coordinator the target is the checkout service and the deadline is strict. The coordinator then spawns a reviewer subagent with a vague brief.
The subagent has no idea which service, which constraints, or what "the file" refers to. It hallucinates a target, reviews the wrong thing, or asks a question the coordinator can't relay back cleanly.
# ANTI-PATTERN: assumes the subagent 'remembers' the chat
Task(
description="Review the file",
prompt="Review the file we discussed and flag any bugs.",
subagent_type="code-reviewer",
)
# 'the file we discussed' means NOTHING to a fresh subagent.The Fix: Self-Contained Briefs
Rewrite the brief so it stands entirely on its own. Pass the target, the constraints, the prior decisions, and the exact output you expect.
A good subagent prompt answers: What is the task? On what exact input? Under what constraints? In what output format? No reference to "earlier" or "as we said" survives the handoff.
Task(
description="Review checkout/payment.py",
prompt=(
"Review the file checkout/payment.py for correctness bugs.\n"
"Context: this handles card charges; idempotency is required.\n"
"Prior decision: refunds over $500 must route to a human.\n"
"Flag a comment ONLY when it contradicts the code.\n"
"Return findings as a JSON list of {line, severity, issue}."
),
subagent_type="code-reviewer",
)Pass Facts Verbatim, Not Vibes
Don't summarize transactional facts into mush before handing them off. Progressive summarization makes numbers, percentages, and dates vague — and a subagent acting on "roughly last quarter" instead of "2026-Q1" will be wrong.
Keep the hard facts a subagent needs in a verbatim "context" block: IDs, thresholds, file paths, exact dates. Summarize prose for flavor; never summarize the load-bearing details.
context_block = (
"CASE FACTS (verbatim):\n"
"- customer_id: CUS-88231 (identity verified)\n"
"- order_id: ORD-55012\n"
"- refund_amount: $512.00 (exceeds $500 policy threshold)\n"
"- requested_date: 2026-06-10\n"
)
subagent_prompt = context_block + "\nTask: draft the refund-approval request."Least Privilege Travels With the Brief
An AgentDefinition carries: name, description, system_prompt, and allowed_tools. Because the subagent is isolated, its tools and its system prompt ARE its whole world — scope them to the role.
Give a subagent the 4-5 tools it actually needs (4-5 per agent is optimal; 18+ degrades tool selection). And remember: for the coordinator to spawn subagents at all, the coordinator's allowedTools must include "Task".
reviewer = AgentDefinition(
name="code-reviewer",
description="Reviews one file for correctness bugs; returns JSON findings.",
system_prompt=(
"You review a single file. All needed context is in the user "
"message. Never assume prior conversation exists."
),
allowed_tools=["Read", "Grep"], # least privilege
)Parallel Subagents Are Fully Independent
Issuing multiple Task calls in a single response runs them in parallel. That is powerful — but it doubles down on the isolation rule.
Parallel subagents cannot see each other's history OR the coordinator's. Each must be briefed independently and completely. There is no implicit ordering and no shared scratchpad between them; if subagent B needs subagent A's output, the coordinator must collect A's result and feed it into B's prompt explicitly.
# Two Task calls in ONE response -> run in parallel, fully isolated.
# Each gets its OWN complete brief; neither sees the other's.
Task(prompt=brief_for_auth_module, subagent_type="code-reviewer")
Task(prompt=brief_for_billing_module, subagent_type="code-reviewer")Returning Results: Structured, Not Chatty
Isolation also shapes the return trip. The coordinator only gets back what the subagent emits — so make that emission machine-usable.
For aggregation, force structured output: a subagent with tool_choice="any" MUST call a tool, which guarantees the coordinator receives parseable JSON instead of free prose it has to scrape. And when a subagent fails, it should return structured context (failure type, attempted query, partial results) — not a generic "operation failed" that blocks recovery.
resp = client.messages.create(
model="claude-sonnet-4-5",
max_tokens=1024,
system=subagent_system_prompt,
messages=subagent_messages,
tools=[report_findings_tool],
tool_choice={"type": "any"}, # guarantees a structured result back to the hub
)Sessions Are Not a Loophole
You might hope a resumed session smuggles history into a subagent. Be careful. --resume <name> continues a named session and fork_session branches from a shared point — but these resume a session's own state, they do not retroactively inject the coordinator's chat into a fresh subagent.
And resumed tool results can be stale if the codebase changed underneath them. Sometimes a fresh session seeded with a structured summary beats resuming — which is exactly the explicit-context discipline again.
A Practical Briefing Checklist
Before you spawn any subagent, confirm its prompt is self-contained. Walk this checklist:
- Target: the exact file / record / id it operates on.
- Constraints: policies, thresholds, prior decisions — verbatim.
- Task: one focused job, stated with explicit criteria.
- Output: the exact shape to return (JSON schema / fields).
- Tools: only the 4-5 it needs, least privilege.
If you removed the coordinator entirely and handed this prompt to a stranger, could they do the job? If yes, you've briefed it correctly.
Quick Check: The Forgetful Subagent
A coordinator has spent 20 turns clarifying that the user wants a security review of auth/session.py, with the rule "only flag findings that are exploitable in production." It now delegates to a reviewer subagent. What is the correct way to delegate?
Recap: Brief Every Subagent Fully
Key takeaways:
- The API is stateless and subagents are isolated — they inherit none of the coordinator's history.
- Every subagent prompt must be self-contained: target, constraints, task, output format, tools.
- Pass transactional facts (ids, thresholds, dates, paths) verbatim; don't let summarization blur them.
- Parallel
Taskcalls are independent — brief each one separately; the coordinator feeds one subagent's output into another explicitly. - Scope
allowed_toolsto the role (4-5 optimal); the coordinator needs"Task"to delegate. - Use
tool_choice="any"for structured returns and structured errors for recoverable aggregation.
Brief the stranger, not the friend. That mindset passes both the exam and production.
자주 묻는 질문
“하위 에이전트는 이력을 상속하지 않습니다” 강의는 무료인가요?
네 — “하위 에이전트는 이력을 상속하지 않습니다” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Claude Architect 강의 전체를 잠금 해제할 수 있습니다. Claude Architect 강의에는 총 4개의 강의가 포함되어 있습니다.
“하위 에이전트는 이력을 상속하지 않습니다”에서 뭘 배우나요?
각 하위 에이전트 프롬프트에 필요한 컨텍스트를 모두 명시적으로 전달합니다 브라우저에서 직접 실행하는 실습 코드로 Claude Architect을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
Claude Architect을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 Claude Architect은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 3번째 강의입니다.
“하위 에이전트는 이력을 상속하지 않습니다” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 Claude Architect 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 Claude Architect 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- 허브 앤 스포크 코디네이터 토폴로지
- 코디네이터의 책임
- 하위 에이전트는 이력을 상속하지 않습니다
- 하위 에이전트 병렬 생성