Skip to content
AgenticAIWiki
  1. Learn
  2. Part 9
  3. 51. Agent frameworks compared
  4. 51.2

Lesson 51.2 · 2 of 6 · 6 min read · Reviewed 24 Nov 2026

Vendor agent SDKs

By the end, you can

  • Describe the Claude Agent SDK.
  • Know what it's best suited for.
  • Compare the main vendor agent SDKs on the features that matter to an architect.

What’s in it

Part What it does
Agent loop Runs Claude, executes tool calls, feeds back results
Built-in tools Read, write and edit files; run shell commands; search files; fetch web pages
Sessions Resume or fork a conversation (chapter 61)
Hooks Run your code before or after tool calls (chapter 44)
Subagents Delegate to agents with their own context (chapter 43)
Permissions Allow, ask or deny tools and commands (chapter 45)
MCP Plug in external tools and data (chapter 35)

A sketch

query(
  prompt="Find why test_billing fails and fix it",
  options={ allowed_tools: [Read, Edit, Bash], permission_mode: "default",   # ask before edits; "acceptEdits" and "plan" are the others you meet most
            hooks: { PreToolUse: block_rm_rf } }
)

Chapter 42 walks through it in more depth.

Good fits

  • Coding agentsAgent: A system where a model decides its own next steps, calling tools in a loop until the task is done., ops agents, data-cleaning agents.
  • Internal agents that need Claude Code’s permissionsPermission rule: An allow, ask or deny rule that controls which tools, commands or paths a coding agent may use. and hooksHook: Code that runs automatically at a lifecycle event, such as before or after a tool call, to check, block or log it..

Less good fits

  • A single classification or extraction call (use the Messages APIMessages API: The chat API endpoint that takes a list of messages and returns the next assistant message.).
  • Multi-vendor model setups (it’s built around Claude).

Other vendor SDKs

Every major provider now ships an agent SDKClaude Agent SDK: Anthropic’s library for building agents on the same loop that powers Claude Code, with tools, hooks, subagents and MCP.. They share the same core (a loop, tools, state, tracingTrace: A record of everything that happened during one request or agent run, as a tree of timed steps.) and differ in what they make easy.

SDK Shape it favours Multi-agent Protocols Lock-in to watch
Claude Agent SDK A coding-agent harness: files, shell, search, permissions, hooks Subagents with their own context MCP Built around Claude models
OpenAI Agents SDK A light loop with agents, tools, guardrails and built-in tracing Handoffs between agents, or agents as tools MCP Defaults to OpenAI models, other models possible through adapters
Google Agent Development Kit (ADK) Agents plus workflow agents (sequential, parallel, loop) Agent hierarchies MCP, A2A Tuned for Gemini and Google Cloud, other models possible
Microsoft Agent Framework Agents plus graph-style workflows, for Python and .NET Group chat, handoff and workflow patterns MCP, A2A Tuned for Azure, other models possible

Check each one against your list: does it trace every model and tool call, support your model choices, speak MCP for tools and A2AAgent-to-agent protocol (A2A): An open protocol for agents built by different vendors to discover each other and exchange tasks. if you need peers, and let you enforce permissions in code? Features move fast here, so confirm in the current docs before you commit.

Key points

  • The Claude Agent SDK is the harness behind Claude Code, packaged as a library for Python and TypeScript.
  • It includes the agent loop, built-in tools (files, shell, search), sessions, hooks, subagents and permissions.
  • You can add your own tools, often as MCP servers.
  • It fits agents that work with files, code and commands, or that want Claude Code's proven controls.
Hands-on labRuns in the Playground

Build a small agent with the Agent SDK

Use the Agent SDK's loop with your own tool, a turn limit and a PostToolUse audit hook.

You will have: An SDK agent that answers an order question and prints an audit log of its tool calls.

Steps

  1. Run the starter: the agent answers, but the audit log is empty.
  2. Write log_call() to record the tool name and input.
  3. Register it as a PostToolUse hook for the lookup tool.
  4. Run again and compare the audit log with the tool calls printed from the stream.
  5. On your own machine, the real SDK follows the same shape; keep any API key in an environment variable.

Done when

  • The run ends with subtype success within the 4-turn limit.
  • The answer mentions order A-1042.
  • The audit log has one entry for lookup_order with the order id.

Open in the Playground No API key needed.

Starter code (Python)
import asyncio
import json
from claude_agent_sdk import query, tool, create_sdk_mcp_server, ClaudeAgentOptions, HookMatcher, AssistantMessage, ResultMessage, ToolUseBlock

# The Agent SDK runs the loop for you. You add tools, limits and hooks. (Simulated in the Playground.)
ORDERS = {"A-1042": {"item": "espresso machine", "status": "shipped", "total": 240}}
audit = []


@tool("lookup_order", "Look up an order by its id, like A-1042. Returns the item, status and total.", {"order_id": str})
async def lookup_order(args):
    order = ORDERS.get(args["order_id"])
    text = json.dumps(order) if order else f"No order {args['order_id']}"
    return {"content": [{"type": "text", "text": text}], "is_error": order is None}


shop = create_sdk_mcp_server(name="shop", tools=[lookup_order])


async def log_call(input_data, tool_use_id, context):
    # TODO: append "<tool_name> <tool_input as JSON>" to audit
    return {}


options = ClaudeAgentOptions(
    system_prompt="You are a support agent for a coffee equipment shop.",
    mcp_servers={"shop": shop},
    allowed_tools=["mcp__shop__lookup_order"],
    max_turns=4,
    # TODO: register log_call as a PostToolUse hook for mcp__shop__lookup_order
)


async def main():
    async for m in query(prompt="Where is my order A-1042?", options=options):
        if isinstance(m, AssistantMessage):
            for b in m.content:
                if isinstance(b, ToolUseBlock):
                    print("tool call:", b.name, json.dumps(b.input))
        if isinstance(m, ResultMessage):
            print(f"[{m.subtype}] turns: {m.num_turns}")
            print("answer:", m.result)
    print("audit:", audit)


asyncio.run(main())
Show a solution
import asyncio
import json
from claude_agent_sdk import query, tool, create_sdk_mcp_server, ClaudeAgentOptions, HookMatcher, AssistantMessage, ResultMessage, ToolUseBlock

# The Agent SDK runs the loop for you. You add tools, limits and hooks. (Simulated in the Playground.)
ORDERS = {"A-1042": {"item": "espresso machine", "status": "shipped", "total": 240}}
audit = []


@tool("lookup_order", "Look up an order by its id, like A-1042. Returns the item, status and total.", {"order_id": str})
async def lookup_order(args):
    order = ORDERS.get(args["order_id"])
    text = json.dumps(order) if order else f"No order {args['order_id']}"
    return {"content": [{"type": "text", "text": text}], "is_error": order is None}


shop = create_sdk_mcp_server(name="shop", tools=[lookup_order])


async def log_call(input_data, tool_use_id, context):
    audit.append(f"{input_data['tool_name']} {json.dumps(input_data['tool_input'])}")
    return {}


options = ClaudeAgentOptions(
    system_prompt="You are a support agent for a coffee equipment shop.",
    mcp_servers={"shop": shop},
    allowed_tools=["mcp__shop__lookup_order"],
    max_turns=4,
    hooks={"PostToolUse": [HookMatcher(matcher="mcp__shop__lookup_order", hooks=[log_call])]},
)


async def main():
    async for m in query(prompt="Where is my order A-1042?", options=options):
        if isinstance(m, AssistantMessage):
            for b in m.content:
                if isinstance(b, ToolUseBlock):
                    print("tool call:", b.name, json.dumps(b.input))
        if isinstance(m, ResultMessage):
            print(f"[{m.subtype}] turns: {m.num_turns}")
            print("answer:", m.result)
    print("audit:", audit)


asyncio.run(main())
Quick checkWhich job is the Claude Agent SDK an especially natural fit for?
How sure are you?
Pick an answer and how sure you are