Your Subagent Should Return Evidence, Not Its Entire Conversation.
Subagent isolation breaks down when a supervisor receives either a vague summary or every tool result. Use scoped task packets, typed returns, inspectable evidence, and artifact handles to keep the handoff small and trustworthy.
On this page
An investigation subagent reads twelve files, runs six searches, and spends ten minutes tracing a bug.
Then it returns this:
Found the problem. The auth flow has a race condition.The supervisor has a clean context window, which is nice. It also has no evidence, no affected file, and no way to decide whether the finding is safe to act on.
At the other extreme, returning every file read and every tool result defeats the point of the subagent. You have moved the context flood to a different window and then poured it straight back into the parent.
Subagent context isolation only helps if the handoff is designed too.
I treat delegation as a small interface with two explicit contracts: what the worker receives, and what it must return.
Send a task packet, not the parent's transcript
A focused subagent does not need the whole conversation. It needs enough information to do *one job* without guessing what the parent meant.
For example, instead of "investigate auth," I would send:
- the exact question and what counts as done;
- repository and branch or snapshot being inspected;
- approved files or evidence handles;
- boundaries, such as read-only access and no secret inspection;
- the shape of the expected result.
That packet is more useful than a twenty-page conversation history. It also makes the investigation reproducible.
import { z } from "zod";const Delegation = z.object({ taskId: z.string().min(1), objective: z.string().min(1), sourceRefs: z.array(z.string()), constraints: z.array(z.string()), maxFindings: z.number().int().min(1).max(10),}).strict();const task = Delegation.parse({ taskId: "auth-42", objective: "Find why refresh can invalidate an active session", sourceRefs: ["repo:auth@c8f21a", "trace:login-017"], constraints: ["read-only", "do not inspect credentials"], maxFindings: 3,});The worker can explore freely *within that scope*. Its messy searches and dead ends stay in its own context.
This is the main benefit described in both Claude Code's subagent guidance and LangChain's supervisor/subagent pattern: an isolated worker can perform a substantial side investigation and return the relevant outcome, rather than forcing the parent to absorb the entire trajectory.
A return contract beats "give me a summary"
A summary is prose. A handoff is something the supervisor must be able to consume safely.
For an investigation, I want four things: status, findings, evidence references, and unresolved questions. If the worker created a large report or trace, it returns an artifact handle rather than the whole payload.
The flow is deliberately small:
Here is the output schema I would use:
const ReturnPacket = z.object({ taskId: z.string(), status: z.enum(["complete", "partial", "blocked"]), findings: z.array(z.object({ claim: z.string().min(1), evidenceRefs: z.array(z.string()).min(1), })), openQuestions: z.array(z.string()), artifactRefs: z.array(z.string()),}).strict();type ReturnPacket = z.infer<typeof ReturnPacket>;A worker that cannot find the answer should return partial or blocked, not fill the missing fields with plausible guesses.
The important design choice is that an evidence reference points to something the parent can actually inspect. "I checked the code" is not a reference. repo:auth@c8f21a:src/session/refresh.ts#L80-L103 is the kind of locator I want.
Validate what crosses back
The child is a source of *proposed findings*, not a trusted writer of parent state.
The supervisor's wrapper should validate the schema, confirm the returned task ID, and resolve evidence/artifact references against the store and access policy. Only then should it turn the packet into context for the next step.
function acceptReturn( raw: unknown, taskId: string, allowedRefs: Set<string>,) { const packet = ReturnPacket.parse(raw); if (packet.taskId !== taskId) { throw new Error("Return belongs to another task"); } for (const finding of packet.findings) { for (const ref of finding.evidenceRefs) { if (!allowedRefs.has(ref)) { throw new Error("Unrecognized evidence reference"); } } } return packet;}This is illustrative validation, not proof that a claim is true. A real executor should independently resolve the references, check permissions, and verify important conclusions before taking action. An allowed reference can still be irrelevant or misinterpreted.
Also, an isolated context window is not a filesystem or security sandbox. If a worker has production credentials and write tools, a fresh prompt does not make those powers harmless. Give it the smallest tool permissions its task needs.
Keep large artifacts outside both prompts
Sometimes the investigation genuinely produces something large: a test log, a coverage report, or a code diff.
Do not force it through the return packet.
Store it durably and return an ID:
status: partialfinding: refresh token is read before the session row is lockedevidence: repo:auth@c8f21a:src/session/refresh.ts#L80-L103artifact: report:auth-42next question: does the race reproduce under concurrent refresh?The parent gets enough context to decide the next move and can fetch the full report only if necessary.
This connects naturally to offloading tool outputs instead of putting everything back in the prompt. It is the same boundary, applied to another agent's work.
Know when not to spawn a worker
Delegation has overhead: another prompt, another model run, another set of tool calls, and a handoff that can fail.
For a two-minute lookup, the parent should usually just do it. For two agents editing the same file, independent contexts can create conflicts rather than solve them. And if the worker needs the parent's entire history to perform every next step, the task may not be a good isolation candidate.
The pattern earns its place when the work is substantial, narrow enough to specify, and likely to produce a lot of intermediate material the parent does not need.
Your previous blackboard architecture article deals with several specialists contributing to evolving shared state. A subagent return contract is different: it is a deliberately small handoff back to a supervisor. Use the simpler boundary when that is all the workflow needs.
The takeaway
A subagent should not receive every thought the parent has had, and it should not return every thought it has produced.
Give it a bounded task with the sources and permissions it needs. Let it investigate in a separate context. Require a typed result with evidence, status, and artifact handles. Validate the packet before it changes the main workflow.
Keep the exploration isolated. Make the conclusion inspectable.
That is how subagents save context without making the supervisor blind.
References
KEEP READING
Related engineering notes
A Failover Route Is Not a Recovery Path: Proving Independence in AI Infrastructure
Two LLM providers can share the same failure domain. Build an evidence-backed recovery graph that checks cloud, networking, identity, control-plane and capacity dependencies before admitting fallback routes, then test correlated outages without weakening safety.
Read articleAn Eval Platform Sunset Can Erase Your Release Evidence: Build an Evidence-Escrow Migration Gate
When a hosted LLM evaluation platform retires, switching runners is not enough. Preserve the historical evidence, reconstruct grader semantics, validate scoring parity, and enforce a fail-closed release gate that survives the service shutdown.
Read articleWhen the Package Runs Before Your App: Quarantining AI Framework Releases
The 2026 agent-framework PyPI compromise exposed a blind spot in AI build pipelines: Python startup hooks execute before application imports. Design an artifact-quarantine gate, inspect wheels without installing them, separate credentials, and recover from suspected exposure.
Read article