Reach for the plain API
Single-shot calls. Structured I/O. Classification. Extraction. You control the prompt; you parse the answer.
If you've used Claude Code and wondered "how is it doing all this looping," the answer is: the Agent SDK. You can build your own version on the same infrastructure — a goal, some tools, a budget, and Claude runs until done.
Single-shot calls. Structured I/O. Classification. Extraction. You control the prompt; you parse the answer.
Multi-step work where Claude needs to read files, run code, make decisions, iterate. You hand it a goal; it figures out the steps.
pip install claude-agent-sdk or npm install @anthropic-ai/claude-agent-sdk.from claude_agent_sdk import Agent
agent = Agent(
model="claude-sonnet-4-6",
tools=["read_file","write_file","glob","grep"],
goal="Find broken links in ./docs and write a report to ./report.md",
max_steps=40,
)
agent.run()
Single agent, file + bash tools, plain goal. Walk away. Most Claude Code uses live here.
One agent breaks the job into chunks, spawns sub-agents, collects results. Use sub-agents when chunks are independent.
The agent never reads or writes files; it only orchestrates calls to your in-house APIs. Useful when data must stay in your systems.
max_steps. A runaway loop wastes money fast.response.usage per step. Dashboards in week one.