Skip to main content

claude-agent-sdk

Build autonomous AI agents with Claude Agent SDK. TypeScript v0.2.141 | Python v0.2.82. Covers: query(), hooks, subagents, MCP, permissions, sandbox, structured outputs, and sessions. Use when: building AI agents, configuring MCP servers, setting up permissions/hooks, using structured outputs, troubleshooting SDK errors, or working with subagents.

Source facts

Repository
xiaolai/claude-agent-sdk-skill-autoupdated
Last source activity
May 18, 2026 at 05:58
Detected SKILL.md language
English
Stars
61
Forks
15

Install options

The review-first prompt is selected by default. You can switch to a direct command or download a local copy.

Review the source files

Read SKILL.md and any companion files shown by SkillsMP before deciding whether to install.

Showing SKILL.md

SKILL.md
Source instructions · Read-only preview
name
claude-agent-sdk
description
Build autonomous AI agents with Claude Agent SDK. TypeScript v0.2.141 | Python v0.2.82. Covers: query(), hooks, subagents, MCP, permissions, sandbox, structured outputs, and sessions. Use when: building AI agents, configuring MCP servers, setting up permissions/hooks, using structured outputs, troubleshooting SDK errors, or working with subagents.
user-invocable
true
# Claude Agent SDK Reference | | TypeScript | Python | |---|---|---| | **Version** | v0.2.141 | v0.2.82 | | **Package** | `@anthropic-ai/claude-agent-sdk` | `claude-agent-sdk` (PyPI) | | **Docs** | [TypeScript SDK](https://platform.claude.com/docs/en/agent-sdk/typescript) | [Python SDK](https://platform.claude.com/docs/en/agent-sdk/python) | | **Repo** | [claude-agent-sdk-typescript](https://github.com/anthropics/claude-agent-sdk-typescript) | [claude-agent-sdk-python](https://github.com/anthropics/claude-agent-sdk-python) | | **Full reference** | [SKILL-typescript.md](SKILL-typescript.md) | [SKILL-python.md](SKILL-python.md) | ## When you detect the user's language - Working with `.ts` files, TypeScript imports, or `npm`/`node` → read `SKILL-typescript.md` - Working with `.py` files, Python imports, or `pip`/`python` → read `SKILL-python.md` - Ambiguous or multi-language → read both as needed ## Cross-Language Naming Map | Concept | TypeScript | Python | |---------|-----------|--------| | One-shot query | `query(options)` | `query(options)` | | Stateful client | N/A (query manages state) | `ClaudeSDKClient` | | Options type | `Options` interface | `ClaudeAgentOptions` dataclass | | Tool definition | `tool(name, schema, handler)` | `@tool(name, desc, schema)` decorator | | MCP server factory | `createSdkMcpServer()` | `create_sdk_mcp_server()` | | Permission callback | `canUseTool` | `can_use_tool` | | Permission mode | `permissionMode: "..."` | `permission_mode="..."` | | Hook registration | `hooks: { PreToolUse: [...] }` | `hooks={"PreToolUse": [...]}` | | System prompt | `systemPrompt` | `system_prompt` | | Max turns | `maxTurns` | `max_turns` | | Allowed tools | `allowedTools` | `allowed_tools` | | MCP servers | `mcpServers` | `mcp_servers` | | Subagent def | `AgentDefinition` | `AgentDefinition` dataclass | ## Shared Concepts (both languages) Both SDKs wrap the Claude Code CLI and share these concepts: - **Hooks**: Pre/PostToolUse, Stop, SubagentStop, Notification, etc. - **Permissions**: default, acceptEdits, plan, bypassPermissions, etc. - **MCP Servers**: stdio, HTTP, SSE, SDK (in-process) configurations - **Subagents**: Delegate tasks to child agents with scoped tools/permissions - **Structured Outputs**: JSON Schema validation on agent output - **Sandbox**: Container-based isolation (Docker/Kubernetes) - **Sessions**: Capture, resume, and fork conversation state For API details, code examples, options tables, and known issues, read the language-specific reference file.
View on GitHub