About anthropic-agent-sdk
A reference skill for Anthropic’s Claude Agent SDK, used to build and operate agents in TypeScript and Python. It covers agent execution, tools, MCP connections, session handling, controls, and production operations.
Key features
- 01TypeScript and Python SDK guidance
- 02Agent loop with query()
- 03Custom and external MCP tools
- 04Session resume and branching
- 05Permissions, hooks, and subagents
- 06Streaming and structured outputs
Use cases
- 01Building an agent with the Claude Agent SDK
- 02Adding custom tools or connecting MCP servers
- 03Resuming or branching an agent session
- 04Preparing an agent for production hosting
MCP support
Explains how to define in-process custom tools using MCP and connect the SDK to external MCP servers. It also covers MCP-related hooks and tool use.
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ fandhe-ai/ agent-reference-skills --skill anthropic-agent-sdkAfter installing, type/anthropic-agent-sdkin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
references/api-reference/python.mdREADME.mdtypescript.mdreferences/control/modifying-system-prompts.mdpermissions.mdREADME.mduser-input.mdreferences/extending/custom-tools.mdhooks.mdmcp.mdplugins.mdREADME.mdskills.mdslash-commands.mdsubagents.mdtool-search.mdreferences/getting-started/agent-loop.mdclaude-code-features.mdconfiguration.mdexamples.mdmigration-guide.mdoverview.mdquickstart.mdREADME.mdreferences/operations/cost-tracking.mdhosting.mdobservability.mdREADME.mdsecure-deployment.mdtroubleshooting.mdDetails
From the project READMEanthropic-agent-sdk
Claude Agent SDK (code.claude.com/docs/en/agent-sdk) — TypeScript / Python でエージェントをビルドする公式 SDK の
リファレンス。query() によるエージェントループ実行、custom tools(in-process MCP)、外部 MCP 接続、hooks、
subagents、permissions(canUseTool)、セッションの永続化・再開・分岐、streaming、structured outputs、
本番ホスティングをカバーする。
Claude Code CLI 本体は anthropic-claude-code / anthropic-claude-code-extend、Messages API 直接呼び出しは
anthropic-api-core、Claude API 側の tool use / Agent Skills / MCP は anthropic-api-tools-mcp を参照
(本スキルは SDK 経由でエージェントをビルド・運用する側を担当)。
Source: https://code.claude.com/docs/en/agent-sdk 、2026-10-16 取得(その時点の npm @anthropic-ai/claude-agent-sdk 0.3.301 / PyPI claude-agent-sdk 0.2.168)。
ディレクトリ構成
skills/anthropic-agent-sdk/
SKILL.md
references/
getting-started/
README.md
agent-loop.md
claude-code-features.md
configuration.md
examples.md
migration-guide.md
overview.md
quickstart.md
api-reference/
README.md
python.md
typescript.md
extending/
README.md
custom-tools.md
hooks.md
mcp.md
plugins.md
skills.md
slash-commands.md
subagents.md
tool-search.md
sessions-io/
README.md
file-checkpointing.md
session-storage.md
sessions.md
streaming-output.md
streaming-vs-single-mode.md
structured-outputs.md
todo-tracking.md
control/
README.md
modifying-system-prompts.md
permissions.md
user-input.md
operations/
README.md
cost-tracking.md
hosting.md
observability.md
secure-deployment.md
troubleshooting.md
samples/
README.md
minimal-agent.md
configure-agent.md
custom-tools.md
mcp-servers.md
hooks.md
permissions.md
subagents.md
sessions.md
streaming.md
structured-outputs.md
system-prompts.md
scripts/
README.md
setup.md
runtime.md
探索手順
タスクからカテゴリを引き、カテゴリの README.md で目的のページを特定する:
- 下記マッピング表でタスクに対応するカテゴリを探す
- そのカテゴリの
references/{category}/README.md(samples/scripts/は直下の README.md)を参照して目的のページを特定する - 該当ページの
.mdを Read して詳細を確認する
タスク → カテゴリ マッピング
| タスク | カテゴリ | 参照 README |
|---|---|---|
| Agent SDK の概要・エージェントループの仕組みを知りたい・インストールして最初のエージェントを作りたい・Claude Code SDK からの移行・SDK 内で Claude Code の機能(CLAUDE.md, Agent Skills, hooks)を使いたい・options オブジェクトを組み立てたい(model / fallbackModel, env / cwd / maxTurns / maxBudgetUsd)・セッション中に model や permission mode を変更したい(setModel / setPermissionMode / applyFlagSettings / updateSettings)・動かせるサンプルプロジェクトを探したい(claude-agent-sdk-demos / Claude Cookbook) | getting-started | references/getting-started/README.md |
query() や ClaudeAgentOptions / Options など TypeScript / Python の完全な型・関数シグネチャを確認したい | api-reference | references/api-reference/README.md |
custom tools(in-process MCP, createSdkMcpServer)を定義したい・外部 MCP サーバーに接続したい・hooks でツール呼び出しを制御したい・plugins・Agent Skills (SKILL.md) の skills オプション・コマンド名による呼び出し(/compact, /clear, カスタムコマンド。slash-commands は skills に統合済み)・subagents・tool search を扱いたい | extending | references/extending/README.md |
| セッションの永続化・再開・分岐(resume / fork)・外部ストレージへの保存・file checkpointing・todo 管理・streaming 出力・structured outputs を扱いたい | sessions-io | references/sessions-io/README.md |
system prompt をカスタマイズしたい・permission mode や canUseTool で権限制御したい・ユーザー入力/承認フローを扱いたい | control | references/control/README.md |
| 本番環境へのホスティング・セキュアなデプロイ・OpenTelemetry での observability・コスト/トークン追跡・エラーのトラブルシューティングを知りたい | operations | references/operations/README.md |
| 典型的な使い方を知りたい(最小エージェント, options 構成(configure-agent), custom tools, MCP サーバー接続, hooks, permissions, subagents, セッション継続, streaming, structured outputs, system prompt カスタマイズ) | samples | samples/README.md |
| SDK インストール・API キー設定・ホスティング用テレメトリー環境変数を知りたい | scripts | scripts/README.md |