Example agents
Where to find runnable Agent SDK projects and step-by-step recipes, plus a few small agent patterns worth copying into your own work.
Reading API references only gets you so far. The quickest way to understand the Agent SDK is to run something complete and then change it. This page points you at the best starting material and sketches a few small patterns I come back to.
Start small
If you have not run an agent yet, do one of these first:
- The quickstart in this handbook: set up a project in TypeScript or Python and have an agent harden a small script. Setup steps included.
- The Hello World project in anthropics/claude-agent-sdk-demos: a minimal TypeScript project to clone if you prefer starting from a repository.
Demo applications
The claude-agent-sdk-demos repository holds fuller applications meant for running locally. They range from an email client with an agent built in to a multi-agent research system. Pick the one closest in shape to what you want to build, clone it, and read how it wires up options, tools and the message stream.
These are demos, not production templates. Before you deploy anything based on one, read hosting and secure deployment.
Python recipes in the Claude Cookbook
The Claude Cookbook (on platform.claude.com) has an Agent SDK series of Python notebooks. They build on one another, starting with a research agent written in a single call and working up to multi-agent systems. Begin with the first notebook, "the one-liner research agent", and go in order: each introduces one or two new ideas. The wider cookbook covers other Claude products too.
Patterns worth stealing
Short sketches of agents I have built or seen work well, with links to the pages that explain the moving parts.
Read-only auditor
An agent that inspects but never changes anything. Good for a first deployment because the blast radius is zero.
opts = ClaudeAgentOptions(
allowed_tools=["Read", "Glob", "Grep"],
disallowed_tools=["Write", "Edit", "Bash"],
setting_sources=[],
max_turns=15,
)
task = "Check every Terraform file under infra/ for storage buckets without encryption. Report file and line."
Pair it with structured outputs to get a JSON list you can post to a ticket system.
Domain tools agent
Give Claude a few functions from your own system as custom tools, and switch off the built-ins it does not need. Ideal for internal support bots that look things up in your database.
const crm = createSdkMcpServer({
name: "crm",
tools: [lookupCustomer, listOpenTickets],
});
query({
prompt: "Has Hartley & Co raised anything this month?",
options: {
mcpServers: { crm },
tools: [],
allowedTools: ["mcp__crm__*"],
},
});
Human in the loop
Let the agent propose changes but route every risky call to a person through canUseTool. User input and approvals has the full pattern, including clarifying questions.
Long-running assistant
A chat-style agent that remembers context across turns, using streaming input and sessions, with transcripts kept in your own database via session storage so any server can pick the conversation up.
Orchestrator with specialists
A main agent that hands focused subtasks (tests, docs, security review) to subagents, each with its own tools and prompt. Keeps the main context clean on big jobs.