QuestionQ70

Agentic Architecture & Orchestration

You are building developer productivity tools using the Claude Agent SDK. The agent helps engineers explore unfamiliar codebases, understand legacy systems, generate boilerplate code, and automate repetitive tasks. It uses built-in tools (Read, Write, Bash, Grep, Glob) and integrates with Model Context Protocol (MCP) servers.

A developer asks the agent to investigate why a specific API endpoint intermittently returns 500 errors. The codebase contains 200+ files, and the developer does not know which components are involved. The agent must trace the error through the routing, middleware, business logic, and database layers.

Which task decomposition approach would be most effective?

Explanation

When the scope of an investigation cannot be known in advance — as with tracing an intermittent error through an unfamiliar, multi-layered codebase — the most effective approach is adaptive task decomposition: the agent generates and refines its investigation subtasks based on what each exploration step reveals (e.g., a grep hit, an error log, a suspicious code path), rather than committing to a rigid plan or step sequence before any exploration has occurred. This mirrors Anthropic's guidance for agentic systems: avoid over-specifying tasks up front, let the agent iterate and self-correct, and use interleaved reasoning after each tool result to evaluate findings, identify gaps, and decide the next action. A fully pre-planned map of all code paths cannot be accurately produced before exploring the code, a rigid fixed sequence ignores evidence gathered along the way (wasting effort on irrelevant layers), and parallel investigation of all four layers is inefficient because the layers are causally chained (an error in one layer typically produces the symptom observed in another), making a single adaptive trace more effective than independently synthesized parallel findings.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!