Your First Agent SDK Agent
Run a Claude Agent SDK agent in ten lines: query() vs ClaudeSDKClient, every message type the stream yields, and configuring model, budget and tool restrictions through ClaudeAgentOptions.
Last updated
After this section you can
- Run a Claude Agent SDK agent and name every message type it yields, in order
- Configure tools, approvals, turn and budget limits through ClaudeAgentOptions
- Handle every ResultMessage subtype, and choose between query() and ClaudeSDKClient
Your First Agent SDK Agent
Ten lines give you an agent that can read files, search and run commands. The work is not the loop. It is reading what the loop yields and deciding what the agent may touch.
The Claude Agent SDK is Claude Code as a library. You call query(prompt, options); the bundled harness runs the loop, executes tools on your machine, and streams back typed messages, ending with a ResultMessage that says how the run ended and what it cost.