# DSPy vs Pydantic AI Harness

> Pydantic AI Harness scores 83.5 (A) 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/dspy-vs-pydantic-ai-harness
- Markdown: https://www.anchorterminal.com/compare/dspy-vs-pydantic-ai-harness.md (~4,250 tokens)
- Slim: https://www.anchorterminal.com/compare/dspy-vs-pydantic-ai-harness.min.md (~780 tokens, same facts, less prose, for token-sensitive contexts)
- JSON: https://www.anchorterminal.com/compare/dspy-vs-pydantic-ai-harness.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-27

Pydantic AI Harness scores 83.5 (A) on agent readiness against DSPy's 68.3 (B), and leads in 4 of 7 scored categories. Both do agent frameworks.

- DSPy: grade B, 68.3/100, rank #431 of 1698. Markdown https://www.anchorterminal.com/tools/dspy.md · JSON https://www.anchorterminal.com/api/v1/tools/dspy.json
- Pydantic AI Harness: grade A, 83.5/100, rank #15 of 1698. Markdown https://www.anchorterminal.com/tools/pydantic-ai-harness.md · JSON https://www.anchorterminal.com/api/v1/tools/pydantic-ai-harness.json
- Best agent frameworks and SDKs: https://www.anchorterminal.com/best/frameworks/index.md
- All 276 frameworks comparisons: https://www.anchorterminal.com/compare/frameworks/index.md

## Which one, for what

### DSPy (B)

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

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

### Pydantic AI Harness (A)

Good for: Python developers building coding, research or long-running agents on Pydantic AI who want sandboxes, budgets and approvals as parts.

Ahead on:
- Schema & documentation, 98 against 71
- Agent ergonomics, 89 against 64
- Security & auth, 85 against 60
- Transparency & trust, 82 against 52

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

Watch for: 0.76.0 and classed Alpha. Minor releases may rename parameters or change defaults


## Why the edge

### Transparency & trust: Pydantic AI Harness +30

- 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.
- Pydantic AI Harness (82): MIT, with third-party notices in the package (30). The docs say where Harness files go (`.pydantic-ai-harness/` in the workspace, git-ignored) and which stores sit on the agent's machine, and the threat model says computer use sends screenshots, secrets included, to the model provider. Pydantic's privacy policy covers its hosted services (22 of 30). The 0.x policy promises deprecation warnings where practical and migration guidance in release notes, and sets the rules from 1.0, with no dated notices (14 of 20). No telemetry of its own, and instrumentation is opt-in and documented (18 of 20). 30+22+14+18 = 84.

### Schema & documentation: Pydantic AI Harness +27

- 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.
- Pydantic AI Harness (98): Framework reading. Typed package (`Typing :: Typed`), with about 280 API reference blocks across the capability pages (25). About 96 Harness pages in pydantic.dev's llms.txt, each with a Markdown twin (10). Each capability page sets out the problem and the solution, the README maps problems to capabilities, and the docs say plainly what isn't a boundary (`LocalWorkspace` isn't a sandbox, Bubblewrap is best effort, command patterns are a convenience) (19 of 20). Capabilities are typed classes with named modes (`'full'`, `'auto'`, `'read-only'`) and documented defaults (14 of 15). Examples on every page, and named exceptions such as `OutputBlocked`, `LoopDetectedError` and `UsageLimitExceeded` (15). A version policy and Harness entries in the shared changelog (15). 25+10+19+14+15+15 = 98.

### Agent ergonomics: Pydantic AI Harness +25

- 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.
- Pydantic AI Harness (89): Framework reading. A coding agent is an `Agent` with `LocalWorkspace('.')` and `Coder()` in its capabilities, MCP comes from core, and hosted MCP integrations such as GitHub, Linear and Slack are capabilities of their own (23 of 25). `ToolOutputLimits` spills results of 10,000 characters or more to a file, and `SpendLimits`, `ToolBudgets`, `ReportRemainingBudget` and `DetectLoops` bound runs (20). `ReportToolErrors` turns exceptions into tool results the model can act on, `RepairToolArguments` fixes malformed JSON, and a run without a workspace fails at its start saying what to attach (19 of 20). Step persistence, Temporal and DBOS extras and Absurd, pgtask, Lambda and Azure Durable Task pages (18 of 20). Sensible defaults, but Python only, as for pydantic-ai (9 of 15). 23+20+19+18+9 = 89.

### Security & auth: Pydantic AI Harness +25

- 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.
- Pydantic AI Harness (85): Framework reading (telemetry defaults, approval hooks, guardrails, sandboxing). The Harness sends nothing of its own, and tracing goes through core's opt-in instrumentation. `FileSystem` keeps secrets and `.git` read-only by default and checks path traversal, and `Shell` can strip LLM credentials from command environments, which the docs call coarse (27 of 30). `Permissions` with `full`, `auto` and `read-only` modes, Approval Reviewer, Tool Call Judge and Deny Unanswered, and twelve workspace backends, but `full` is the default and `Coder`'s shell has no allowlist (17 of 20). A Prompt Injection Defender (report-only unless `block_high_risk=True`), output guardrails, and workspace authority that keeps files below operator authority out of the instructions (13 of 15). OpenTelemetry spans for every model and tool call through core, plus trajectory and artifact-scanning capabilities (13 of 15). A valid security.txt and GitHub private reporting, a threat model that covers the Harness, and one moderate advisory, GHSA-3589-pxp7-3gj8, published with a fix in 0.59.0 on 21 October 2026 (15 of 20). No bounty found. 27+17+13+13+15 = 85.

## Score by category

| Category | Weight | DSPy | Pydantic AI Harness | Edge |
| --- | --- | --- | --- | --- |
| Reliability | 16% | 62 | 61 | DSPy +1 |
| Performance | 10%, pending | pending | pending | not scored in this run |
| Schema & documentation | 13% | 71 | 98 | Pydantic AI Harness +27 |
| Agent ergonomics | 13% | 64 | 89 | Pydantic AI Harness +25 |
| Security & auth | 14% | 60 | 85 | Pydantic AI Harness +25 |
| Payments & pricing | 10% | 90 | 90 | even |
| Task success | 10%, pending | pending | pending | not scored in this run |
| Maintenance & community | 7% | 87 | 87 | even |
| Transparency & trust | 7% | 52 | 82 | Pydantic AI Harness +30 |
| Negative events | ≤15 | 0 | 0 | |
| **Total** | | **68.3 · B** | **83.5 · A** | |

## Facts side by side

| Fact | DSPy | Pydantic AI Harness |
| --- | --- | --- |
| Kind | Agent framework | Agent framework |
| Vendor | Stanford NLP | Pydantic |
| Hosted endpoint | no (local only) | no (local only) |
| Transports |  |  |
| Auth | None | None |
| Pricing | Free | Free |
| x402 | no | no |
| Licence | MIT | MIT |
| Read-only variant documented | no | yes |
| llms.txt | no | yes |
| Last release | 2026-11-10 | 2026-11-27 |
| Terms last updated | no document linked | no date given |
| Privacy policy last updated | no document linked | 2024-02-21 |
| Customer content may train models | not read yet | not found in the text |
| Terms restrict automated access | not read yet | not found in the text |
| Terms restrict benchmarking | not read yet | yes |
| Terms or service can change without notice | not read yet | not found in the text |
| Arbitration or class-action waiver | not read yet | yes |
| Popularity | 39k stars | none |

## Verdicts

**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.

**Pydantic AI Harness.** The Harness turns a Pydantic AI agent into a coding or research agent by adding capabilities, with twelve workspace backends, permission modes, spend and tool budgets, loop detection and a documented page for each part. It is 0.x and classed Alpha, minor releases may break APIs, and `Coder`'s shell is unrestricted unless you attach a sandbox or permissions.

## Before you call either

### 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

### Pydantic AI Harness

1. Attach a workspace capability. Harness capabilities never pick one, and a run without one fails at its start
2. Use a sandbox capability instead of `LocalWorkspace` for model-written commands. `LocalWorkspace` runs them on your machine as you
3. Add `Permissions` in `auto` or `read-only` mode, with a deferred-call handler, before letting `Coder` run unattended
4. Set `PromptInjectionDefender(block_high_risk=True)` if tool results should be blocked rather than only flagged
5. Pin the Harness and Pydantic AI together and read the release notes before a minor upgrade. 0.x minors can break APIs

## Questions

### Which is better for AI agents, DSPy or Pydantic AI Harness?

Pydantic AI Harness scores 83.5 (A) on agent readiness against DSPy's 68.3 (B), and leads in 4 of 7 scored categories.

### Are DSPy and Pydantic AI Harness open source?

Yes. DSPy is open source (MIT). Pydantic AI Harness is open source (MIT).


## For agents

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

## Other comparisons with DSPy or Pydantic AI Harness

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

---

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