1:1 mentoring with Big Tech AI engineers
LLM & Agentic

Who Owns the Loop

Manual loop vs the SDK Tool Runner vs Managed Agents vs the Claude Agent SDK — separated by who supplies the agent harness and who supplies the deployment.

Last updated

Production6 min readFirst readTool Use with ClaudeThe Agent Loop

After this section you can

  • Separate who supplies the agent harness from who supplies the deployment, and place all four options on those axes
  • Tell the Tool Runner apart from the Claude Agent SDK, and pick the right one instead of substituting either
  • Reach for the manual loop only when per-turn hooks genuinely cannot express your control flow
34

Who Owns the Loop

Four ways to build an agent on Claude, and the two questions that actually separate them. Nearly every mix-up here comes from treating “SDK” as one thing.

THE CENTRAL IDEA

Two independent questions decide which option you want. Who supplies the harness — the agent loop and its context management? And who supplies the deployment — the machine the tools actually run on? Three of the four options answer “you” to the second question. Only one hands over both.

Four approaches, split by what each one actually hands over
HARNESS DEPLOYMENT TOOLS 1 · MANUAL LOOP you write the while loop YOU BUILD IT every turn is yours YOU HOST your infra yours only 2 · TOOL RUNNER you write the tool functions SDK SUPPLIES per-turn hooks YOU HOST your infra yours only 3 · MANAGED AGENTS you write the agent config ANTHROPIC runs the loop ANTHROPIC per-session sandbox hosted bash, files, code exec + yours 4 · CLAUDE AGENT SDK you write a prompt SDK SUPPLIES the Claude Code harness YOU HOST your infra read, write, bash, grep, web + yours Only option 3 hands over deployment. 1, 2 and 4 all leave hosting to you — which is the axis the word “SDK” hides. Options 2 and 4 both supply a harness and nothing else. They differ in how much harness, not in who runs it.

Related

More in LLM & Agentic

Get full access to all 74+ sections with code examples, diagrams, and interactive animations.

Unlock Premium