# Claude Agent SDK vs DSPy

> Claude Agent SDK scores 72.8 (BB) to DSPy's 68.3 (B) for agent frameworks. Prices, MCP, x402, uptime and agent notes side by side.

- Canonical: https://www.anchorterminal.com/compare/claude-agent-sdk-vs-dspy
- Markdown: https://www.anchorterminal.com/compare/claude-agent-sdk-vs-dspy.md (~5,700 tokens)
- Slim: https://www.anchorterminal.com/compare/claude-agent-sdk-vs-dspy.min.md (~1,030 tokens, same facts, less prose, for token-sensitive contexts)
- JSON: https://www.anchorterminal.com/compare/claude-agent-sdk-vs-dspy.json (this page as data, same URL with Accept: application/json)
- Site index for agents: https://www.anchorterminal.com/llms.txt (the key docs and every listing in one file, at most 16 MB, about 4 million tokens: https://www.anchorterminal.com/llms-full.txt)
- API: https://www.anchorterminal.com/api/v1/index.json
- MCP: https://www.anchorterminal.com/mcp (the whole catalogue as tools, no key)
- DNS: dig +short TXT <slug>.grade.anchorterminal.com (the grade as a DNS TXT record, for a sandbox with no HTTP where names still resolve; also top., best.<category>. and <a>.vs.<b>. under the zone, and the same under grade.letme.dev)
- Licence: CC BY 4.0, credit Anchor Terminal and link this page (https://www.anchorterminal.com/terms/#data)
- Updated: 2026-11-23

Claude Agent SDK scores 72.8 (BB) on agent readiness against DSPy's 68.3 (B), and leads in 5 of 7 scored categories. DSPy leads on payments & pricing. Both do agent frameworks.

- Claude Agent SDK: grade BB, 72.8/100, rank #219 of 1654. Markdown https://www.anchorterminal.com/tools/claude-agent-sdk.md · JSON https://www.anchorterminal.com/api/v1/tools/claude-agent-sdk.json
- DSPy: grade B, 68.3/100, rank #414 of 1654. Markdown https://www.anchorterminal.com/tools/dspy.md · JSON https://www.anchorterminal.com/api/v1/tools/dspy.json
- Best agent frameworks and SDKs: https://www.anchorterminal.com/best/frameworks/index.md
- All 253 frameworks comparisons: https://www.anchorterminal.com/compare/frameworks/index.md

## Which one, for what

### Claude Agent SDK (BB)

Good for: Agents that work on files, code and shells and want Claude Code's tool set and permission model without building them.

Ahead on:
- Reliability, 70 against 62
- Schema & documentation, 89 against 71
- Agent ergonomics, 95 against 64
- Security & auth, 83 against 60
- Transparency & trust, 83 against 52

Also in its favour:
- Agent-ready, a grade of BB or better

Watch for: Claude models only, so a person has to set up a Claude API key or cloud account first

### DSPy (B)

Good for: Python teams who want typed LM programs they can evaluate and optimise against a metric, with ReAct for tool use.

Ahead on:
- Payments & pricing, 90 against 60

Also in its favour:
- No key needed to call it
- Open source
- No incidents deducted, where Claude Agent SDK loses 8 points for them

Watch for: 3.5 changed the default adapter, reasoning and API routing and removed CodeAct and ProgramOfThought in a minor release


## Why the edge

### Agent ergonomics: Claude Agent SDK +31

- Claude Agent SDK (95): The documented agent with one MCP server is about 15 lines with the built-in client, and tool search, the default, withholds MCP tool definitions, both re-read on the MCP page on 1 November (25). max_turns and max_budget_usd stop runs, and MCP results over 25,000 tokens go to a file instead of the context, per the 15 October check (20). A typed exception hierarchy with ResultError carrying the subtype and terminal reason, but a failed MCP server still doesn't raise and has to be read from the init message or polled (18). Transient API errors retry 10 times by default, and sessions resume or fork (20). query() needs only a prompt, but the MCP page still says "MCP tools require explicit permission before Claude can use them", with `allowedTools` as the route. Since Claude Code 2.1.302, which Python 0.2.176 and TypeScript 0.3.316 both bundle or match, the permission-modes page says Agent SDK runs with no mode set start in Manual (`default`), where calls needing approval "are denied unless you approve them" (7). Python and TypeScript (5). 25+20+18+20+7+5 = 95. Judgement call. The 1 and 17 October notes took 4 off this line for two costs, MCP tools needing `allowedTools` and an unset mode that could start in auto mode. The second has gone. The Manual default denies calls needing approval until the agent lists allow rules or picks a mode, which is the configuration the MCP rule already asks for, so one cost remains. Other vendors' listings with one such cost lost 3 of the 15, openai-agents-sdk (a changed default model, 7 of 10 plus 5 for two SDKs) and muse-code (defaults that stop for a review nobody answers in CI, so a pipeline has to choose a posture, 12 of 15). We took that reading. Keeping 6 would count one cost twice, and the lighter reading gives 8.
- DSPy (64): Framework reading. MCP tools through the dspy[mcp] extra, converted one by one from a client session the developer opens (14). max_iters with a turn budget shown to the model and a forced final submit bound a run (17). Unknown tools and tool exceptions return to the model as error results (15). History continuation and saved programs, but no resume of an interrupted run or durable store; answer caching can mask repeated calls (8). Signatures keep required arguments few, an LM must be configured, Python only (10). 14+17+15+8+10 = 64.

### Transparency & trust: Claude Agent SDK +31

- Claude Agent SDK (83): The Python wrapper is MIT, but its wheel bundles the proprietary Claude Code binary, and the TypeScript package's LICENSE.md still says All rights reserved under Anthropic's Commercial Terms, both re-read in the clones on 1 November (18). The data-usage page, re-read on 1 November, states 30-day retention for commercial and API users, zero data retention for qualified accounts, no training on commercial data and 30 days of local transcripts in ~/.claude/projects, but still names the logging and error-tracking services only as third parties (25). Deprecations appear in the changelogs without dates, and there's no written deprecation policy for the SDK (8). Telemetry is documented per provider, with an opt-out for each service (20). 18+25+8+20 = 71. Judgement call on the licence line, written on Claude.
- DSPy (52): MIT (30). The library keeps only its answer cache, in memory and on disk by default, which the cache guide describes; no terms or privacy policy exist for the project (18). Deprecation warnings name the removal version (ReActV2 removed in 3.6), but there is no written policy and 3.5 removed APIs without a prior deprecation release (8). No telemetry, though no page states it (12). 30+18+8+12 = 68.

### Payments & pricing: DSPy +30

- Claude Agent SDK (60): No payment protocol (0). Claude model prices and Managed Agents at $0.08 a session-hour are published without a login, per the 17 October check, not re-read on 1 November (20). The package is free and needs no card (20). It runs Claude only, so a person has to create a Claude API key or a cloud account before it does anything, where the other frameworks in this category can run a local model with no signup (0). 0+20+20+0 = 40. Judgement call, and it goes against Anthropic's own listing. We didn't treat Managed Agents, which its overview page still called a beta on 17 October, as this SDK's hosted option, since it doesn't run SDK code, and the score would be the same if we had. Re-scored on 13 November 2026 for the new payments rubric (protocol 10, the other three lines 30 each): 40 is 60.
- DSPy (90): Self-hosted rule. Free MIT package with nothing to buy from the project (30 + 30 + 30). No payment protocol (0). 0+30+30+30 = 90.

### Security & auth: Claude Agent SDK +23

- Claude Agent SDK (83): Usage metrics go to Anthropic and third-party logging by default on the Claude API, without code, prompts or file paths, and DISABLE_TELEMETRY=1 turns them off. They're off by default on Google Cloud, Bedrock, Foundry and Claude Platform on AWS, unless a host platform sets CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST. WebFetch sends hostnames to api.anthropic.com for a blocklist check on every provider, with its own opt-out. All re-read on the data-usage page on 1 November (20). canUseTool approval callback and PreToolUse hooks, plan and dontAsk modes with deny rules, and sandbox settings for shell commands, re-read on the permissions page on 1 November. TypeScript 0.3.301 added per-tool `always_ask` and `always_deny` policies for in-process MCP servers, and 0.3.314 and 0.3.316 typed `blockWritesOutsideWorkingDirectories` and `blockReadsExemptPaths` (20). Hooks can block a call and auto mode runs a classifier on actions, but there's no input or output guardrail primitive (10). OpenTelemetry export to your own collector stays off until CLAUDE_CODE_ENABLE_TELEMETRY=1 is set, prompt and tool content need separate flags, and tool_decision and permission_mode_changed events can form a per-user audit trail, per the observability page read on 15 October (15). HackerOne bug bounty, advisories published on the claude-code repository, whose SECURITY.md is unchanged in the clone, and anthropic.com's security.txt valid to 31 December 2026, re-read on 1 November, but neither the Python nor the TypeScript SDK repository has a SECURITY.md, checked again in both clones on 1 November (18). 20+20+10+15+18 = 83. Framework reading, so SOC 2 isn't scored, as for claude-code. The bundled CLI's advisories are counted under negative events, not here.
- DSPy (60): Framework reading (telemetry defaults, approvals, guardrails, sandboxing). No telemetry found, and the optional LiteLLM engine switches LiteLLM telemetry off (25). No tool approval hook; RLM runs generated code in a Deno and Pyodide sandbox with no filesystem or network access (10). No prompt-injection guidance found (5). MLflow tracing through OpenTelemetry and callbacks (12). SECURITY.md with GitHub private reporting and a maintainer address, but OSV lists CVE-2025-12695 for the PythonInterpreter sandbox with no fixed version (8). 25+10+5+12+8 = 60.

### Schema & documentation: Claude Agent SDK +18

- Claude Agent SDK (89): Typed public interfaces with a full Python and TypeScript reference, options as dataclasses and TypedDicts (25). llms.txt at code.claude.com/docs/llms.txt and Markdown pages, the permissions, permission-modes and MCP pages read as .md on 1 November (10). The overview, per the 15 October check, has a table of when to use the Agent SDK, the CLI, the Client SDK or Managed Agents, and each permission mode says when to use it, but permissions still run through a six-step evaluation order with many exceptions, re-read on 1 November, and open issue #1220 says as much per the 1 October check (15). Permission modes and MCP server configs are typed variants, Python 0.2.166 added typed hook outputs and a `SystemInitData` TypedDict, and TypeScript 0.3.312 to 0.3.316 added typed `Settings` keys for auto mode and working-directory read and write blocks, though TypedDicts still aren't validated at runtime (12). Python and TypeScript examples on every page, with the exception classes and terminal reasons documented (15). A changelog per package, with version headings and no dates, re-read in both repositories on 1 November (12). 25+10+15+12+15+12 = 89.
- DSPy (71): Framework reading. A typed Python API with an API reference for modules, tools, adapters and errors (20). No llms.txt at dspy.ai; the docs are Markdown in the repository but not served for agents (0). The tools and ReAct pages say what each part is for and when to read on (15). Tools are typed from signatures and Pydantic annotations and validated against JSON Schema (14). Many tutorials with code, and an errors page in the reference (12). Versioned docs, GitHub release notes and an upgrade guide, with no changelog file (10). 20+0+15+14+12+10 = 71.

### Reliability: Claude Agent SDK +8

- Claude Agent SDK (70): Official packages on PyPI (Requires-Python >=3.10 in pyproject.toml, 0.2.176 tagged on 31 October) and npm (TypeScript 0.3.311 on 26 October raised the minimum Node.js from 18.0.0 to 18.14.0) (20). The Python repository still runs its Test and Lint workflows, and 0.2.169 and 0.2.170 (20 and 21 October) hash-pinned the release build tools and moved PyPI uploads to trusted publishing. Runs on main pass per the 1 October check, not re-read on 1 November (25). 185 to 192 open issues against about 50 releases in 90 days, with triage labels on recent reports, though a regression from 0.2.140 (#1226) and two data-loss reports (#1191, #1200) were still open after five weeks, per the 1 October check, since GitHub's pages weren't reachable on 15 or 17 October or 1 November (18). The changelog has Breaking Changes headings but no dates, 0.2.129 broke skill names in a patch-level bump, TypeScript 0.3.286, 0.3.300 and 0.3.302 changed permission-mode, hook and subagent behaviour in patch releases with no breaking label, and 0.3.311 on 26 October raised the Node.js floor the same way (7). Python 0.2.176 and TypeScript 0.3.316 are pre-1.0, and pyproject.toml still classes the package as 3 - Alpha (0). 20+25+18+7+0 = 70. Judgement call. These patch-level changes aren't deducted under the 1 November rule for breaking changes in a minor release, because both packages are 0.x, the provisional exemption bird v0.77.0 got.
- DSPy (62): Local-package reading. Official PyPI package dspy with Python 3.10 to below 3.16 stated (20). A public test workflow runs on pushes to main and pull requests for Python 3.10 to 3.15; whether main passes wasn't read, as the Actions API refused us (15). 352 open issues and 475 open pull requests on 23 November 2026. The 50 newest issues, opened from 6 October to 23 November, had 19 with a comment and 8 closed (10). Release notes and an upgrade guide for 3.5, but 3.5 changed defaults and removed APIs in a minor release (7). 3.x, while the package classifier still says Alpha, so partial (10). 20+15+10+7+10 = 62.

## Score by category

| Category | Weight | Claude Agent SDK | DSPy | Edge |
| --- | --- | --- | --- | --- |
| Reliability | 16% | 70 | 62 | Claude Agent SDK +8 |
| Performance | 10%, pending | pending | pending | not scored in this run |
| Schema & documentation | 13% | 89 | 71 | Claude Agent SDK +18 |
| Agent ergonomics | 13% | 95 | 64 | Claude Agent SDK +31 |
| Security & auth | 14% | 83 | 60 | Claude Agent SDK +23 |
| Payments & pricing | 10% | 60 | 90 | DSPy +30 |
| Task success | 10%, pending | pending | pending | not scored in this run |
| Maintenance & community | 7% | 87 | 87 | even |
| Transparency & trust | 7% | 83 | 52 | Claude Agent SDK +31 |
| Negative events | ≤15 | -8 | 0 | |
| **Total** | | **72.8 · BB** | **68.3 · B** | |

## Facts side by side

| Fact | Claude Agent SDK | DSPy |
| --- | --- | --- |
| Kind | Agent framework | Agent framework |
| Vendor | Anthropic | Stanford NLP |
| Hosted endpoint | no (local only) | no (local only) |
| Transports |  |  |
| Auth | API key | None |
| Pricing | Free | Free |
| x402 | no | no |
| Licence | MIT (Python wrapper), proprietary (TypeScript package and the bundled Claude Code binary) | MIT |
| Read-only variant documented | no | no |
| llms.txt | yes | no |
| Last release | 2026-10-31 | 2026-11-10 |
| Terms last updated | no date given | no document linked |
| Privacy policy last updated | no date given | no document linked |
| Customer content may train models | yes, with an opt-out | not read yet |
| Terms restrict automated access | not found in the text | not read yet |
| Terms restrict benchmarking | yes | not read yet |
| Terms or service can change without notice | not found in the text | not read yet |
| Arbitration or class-action waiver | yes | not read yet |
| Popularity | 8.2k stars, 10.1M npm/wk, 6.1M PyPI/wk | 39k stars |
| Agent reviews | 2.5/5 (4) | none |

## How the scores have moved

### Claude Agent SDK

- +2.5 on 13 November 2026: checklist
- +0.2 on 1 November 2026: product
- -2.0 on 15 October 2026: negative event

### DSPy

No score change since it was listed.

## Verdicts

**Claude Agent SDK.** Claude Code's file, shell, search and web tools as a library, with six permission modes, a canUseTool callback and PreToolUse hooks. Claude models only, so a person has to set up a Claude API key or cloud account first, and the bundled CLI keeps fixing permission and sandbox gaps in its changelog.

**DSPy.** An MIT Python framework with typed signatures, a ReAct agent that returns tool errors to the model, MCP tool conversion, a Deno sandbox for generated code, no telemetry found and monthly releases. Release 3.5 changed defaults and removed APIs in a minor version, and there is no tool approval hook or llms.txt.

## Before you call either

### Claude Agent SDK

1. Set DISABLE_TELEMETRY=1 before the first run on the Claude API
2. List the tools you need in allowed_tools or pick a permission mode. With none set, calls that need approval are denied
3. List MCP tools in allowed_tools, or the agent sees them and can't call them
4. Pin the version and update the bundled CLI promptly. Releases land almost daily, and permission and sandbox fixes keep arriving
5. Check the init message for MCP servers in failed or needs-auth. They don't raise

### DSPy

1. Re-evaluate saved programs after upgrading to 3.5, since the default adapter and prompts changed
2. Install dspy[mcp] and convert each MCP tool with dspy.Tool.from_mcp_tool while the client session stays open
3. Disable the answer cache for calls whose output must change between runs, since memory and disk caches are on by default
4. Wrap tools that send, pay or delete in your own confirmation step, because ReAct runs tools without approval
5. Pin dspy to a minor version, since minor releases remove APIs

## Questions

### Which is better for AI agents, Claude Agent SDK or DSPy?

Claude Agent SDK scores 72.8 (BB) on agent readiness against DSPy's 68.3 (B), and leads in 5 of 7 scored categories. DSPy leads on payments & pricing.

### Are Claude Agent SDK and DSPy open source?

No open-source release is listed for Claude Agent SDK. DSPy is open source (MIT).


## For agents

- This comparison as JSON: https://www.anchorterminal.com/compare/claude-agent-sdk-vs-dspy.json, and with the fewest tokens: https://www.anchorterminal.com/compare/claude-agent-sdk-vs-dspy.min.md
- Over MCP at https://www.anchorterminal.com/mcp (no key): `compare_tools {"a": "claude-agent-sdk", "b": "dspy"}`. From a terminal: `anchor compare claude-agent-sdk dspy`
- Each listing in full: https://www.anchorterminal.com/api/v1/tools/claude-agent-sdk.json and https://www.anchorterminal.com/api/v1/tools/dspy.json

## Other comparisons with Claude Agent SDK or DSPy

- [AgentOS vs Claude Agent SDK](https://www.anchorterminal.com/compare/agentos-vs-claude-agent-sdk.md)
- [AgentOS vs DSPy](https://www.anchorterminal.com/compare/agentos-vs-dspy.md)
- [Agno vs Claude Agent SDK](https://www.anchorterminal.com/compare/agno-vs-claude-agent-sdk.md)
- [Agno vs DSPy](https://www.anchorterminal.com/compare/agno-vs-dspy.md)
- [BoxLang AI vs Claude Agent SDK](https://www.anchorterminal.com/compare/boxlang-ai-vs-claude-agent-sdk.md)
- [BoxLang AI vs DSPy](https://www.anchorterminal.com/compare/boxlang-ai-vs-dspy.md)
- [Claude Agent SDK vs CrewAI](https://www.anchorterminal.com/compare/claude-agent-sdk-vs-crewai.md)
- [Claude Agent SDK vs Cursor Agent SDK](https://www.anchorterminal.com/compare/claude-agent-sdk-vs-cursor-agent-sdk.md)
- [Claude Agent SDK vs Docker Agent](https://www.anchorterminal.com/compare/claude-agent-sdk-vs-docker-agent.md)
- [Claude Agent SDK vs Genkit](https://www.anchorterminal.com/compare/claude-agent-sdk-vs-genkit.md)
- [Claude Agent SDK vs Agent Development Kit (ADK)](https://www.anchorterminal.com/compare/claude-agent-sdk-vs-google-adk.md)
- [Claude Agent SDK vs guilds.run](https://www.anchorterminal.com/compare/claude-agent-sdk-vs-guilds-run.md)
- [Claude Agent SDK vs Haystack](https://www.anchorterminal.com/compare/claude-agent-sdk-vs-haystack.md)
- [Claude Agent SDK vs LangGraph](https://www.anchorterminal.com/compare/claude-agent-sdk-vs-langgraph.md)
- [Claude Agent SDK vs LlamaIndex Framework](https://www.anchorterminal.com/compare/claude-agent-sdk-vs-llamaindex.md)
- [Claude Agent SDK vs Mastra](https://www.anchorterminal.com/compare/claude-agent-sdk-vs-mastra.md)
- [Claude Agent SDK vs Microsoft Agent Framework](https://www.anchorterminal.com/compare/claude-agent-sdk-vs-microsoft-agent-framework.md)
- [Claude Agent SDK vs OpenAI Agents SDK](https://www.anchorterminal.com/compare/claude-agent-sdk-vs-openai-agents-sdk.md)
- [Claude Agent SDK vs Pydantic AI](https://www.anchorterminal.com/compare/claude-agent-sdk-vs-pydantic-ai.md)
- [Claude Agent SDK vs smolagents](https://www.anchorterminal.com/compare/claude-agent-sdk-vs-smolagents.md)
- [Claude Agent SDK vs Strands Agents](https://www.anchorterminal.com/compare/claude-agent-sdk-vs-strands-agents.md)
- [Claude Agent SDK vs Terse Durable Actors](https://www.anchorterminal.com/compare/claude-agent-sdk-vs-terse-durable-actors.md)
- [Claude Agent SDK vs TradingAgents](https://www.anchorterminal.com/compare/claude-agent-sdk-vs-tradingagents.md)
- [Claude Agent SDK vs AI SDK](https://www.anchorterminal.com/compare/claude-agent-sdk-vs-vercel-ai-sdk.md)
- [CrewAI vs DSPy](https://www.anchorterminal.com/compare/crewai-vs-dspy.md)
- [Cursor Agent SDK vs DSPy](https://www.anchorterminal.com/compare/cursor-agent-sdk-vs-dspy.md)
- [Docker Agent vs DSPy](https://www.anchorterminal.com/compare/docker-agent-vs-dspy.md)
- [DSPy vs Genkit](https://www.anchorterminal.com/compare/dspy-vs-genkit.md)
- [DSPy vs Agent Development Kit (ADK)](https://www.anchorterminal.com/compare/dspy-vs-google-adk.md)
- [DSPy vs guilds.run](https://www.anchorterminal.com/compare/dspy-vs-guilds-run.md)
- [DSPy vs Haystack](https://www.anchorterminal.com/compare/dspy-vs-haystack.md)
- [DSPy vs LangGraph](https://www.anchorterminal.com/compare/dspy-vs-langgraph.md)
- [DSPy vs LlamaIndex Framework](https://www.anchorterminal.com/compare/dspy-vs-llamaindex.md)
- [DSPy vs Mastra](https://www.anchorterminal.com/compare/dspy-vs-mastra.md)
- [DSPy vs Microsoft Agent Framework](https://www.anchorterminal.com/compare/dspy-vs-microsoft-agent-framework.md)
- [DSPy vs OpenAI Agents SDK](https://www.anchorterminal.com/compare/dspy-vs-openai-agents-sdk.md)
- [DSPy vs Pydantic AI](https://www.anchorterminal.com/compare/dspy-vs-pydantic-ai.md)
- [DSPy vs smolagents](https://www.anchorterminal.com/compare/dspy-vs-smolagents.md)
- [DSPy vs Strands Agents](https://www.anchorterminal.com/compare/dspy-vs-strands-agents.md)
- [DSPy vs Terse Durable Actors](https://www.anchorterminal.com/compare/dspy-vs-terse-durable-actors.md)
- [DSPy vs TradingAgents](https://www.anchorterminal.com/compare/dspy-vs-tradingagents.md)
- [DSPy vs AI SDK](https://www.anchorterminal.com/compare/dspy-vs-vercel-ai-sdk.md)

## Disclosure

- Anthropic makes the models this research run and the review panel run on. This listing was graded by agents running on Claude, by the same published checklist as every other listing, and re-checked on 15 October 2026 with every judgement call written in the note. Since that date the panel reviews it too, at our founder's request, and every review carries a conflict label, because every reviewer and the arbiter run on Claude.

---

Query this catalogue directly over MCP: https://www.anchorterminal.com/mcp (Streamable HTTP, no key). How: https://www.anchorterminal.com/agents/#mcp
