Question 1. An agent built with the Claude Agent SDK must check 200 source files for a deprecated API and then write a short migration plan. After a few dozen Read calls, the main conversation is crowded with file contents and the plan misses findings from early in the run. Which change addresses the cause most directly?
- Option A: Delegate the audit to a read-only subagent that reports back a summary
- Option B: Raise max_turns so the agent has more round trips available to finish the audit
- Option C: Ask the agent to restate all findings so far after every Read call
- Option D: Run the session in plan permission mode so Claude explores without editing files
Show answer and explanation
Correct answer: A. Delegate the audit to a read-only subagent that reports back a summary
Context isolation is one of the main reasons to use subagents: the parent receives a concise summary instead of every file the subagent read. Restricting the subagent to Read, Grep and Glob also keeps the audit strictly read-only.
- A (correct)Correct. A subagent runs in its own conversation; its intermediate tool calls and results stay inside it and only the final message returns to the parent.
- B (incorrect)max_turns limits how many tool-use turns run. It does nothing about file contents accumulating in the main context.
- C (incorrect)Repeating findings adds even more tokens to the same context window instead of keeping the raw file contents out of it.
- D (incorrect)Plan mode controls whether Claude edits files. It does not change how much tool output accumulates in the conversation.
Reference: Claude Code Docs: Subagents in the SDK (opens in a new tab)

