🧩Claude Agent SDK
Anthropic's library for building your own agents on the Claude Code loop · 51 terms
Agent SDK Basics
8What the Agent SDK is, how to install it, and the ways your code talks to an agent.
A kit that puts the Claude Code agent inside your own app.
The package you install to get the kit, from npm or PyPI.
The main function of the kit. Give it a prompt, and it runs the agent and sends back each step.
A Python class that keeps one chat open for many prompts.
The one object that holds all the settings for a session.
The mode that keeps one session open. You can send more, add images and stop it.
The mode that sends one prompt and ends, for jobs done in one go.
The method that stops what the agent is doing, but keeps the chat.
SDK Messages
6The messages an agent run sends back to your code, from the first one to the result.
The message for session events. The first one says how the session was set up.
The message that holds one piece of Claude's reply: some text or a tool call.
The message that takes a tool's result, or your own words, back to Claude.
The message for each small bit of a reply. It lets text show as it is typed.
The last message of a run. It has the final text, the cost and how it ended.
The field that says if a run finished, or which limit stopped it.
SDK Options
31The fields you set to shape a session: what it may do, how far it goes, and what it can reach.
Permission Options
6Options that say which tool calls run on their own, which are blocked, and who decides the rest.
The option that lists tools the agent may use with no prompt.
The option that blocks a tool, or some uses of it, in all modes.
The option that sets the mode for what needs a yes.
Your own function that decides a tool call when nothing else has.
What your code says back for each tool call. It is yes or no.
The option that must be true before bypass mode can run.
Loop Options
8Options that cap how long a run goes, how much it spends, how hard it thinks and what shape its answer takes.
The option that picks which Claude model runs your agent.
The option that names a spare model to use when the main one fails.
The option that says if Claude thinks before it speaks, and for how long.
The option that caps how many turns an agent run may take.
The option that stops a run once it has spent a set sum.
The option that sets how hard Claude thinks on each reply, from low to max.
The option that makes the agent end with JSON in a shape you pick.
The option that lets your code stop a whole agent run.
Prompt Options
6Options that set what the agent is told, which files it reads, and which tools are there.
The option that sets what the agent is told before any task.
The option that picks which settings the agent reads from disk.
The option that sets env values for the agent.
The option that sets which built-in tools are there at all.
The option that sets which folder the agent works in.
The option that gives the agent more folders to work in.
Session Options
6Options for old chats: pick one up, copy it, keep it, or undo its edits.
The option that picks up the last session in the folder. No ID is needed.
The option that loads an old session by its ID, with all of its past.
The option that starts a copy of an old session, with a new ID. The first one stays as it was.
The option that stops a session being saved. Then it cannot be picked up later.
An object you write that keeps saved chats off the local disk.
The option that lets you put files back the way they were.
Extension Options
5Options that give the agent more reach: more tools, more agents, hooks and skills.
The option that links MCP servers, and their tools, to a session.
The type for a subagent you set up in code. It has a description, its own prompt and its tools.
Your own function that the kit runs at a set step.
The option that picks which skills an agent session may use.
The option that adds plugins from Claude Code to your agent.
Custom Tools
3How you write your own tools in code and give them to the agent, with no extra server.
The helper that makes your own tool. You give it a name, a note on what it does, its inputs and the code to run.
The function that puts your tools on one server for the agent.
An MCP server that runs in your own app. Its tools are plain functions in your code.
Agent SDK Deployment
3Running agents on your own servers: the box each one lives in, how long it lives, and what it costs.
Running Agent SDK agents on your own servers. Each session is its own process.
How long an agent's box lives, next to the work it has to do.
Reading what an agent run cost, from the messages it sends back.