Agent skill · AI & Agents

claude-agent-sdk-python

Expert guidance for building AI agents with the Claude Agent SDK in Python. Use when the user writes Python code with the SDK, imports claude_agent_sdk, uses query(), ClaudeSDKClient, ClaudeAgentOptions, AgentDefinition, creates custom @tool functions, sets up hooks, integrates MCP servers, manages sessions, or debugs SDK issues in Python. Also triggers on: "claude_agent_sdk", "ClaudeAgentOptions", "from claude_agent_sdk import", "pip install claude-agent-sdk", "asyncio.run", or "async for message in query".

majiayu000github.com/majiayu000GitHub ↗
claude-codeMIT
Install
npx skills add majiayu000/claude-skill-registry --skill claude-agent-sdk-python --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 2
SKILL.md size: 14 KB
Bundled scripts: none
Path: skills/agent/claude-agent-sdk-python/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 534
Language: HTML

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# Claude Agent SDK — Python Guide Production guidance for building AI agents with the Claude Agent SDK in Python. > **Naming**: The Claude Code SDK was renamed to the Claude Agent SDK (v0.1.0+). > Package: `pip install claude-agent-sdk` · Import: `from claude_agent_sdk import ...` ## Message Types All message types for type checking and `isinstance()` checks: ```python from claude_agent_sdk import ( AssistantMessage, # Claude's text/tool responses ResultMessage, # Final result with subtype (success/error/cancelled) SystemMessage, # System events (session_id, etc.) UserMessage, # User prompts ToolUseMessage, # Tool invocation requests ToolResultMessage, # Tool execution results ) ``` ## Quick Reference — Two Interaction Modes ### 1. `query()` — Stateless, One-Shot Best for: independent tasks, automation scripts, CI pipelines. ```python import asyncio from claude_agent_sdk import query, ClaudeAgentOptions, AssistantMessage, ResultMessage async def main(): async for message in query( prompt="Review utils.py for bugs. Fix any issues you find.", options=ClaudeAgentOptions( allowed_tools=["Read", "Edit", "Glob"], permission_mode="acceptEdits", ), ): if isinstance(message, AssistantMessag

What's inside
Steps it walks through
  1. Message Types
  2. Quick Reference — Two Interaction Modes
  3. 1. query() — Stateless, One-Shot
  4. 2. ClaudeSDKClient — Stateful, Multi-Turn
  5. ClaudeAgentOptions — Complete Configuration
  6. Built-in Tools
  7. Custom Tools via SDK MCP Server
  8. Subagents
  9. Hooks — Lifecycle Callbacks
  10. MCP Integration (External Servers)
  11. Using Skills in the SDK
  12. Sessions and Conversation Management
  13. System Prompt Configuration
  14. Authentication
Ships with 1 file
  • metadata.json
Commands it runs
Direct API (default)
export ANTHROPIC_API_KEY=your-api-key
Amazon Bedrock
export CLAUDE_CODE_USE_BEDROCK=1
Google Vertex AI
export CLAUDE_CODE_USE_VERTEX=1
Microsoft Azure AI Foundry
export CLAUDE_CODE_USE_FOUNDRY=1
More from claude-skill-registry
All skills →
About this skill
What does the claude-agent-sdk-python skill do?

Expert guidance for building AI agents with the Claude Agent SDK in Python. Use when the user writes Python code with the SDK, imports claude_agent_sdk, uses query(), ClaudeSDKClient, ClaudeAgentOptions, AgentDefinition, creates custom @tool functions, sets up hooks, integrates MCP servers, manages sessions, or debugs SDK issues in Python. Also triggers on: "claude_agent_sdk", "ClaudeAgentOptions", "from claude_agent_sdk import", "pip install claude-agent-sdk", "asyncio.run", or "async for message in query".

How do I install it?

Run `npx skills add majiayu000/claude-skill-registry --skill claude-agent-sdk-python --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going