6 6
7> Build production AI agents with Claude Code as a library7> Build production AI agents with Claude Code as a library
8 8
9Build AI agents that autonomously read files, run commands, search the web, edit code, and more. The Agent SDK gives you the same tools, agent loop, and context management that power Claude Code, programmable in Python and TypeScript. For other languages, [run the CLI programmatically](/en/headless) with the `-p` flag and `--output-format json`. For the thinking behind agent harness design, see [A harness for every task: dynamic workflows in Claude Code](https://claude.com/blog/a-harness-for-every-task-dynamic-workflows-in-claude-code) on the blog. To run the example below, install the SDK first by following the steps in [Get started](#get-started).9An agent is an application that completes a task by planning its own steps and calling tools that read files, run commands, or edit code. The Agent SDK gives you the same tools, [agent loop](/docs/en/agent-sdk/agent-loop), and context management that power Claude Code, programmable in Python and TypeScript.
10
11<CodeGroup>
12 ```python Python theme={null}
13 import asyncio
14 from claude_agent_sdk import query, ClaudeAgentOptions
15
16
17 async def main():
18 async for message in query(
19 prompt="Find and fix the bug in auth.py",
20 options=ClaudeAgentOptions(allowed_tools=["Read", "Edit", "Bash"]),
21 ):
22 print(message) # Claude reads the file, finds the bug, edits it
23
24
25 asyncio.run(main())
26 ```
27
28 ```typescript TypeScript theme={null}
29 import { query } from "@anthropic-ai/claude-agent-sdk";
30
31 for await (const message of query({
32 prompt: "Find and fix the bug in auth.ts",
33 options: { allowedTools: ["Read", "Edit", "Bash"] }
34 })) {
35 console.log(message); // Claude reads the file, finds the bug, edits it
36 }
37 ```
38</CodeGroup>
39
40The Agent SDK includes built-in tools for reading files, running commands, and editing code, so your agent can start working immediately without you implementing tool execution. Dive into the quickstart or explore real agents built with the SDK:
41
42<CardGroup cols={2}>
43 <Card title="Quickstart" icon="play" href="/en/agent-sdk/quickstart">
44 Build a bug-fixing agent in minutes
45 </Card>
46
47 <Card title="Example agents" icon="star" href="https://github.com/anthropics/claude-agent-sdk-demos">
48 Email assistant, research agent, and more
49 </Card>
50</CardGroup>
51
52## Get started
53
54<Steps>
55 <Step title="Install the SDK">
56 <Tabs>
57 <Tab title="TypeScript">
58 ```bash theme={null}
59 npm init -y
60 npm pkg set type=module
61 npm install @anthropic-ai/claude-agent-sdk
62 npm install --save-dev tsx
63 ```
64
65 Setting `"type": "module"` in `package.json` lets your agent script use top-level `await`, and [tsx](https://tsx.is) runs TypeScript files directly. In an existing CommonJS project, skip the first two commands and name your script `agent.mts` instead of `agent.ts`.
66 </Tab>
67
68 <Tab title="Python (uv)">
69 [uv](https://docs.astral.sh/uv/) is a fast Python package manager that handles virtual environments automatically:
70
71 ```bash theme={null}
72 uv init
73 uv add claude-agent-sdk
74 ```
75 </Tab>
76
77 <Tab title="Python (pip)">
78 Create and activate a virtual environment, then install the package. Installing into a virtual environment avoids the `error: externally-managed-environment` failure that system Python on recent Debian, Ubuntu, and Homebrew installs returns for `pip install` outside a venv.
79
80 On macOS or Linux:
81
82 ```bash theme={null}
83 python3 -m venv .venv
84 source .venv/bin/activate
85 pip install claude-agent-sdk
86 ```
87
88 On Windows:
89
90 ```powershell theme={null}
91 py -m venv .venv
92 .venv\Scripts\Activate.ps1
93 pip install claude-agent-sdk
94 ```
95
96 If PowerShell blocks `Activate.ps1` with an execution policy error, run `Set-ExecutionPolicy -Scope Process RemoteSigned` first.
97
98 The Python package requires Python 3.10 or later. If pip reports `No matching distribution found for claude-agent-sdk`, your interpreter is older than 3.10. Run `python3 --version` on macOS or Linux, or `py --version` on Windows, to check.
99 </Tab>
100 </Tabs>
101
102 <Note>
103 Both the TypeScript and Python SDKs bundle a native Claude Code binary for your platform, so you don't need to install Claude Code separately.
104 </Note>
105 </Step>
106
107 <Step title="Set your API key">
108 Get an API key from the [Console](https://platform.claude.com/), then set it as an environment variable.
109
110 On macOS or Linux:
111
112 ```bash theme={null}
113 export ANTHROPIC_API_KEY=sk-ant-xxxxx
114 ```
115
116 On Windows PowerShell:
117
118 ```powershell theme={null}
119 $env:ANTHROPIC_API_KEY = "sk-ant-xxxxx"
120 ```
121
122 The SDK also supports authentication via third-party API providers:
123
124 * **Amazon Bedrock**: set `CLAUDE_CODE_USE_BEDROCK=1` environment variable and configure AWS credentials
125 * **Claude Platform on AWS**: set `CLAUDE_CODE_USE_ANTHROPIC_AWS=1` and `ANTHROPIC_AWS_WORKSPACE_ID`, then configure AWS credentials
126 * **Google Cloud's Agent Platform**: set `CLAUDE_CODE_USE_VERTEX=1` environment variable and configure Google Cloud credentials
127 * **Microsoft Foundry**: set `CLAUDE_CODE_USE_FOUNDRY=1` environment variable and configure Azure credentials
128
129 See the setup guides for [Amazon Bedrock](/en/amazon-bedrock), [Claude Platform on AWS](/en/claude-platform-on-aws), [Google Cloud's Agent Platform](/en/google-vertex-ai), or [Microsoft Foundry](/en/microsoft-foundry) for details.
130
131 <Note>
132 Unless previously approved, Anthropic does not allow third party developers to offer claude.ai login or rate limits for their products, including agents built on the Claude Agent SDK. Please use the API key authentication methods described in this document instead.
133 </Note>
134 </Step>
135
136 <Step title="Run your first agent">
137 This example creates an agent that lists files in your current directory using built-in tools.
138
139 <CodeGroup>
140 ```python Python theme={null}
141 import asyncio
142 from claude_agent_sdk import query, ClaudeAgentOptions
143
144
145 async def main():
146 async for message in query(
147 prompt="What files are in this directory?",
148 options=ClaudeAgentOptions(allowed_tools=["Bash", "Glob"]),
149 ):
150 if hasattr(message, "result"):
151 print(message.result)
152
153
154 asyncio.run(main())
155 ```
156
157 ```typescript TypeScript theme={null}
158 import { query } from "@anthropic-ai/claude-agent-sdk";
159
160 for await (const message of query({
161 prompt: "What files are in this directory?",
162 options: { allowedTools: ["Bash", "Glob"] }
163 })) {
164 if ("result" in message) console.log(message.result);
165 }
166 ```
167 </CodeGroup>
168
169 Save the example as `agent.py` or `agent.ts`, then run it. The agent prints a short summary of the files in the directory.
170
171 <Tabs>
172 <Tab title="TypeScript">
173 ```bash theme={null}
174 npx tsx agent.ts
175 ```
176
177 If you named your script `agent.mts` for a CommonJS project, run `npx tsx agent.mts` instead.
178 </Tab>
179
180 <Tab title="Python (uv)">
181 ```bash theme={null}
182 uv run agent.py
183 ```
184 </Tab>
185
186 <Tab title="Python (pip)">
187 With the virtual environment activated, on macOS or Linux:
188
189 ```bash theme={null}
190 python3 agent.py
191 ```
192
193 On Windows, run `python agent.py`.
194 </Tab>
195 </Tabs>
196 </Step>
197</Steps>
198
199**Ready to build?** Follow the [Quickstart](/en/agent-sdk/quickstart) to create an agent that finds and fixes bugs in minutes.
200
201## Capabilities
202
203Everything that makes Claude Code powerful is available in the SDK:
204
205<Tabs>
206 <Tab title="Built-in tools">
207 Your agent can read files, run commands, and search codebases out of the box. Key tools include:
208
209 | Tool | What it does |
210 | --------------------------------------------------------------------------- | ------------------------------------------------------------------- |
211 | **Read** | Read any file in the working directory |
212 | **Write** | Create new files |
213 | **Edit** | Make precise edits to existing files |
214 | **Bash** | Run terminal commands, scripts, git operations |
215 | **Monitor** | Watch a background script and react to each output line as an event |
216 | **Glob** | Find files by pattern (`**/*.ts`, `src/**/*.py`) |
217 | **Grep** | Search file contents with regex |
218 | **WebSearch** | Search the web for current information |
219 | **WebFetch** | Fetch and parse web page content |
220 | **[AskUserQuestion](/en/agent-sdk/user-input#handle-clarifying-questions)** | Ask the user clarifying questions with multiple choice options |
221
222 For the full list, including scheduling and worktree tools, see the [tools reference](/en/tools-reference).
223
224 This example creates an agent that searches your codebase for TODO comments:
225
226 <CodeGroup>
227 ```python Python theme={null}
228 import asyncio
229 from claude_agent_sdk import query, ClaudeAgentOptions
230
231
232 async def main():
233 async for message in query(
234 prompt="Find all TODO comments and create a summary",
235 options=ClaudeAgentOptions(allowed_tools=["Read", "Glob", "Grep"]),
236 ):
237 if hasattr(message, "result"):
238 print(message.result)
239
240
241 asyncio.run(main())
242 ```
243
244 ```typescript TypeScript theme={null}
245 import { query } from "@anthropic-ai/claude-agent-sdk";
246
247 for await (const message of query({
248 prompt: "Find all TODO comments and create a summary",
249 options: { allowedTools: ["Read", "Glob", "Grep"] }
250 })) {
251 if ("result" in message) console.log(message.result);
252 }
253 ```
254 </CodeGroup>
255 </Tab>
256
257 <Tab title="Hooks">
258 Run custom code at key points in the agent lifecycle. SDK hooks use callback functions to validate, log, block, or transform agent behavior.
259
260 **Available hooks:** `PreToolUse`, `PostToolUse`, `Stop`, `SessionStart`, `SessionEnd`, `UserPromptSubmit`, and more.
261
262 This example logs all file changes to an audit file:
263
264 <CodeGroup>
265 ```python Python theme={null}
266 import asyncio
267 from datetime import datetime
268 from claude_agent_sdk import query, ClaudeAgentOptions, HookMatcher
269
270
271 async def log_file_change(input_data, tool_use_id, context):
272 file_path = input_data.get("tool_input", {}).get("file_path", "unknown")
273 with open("./audit.log", "a") as f:
274 f.write(f"{datetime.now()}: modified {file_path}\n")
275 return {}
276
277
278 async def main():
279 async for message in query(
280 prompt="Create a file named hello.py that prints a greeting",
281 options=ClaudeAgentOptions(
282 allowed_tools=["Read", "Edit"],
283 permission_mode="acceptEdits",
284 hooks={
285 "PostToolUse": [
286 HookMatcher(matcher="Edit|Write", hooks=[log_file_change])
287 ]
288 },
289 ),
290 ):
291 if hasattr(message, "result"):
292 print(message.result)
293
294
295 asyncio.run(main())
296 ```
297
298 ```typescript TypeScript theme={null}
299 import { query, HookCallback } from "@anthropic-ai/claude-agent-sdk";
300 import { appendFile } from "fs/promises";
301
302 const logFileChange: HookCallback = async (input) => {
303 const filePath = (input as any).tool_input?.file_path ?? "unknown";
304 await appendFile("./audit.log", `${new Date().toISOString()}: modified ${filePath}\n`);
305 return {};
306 };
307
308 for await (const message of query({
309 prompt: "Create a file named hello.ts that prints a greeting",
310 options: {
311 allowedTools: ["Read", "Edit"],
312 permissionMode: "acceptEdits",
313 hooks: {
314 PostToolUse: [{ matcher: "Edit|Write", hooks: [logFileChange] }]
315 }
316 }
317 })) {
318 if ("result" in message) console.log(message.result);
319 }
320 ```
321 </CodeGroup>
322
323 After the agent finishes, run `cat audit.log` to see the recorded file changes.
324
325 [Learn more about hooks →](/en/agent-sdk/hooks)
326 </Tab>
327
328 <Tab title="Subagents">
329 Spawn specialized agents to handle focused subtasks. Your main agent delegates work, and subagents report back with results.
330
331 Define custom agents with specialized instructions. Subagents are invoked via the Agent tool, so include `Agent` in `allowedTools` to auto-approve those invocations:
332
333 <CodeGroup>
334 ```python Python theme={null}
335 import asyncio
336 from claude_agent_sdk import query, ClaudeAgentOptions, AgentDefinition
337
338
339 async def main():
340 async for message in query(
341 prompt="Use the code-reviewer agent to review this codebase",
342 options=ClaudeAgentOptions(
343 allowed_tools=["Read", "Glob", "Grep", "Agent"],
344 agents={
345 "code-reviewer": AgentDefinition(
346 description="Expert code reviewer for quality and security reviews.",
347 prompt="Analyze code quality and suggest improvements.",
348 tools=["Read", "Glob", "Grep"],
349 )
350 },
351 ),
352 ):
353 if hasattr(message, "result"):
354 print(message.result)
355
356
357 asyncio.run(main())
358 ```
359
360 ```typescript TypeScript theme={null}
361 import { query } from "@anthropic-ai/claude-agent-sdk";
362
363 for await (const message of query({
364 prompt: "Use the code-reviewer agent to review this codebase",
365 options: {
366 allowedTools: ["Read", "Glob", "Grep", "Agent"],
367 agents: {
368 "code-reviewer": {
369 description: "Expert code reviewer for quality and security reviews.",
370 prompt: "Analyze code quality and suggest improvements.",
371 tools: ["Read", "Glob", "Grep"]
372 }
373 }
374 }
375 })) {
376 if ("result" in message) console.log(message.result);
377 }
378 ```
379 </CodeGroup>
380
381 Messages from within a subagent's context include a `parent_tool_use_id` field, letting you track which messages belong to which subagent execution.
382
383 [Learn more about subagents →](/en/agent-sdk/subagents)
384 </Tab>
385
386 <Tab title="MCP">
387 Connect to external systems via the Model Context Protocol: databases, browsers, APIs, and [hundreds more](https://github.com/modelcontextprotocol/servers).
388
389 This example connects the [Playwright MCP server](https://github.com/microsoft/playwright-mcp) to give your agent browser automation capabilities:
390
391 <CodeGroup>
392 ```python Python theme={null}
393 import asyncio
394 from claude_agent_sdk import query, ClaudeAgentOptions
395
396
397 async def main():
398 async for message in query(
399 prompt="Open example.com and describe what you see",
400 options=ClaudeAgentOptions(
401 mcp_servers={
402 "playwright": {"command": "npx", "args": ["@playwright/mcp@latest"]}
403 },
404 allowed_tools=["mcp__playwright__*"],
405 ),
406 ):
407 if hasattr(message, "result"):
408 print(message.result)
409
410
411 asyncio.run(main())
412 ```
413
414 ```typescript TypeScript theme={null}
415 import { query } from "@anthropic-ai/claude-agent-sdk";
416
417 for await (const message of query({
418 prompt: "Open example.com and describe what you see",
419 options: {
420 mcpServers: {
421 playwright: { command: "npx", args: ["@playwright/mcp@latest"] }
422 },
423 allowedTools: ["mcp__playwright__*"]
424 }
425 })) {
426 if ("result" in message) console.log(message.result);
427 }
428 ```
429 </CodeGroup>
430
431 [Learn more about MCP →](/en/agent-sdk/mcp)
432 </Tab>
433
434 <Tab title="Permissions">
435 Control exactly which tools your agent can use. Allow safe operations, block dangerous ones, or require approval for sensitive actions.
436
437 <Note>
438 For interactive approval prompts and the `AskUserQuestion` tool, see [Handle approvals and user input](/en/agent-sdk/user-input).
439 </Note>
440
441 This example creates a read-only agent that can analyze but not modify code. `allowed_tools` pre-approves `Read`, `Glob`, and `Grep` so they run without prompting. Tools not listed are still available but fall through to the permission mode; to block tools entirely, use `disallowed_tools`.
442
443 <CodeGroup>
444 ```python Python theme={null}
445 import asyncio
446 from claude_agent_sdk import query, ClaudeAgentOptions
447
448
449 async def main():
450 async for message in query(
451 prompt="Review this code for best practices",
452 options=ClaudeAgentOptions(
453 allowed_tools=["Read", "Glob", "Grep"],
454 ),
455 ):
456 if hasattr(message, "result"):
457 print(message.result)
458
459
460 asyncio.run(main())
461 ```
462
463 ```typescript TypeScript theme={null}
464 import { query } from "@anthropic-ai/claude-agent-sdk";
465
466 for await (const message of query({
467 prompt: "Review this code for best practices",
468 options: {
469 allowedTools: ["Read", "Glob", "Grep"]
470 }
471 })) {
472 if ("result" in message) console.log(message.result);
473 }
474 ```
475 </CodeGroup>
476
477 [Learn more about permissions →](/en/agent-sdk/permissions)
478 </Tab>
479
480 <Tab title="Sessions">
481 Maintain context across multiple exchanges. Claude remembers files read, analysis done, and conversation history. Resume sessions later, or fork them to explore different approaches.
482
483 This example captures the session ID from the first query, then resumes to continue with full context:
484
485 <CodeGroup>
486 ```python Python theme={null}
487 import asyncio
488 from claude_agent_sdk import query, ClaudeAgentOptions, SystemMessage, ResultMessage
489
490
491 async def main():
492 session_id = None
493
494 # First query: capture the session ID
495 try:
496 async for message in query(
497 prompt="Read the authentication module",
498 options=ClaudeAgentOptions(allowed_tools=["Read", "Glob"]),
499 ):
500 if isinstance(message, SystemMessage) and message.subtype == "init":
501 session_id = message.data["session_id"]
502 except Exception as error:
503 # A single-shot query() raises after yielding an error result. If
504 # the failure was an error result, session_id was already captured
505 # by the loop above; connection or process failures yield no
506 # result message.
507 print(f"Session ended with an error: {error}")
508
509 # Resume with full context from the first query
510 async for message in query(
511 prompt="Now find all places that call it", # "it" = auth module
512 options=ClaudeAgentOptions(resume=session_id),
513 ):
514 if isinstance(message, ResultMessage):
515 print(message.result)
516
517
518 asyncio.run(main())
519 ```
520
521 ```typescript TypeScript theme={null}
522 import { query } from "@anthropic-ai/claude-agent-sdk";
523
524 let sessionId: string | undefined;
525
526 // First query: capture the session ID
527 try {
528 for await (const message of query({
529 prompt: "Read the authentication module",
530 options: { allowedTools: ["Read", "Glob"] }
531 })) {
532 if (message.type === "system" && message.subtype === "init") {
533 sessionId = message.session_id;
534 }
535 }
536 } catch (error) {
537 // A single-shot query() throws after yielding an error result. If the
538 // failure was an error result, sessionId was already captured by the
539 // loop above; connection or process failures yield no result message.
540 console.error(`Session ended with an error: ${error}`);
541 }
542
543 // Resume with full context from the first query
544 for await (const message of query({
545 prompt: "Now find all places that call it", // "it" = auth module
546 options: { resume: sessionId }
547 })) {
548 if ("result" in message) console.log(message.result);
549 }
550 ```
551 </CodeGroup>
552
553 [Learn more about sessions →](/en/agent-sdk/sessions)
554 </Tab>
555</Tabs>
556
557### Claude Code features
558
559The SDK also supports Claude Code's filesystem-based configuration. With default options the SDK loads these from `.claude/` in your working directory and `~/.claude/`. To restrict which sources load, set `setting_sources` (Python) or `settingSources` (TypeScript) in your options.
560
561| Feature | Description | Location |
562| ------------------------------------------------ | ----------------------------------------------------------------------------- | ---------------------------------- |
563| [Skills](/en/agent-sdk/skills) | Specialized capabilities Claude uses automatically or you invoke with `/name` | `.claude/skills/*/SKILL.md` |
564| [Commands](/en/agent-sdk/slash-commands) | Custom commands in the legacy format. Use skills for new custom commands | `.claude/commands/*.md` |
565| [Memory](/en/agent-sdk/modifying-system-prompts) | Project context and instructions | `CLAUDE.md` or `.claude/CLAUDE.md` |
566| [Plugins](/en/agent-sdk/plugins) | Extend with skills, agents, hooks, and MCP servers | Programmatic via `plugins` option |
567 10
568## Compare the Agent SDK to other Claude tools11## Compare the Agent SDK to other Claude tools
569 12
570The Claude Platform offers multiple ways to build with Claude. Here's how the Agent SDK fits in:13The Agent SDK, the CLI, the Client SDK, and Managed Agents each fit different needs. Use the table to find the one that matches what you're building.
571 14
572<Tabs>15| If you're... | Use | Why |
573 <Tab title="Agent SDK vs Client SDK">16| ------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
574 The [Anthropic Client SDK](https://platform.claude.com/docs/en/api/client-sdks) gives you direct API access: you send prompts and implement tool execution yourself. The **Agent SDK** gives you Claude with built-in tool execution.17| Building an agent without implementing the tool loop yourself | **Agent SDK** | A library that runs the agent loop in your own process, in Python or TypeScript. |
18| Doing interactive development or running one-off tasks from a terminal | [**Claude Code CLI**](/docs/en/overview) | The terminal interface, built for daily interactive use. |
19| Calling the API directly and implementing the tool loop yourself | [**Client SDK**](https://platform.claude.com/docs/en/api/client-sdks) | Direct access to the Anthropic API rather than to Claude Code. You implement the tool loop yourself. |
20| Running long-running or asynchronous agents without managing your own sandbox or session infrastructure | [**Managed Agents**](https://platform.claude.com/docs/en/managed-agents/overview) | Hosted REST API, a separate product from the Agent SDK. Anthropic runs the agent and the sandbox. |
575 21
576 With the Client SDK, you implement a tool loop. With the Agent SDK, Claude handles it. This simplified pseudocode shows the difference:22The SDK is available as a library for Python and TypeScript only. To drive the same agent loop from another language, [run the CLI as a subprocess](/docs/en/headless) with the `-p` flag and `--output-format json`.
577 23
578 <CodeGroup>24## Capabilities
579 ```python Python theme={null}
580 # Client SDK: You implement the tool loop
581 response = client.messages.create(...)
582 while response.stop_reason == "tool_use":
583 result = your_tool_executor(response.tool_use)
584 response = client.messages.create(tool_result=result, **params)
585
586 # Agent SDK: Claude handles tools autonomously
587 async for message in query(prompt="Fix the bug in auth.py"):
588 print(message)
589 ```
590
591 ```typescript TypeScript theme={null}
592 // Client SDK: You implement the tool loop
593 let response = await client.messages.create({ ...params });
594 while (response.stop_reason === "tool_use") {
595 const result = yourToolExecutor(response.tool_use);
596 response = await client.messages.create({ tool_result: result, ...params });
597 }
598
599 // Agent SDK: Claude handles tools autonomously
600 for await (const message of query({ prompt: "Fix the bug in auth.ts" })) {
601 console.log(message);
602 }
603 ```
604 </CodeGroup>
605 </Tab>
606
607 <Tab title="Agent SDK vs Claude Code CLI">
608 Same capabilities, different interface:
609 25
610 | Use case | Best choice |26Everything that makes Claude Code powerful is available in the SDK.
611 | ----------------------- | ----------- |
612 | Interactive development | CLI |
613 | CI/CD pipelines | SDK |
614 | Custom applications | SDK |
615 | One-off tasks | CLI |
616 | Production automation | SDK |
617 27
618 Many teams use both: CLI for daily development, SDK for production. Workflows translate directly between them.28| Capability | What it does | Learn more |
619 </Tab>29| ---------------------------- | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
30| Built-in tools | Read, write, edit files, run commands, and search the web | [Tools reference](/docs/en/tools-reference) |
31| Hooks | Run custom code at key points in the agent lifecycle | [Hooks](/docs/en/agent-sdk/hooks) |
32| Subagents | Spawn specialized agents for focused subtasks | [Subagents](/docs/en/agent-sdk/subagents) |
33| MCP | Connect external tools and data sources via the Model Context Protocol | [MCP](/docs/en/agent-sdk/mcp) |
34| Permissions | Control which tools run automatically, which need approval | [Permissions](/docs/en/agent-sdk/permissions) |
35| Sessions | Maintain context across exchanges, resume or fork later | [Sessions](/docs/en/agent-sdk/sessions) |
36| Skills, commands, and memory | Load automatically from your project's `.claude/` and from `~/.claude/`, same as Claude Code | [Skills](/docs/en/agent-sdk/skills), [Commands](/docs/en/agent-sdk/slash-commands), [Memory](/docs/en/agent-sdk/modifying-system-prompts), [Configuration loading](/docs/en/agent-sdk/claude-code-features) |
37| Plugins | Package skills, agents, hooks, and MCP servers, and load them by local path | [Plugins](/docs/en/agent-sdk/plugins) |
620 38
621 <Tab title="Agent SDK vs Managed Agents">39## Get started
622 [Managed Agents](https://platform.claude.com/docs/en/managed-agents/overview) is a hosted REST API: Anthropic runs the agent and the sandbox, and your application sends events and streams back results. The **Agent SDK** is a library that runs the agent loop inside your own process.
623 40
624 | | Agent SDK | Managed Agents |41Follow the [Quickstart](/docs/en/agent-sdk/quickstart) to install the SDK, set your API key, and build your first agent, one that finds and fixes bugs in existing code.
625 | ------------------ | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
626 | **Runs in** | Your process, your infrastructure | Anthropic-managed infrastructure |
627 | **Interface** | Python or TypeScript library | REST API |
628 | **Agent works on** | Files on your infrastructure | A managed sandbox per session |
629 | **Session state** | JSONL on your filesystem | Anthropic-hosted event log |
630 | **Custom tools** | In-process Python or TypeScript functions | Claude triggers the tool; you execute and return results |
631 | **Best for** | Local prototyping, agents that work directly on your filesystem and services | Production agents without operating sandbox or session infrastructure, long-running and asynchronous sessions |
632 42
633 A common path is to prototype with the Agent SDK locally, then move to Managed Agents for production.43<Note>
634 </Tab>44 Unless previously approved, Anthropic does not allow third party developers to offer claude.ai login or rate limits for their products, including agents built on the Claude Agent SDK. Use the API key authentication methods described in the [Quickstart](/docs/en/agent-sdk/quickstart) instead.
635</Tabs>45</Note>
636 46
637## Changelog47## Changelog
638 48
641* **TypeScript SDK**: [view CHANGELOG.md](https://github.com/anthropics/claude-agent-sdk-typescript/blob/main/CHANGELOG.md)51* **TypeScript SDK**: [view CHANGELOG.md](https://github.com/anthropics/claude-agent-sdk-typescript/blob/main/CHANGELOG.md)
642* **Python SDK**: [view CHANGELOG.md](https://github.com/anthropics/claude-agent-sdk-python/blob/main/CHANGELOG.md)52* **Python SDK**: [view CHANGELOG.md](https://github.com/anthropics/claude-agent-sdk-python/blob/main/CHANGELOG.md)
643 53
644## Reporting bugs54## Report bugs
645 55
646If you encounter bugs or issues with the Agent SDK:56If you encounter bugs or issues with the Agent SDK:
647 57
654 64
655**Allowed:**65**Allowed:**
656 66
657* "Claude Agent" (preferred for dropdown menus)67* "Claude Agent", preferred for dropdown menus
658* "Claude" (when within a menu already labeled "Agents")68* "Claude", when within a menu already labeled "Agents"
659* "{YourAgentName} Powered by Claude" (if you have an existing agent name)69* "\{YourAgentName} Powered by Claude", if you have an existing agent name
660 70
661**Not permitted:**71**Not permitted:**
662 72
671 81
672## Next steps82## Next steps
673 83
674<CardGroup cols={2}>84These resources cover deeper technical detail and example projects for building with the Agent SDK.
675 <Card title="Quickstart" icon="play" href="/en/agent-sdk/quickstart">
676 Build an agent that finds and fixes bugs in minutes
677 </Card>
678
679 <Card title="Example agents" icon="star" href="https://github.com/anthropics/claude-agent-sdk-demos">
680 Email assistant, research agent, and more
681 </Card>
682
683 <Card title="TypeScript SDK" icon="code" href="/en/agent-sdk/typescript">
684 Full TypeScript API reference and examples
685 </Card>
686 85
687 <Card title="Python SDK" icon="code" href="/en/agent-sdk/python">86* [Quickstart](/docs/en/agent-sdk/quickstart): build your first agent that finds and fixes bugs
688 Full Python API reference and examples87* [Agent loop](/docs/en/agent-sdk/agent-loop): how Claude plans, calls tools, and decides when a task is done
689 </Card>88* [Example agents](https://github.com/anthropics/claude-agent-sdk-demos): demo apps for local development
690</CardGroup>89* [TypeScript SDK](/docs/en/agent-sdk/typescript): full TypeScript API reference and examples
90* [Python SDK](/docs/en/agent-sdk/python): full Python API reference and examples
91* [Agent harness design](https://claude.com/blog/a-harness-for-every-task-dynamic-workflows-in-claude-code): how the Claude Code team uses dynamic workflows to orchestrate subagents at scale