mrkeyoor.com_
Sat 19 Sept 06:39 UTC
LLM Toolsevaluationupdated 19 Sept 2026

pydantic-ai review

Pydantic AI is a Python library for building agents that call models and tools while checking inputs and outputs with Pydantic types. It gives one agent definition several front ends, including ordinary Python calls, a CLI, web chat, realtime voice, and durable job runners.

Verdict

Our Pydantic AI run installed 122 packages in 23 seconds and built in 3 seconds, but its test command stopped after 2 seconds because pytest_mock was missing. Use it when typed Python boundaries, provider choice, and agent testing matter enough to justify a fast-moving adapter layer. Choose a narrower SDK for one-provider applications or a plain model call.

We ran it

Lab card: what happened when we ran pydantic-aiScreenshot of pydantic-ai (pydantic.dev/pydantic-ai)
Install✓ · 23s122 packages · 140 MB
Build✓ · 3s
Tests✗ · 2sran, no count parsed
Known vulns0(pip-audit)
Repo2807 files~529,708 lines of source · 264.9 MB · 33 CI workflows · tests dir

Answers from our run

Does pydantic-ai build from source?

Dependencies installed in 23 seconds (122 packages), and the build succeeded in 3 seconds. We cloned commit c93306e into a clean Debian container with 3 CPUs and no project-specific setup.

Do pydantic-ai's tests pass?

The test command failed in our container, and its output did not report a pass or fail count.

Does pydantic-ai have known vulnerabilities in its dependencies?

pip-audit found none in the dependency tree at the time of our run.

Who should not use pydantic-ai?

Contributors expecting a fresh checkout to pass its suite after the measured install: our test command stopped in 2 seconds because pytest_mock was missing.

What are the alternatives to pydantic-ai?

LangGraph, OpenAI Agents SDK, Google Agent Development Kit. Our Pydantic AI run installed 122 packages in 23 seconds and built in 3 seconds, but its test command stopped after 2 seconds because pytest_mock was missing.

Setup3/523-second install, but the checkout test command missed pytest-mock
Docs5/5Provider, testing, deployment, and integration paths are specific
Community5/520,035 stars with same-day pushes, releases, issues, and PRs
Maturity4/5v2.46.0 is broad and active; provider compatibility still moves fast

Who it’s for

Python teams that already use Pydantic and want model output checked against application types.
Developers who need to switch among hosted and local model providers without rewriting the agent loop.
Product teams that need tool calling, MCP clients, test doubles, tracing, or durable background runs in one codebase.
Platform engineers willing to choose provider extras and own the credentials, rate limits, and deployment around the agent.

Who it’s NOT for

Contributors expecting a fresh checkout to pass its suite after the measured install: our test command stopped in 2 seconds because pytest_mock was missing.
Teams making one plain model call with no tools or typed output: our default install pulled 122 packages and used 140 MB, though the project offers a slim package.
Operators who require a repository-supplied container recipe: our scan found no Dockerfile among 2,807 files.
Teams depending on identical behavior across generic OpenAI-compatible endpoints: open issue #8525 documents a DeepSeek thinking-field mismatch in Pydantic AI 2.42.0.

Setup reality

Our sandbox install at commit c93306e succeeded in 23 seconds, adding 122 packages and 140 MB. The build passed in 3 seconds. Tests failed with exit code 4 after 2 seconds because pytest_mock could not be imported. Pip-audit found 0 known vulnerabilities.

Python 3.10 or newer is required. A useful agent also needs a model provider and its credentials, unless you use a local provider or the built-in test model. The default package includes several provider SDKs and integrations; pydantic-ai-slim lets you install selected extras.

The checkout measured 2,807 files, about 529,708 source lines, and 264.9 MB before installed packages. It has 33 CI workflow files and a tests directory, but no Dockerfile. Minimal containers and corporate proxies may need system CA certificates because supported clients use the operating system trust store.

Typed outputs are the reason to choose Pydantic AI

Pydantic AI v2.46.0 makes the most sense when an agent has to return data that the rest of a Python application can trust. An output type can be a Pydantic model, and function annotations become the schema used for tool arguments. Dependencies travel through a typed run context. That keeps validation beside ordinary application code instead of burying it in prompt instructions. If your team already treats Pydantic models as contracts at API boundaries, the agent layer feels familiar.

The library now covers much more than a typed chat loop. The README describes CLI and web interfaces, realtime voice, image generation, embeddings, MCP, OpenTelemetry instrumentation, and durable execution through 7 engines. Pydantic Graph and Pydantic Evals are separate packages for control flow and behavioral tests. That breadth is useful when one agent must move between an HTTP request and a background queue. It also means adopting the whole stack is a larger decision than adding one model SDK.

Seventeen provider families share one agent interface

The current provider guide lists 17 named families, including OpenAI, Anthropic, Gemini, Bedrock, Mistral, Ollama through an OpenAI-compatible path, and several others. A string such as openai:gpt-5.2 selects a model class, provider, and profile. The profile records differences such as tool support and accepted JSON Schema features. Swapping that string is convenient, but applications should still test the exact provider and model combination they plan to ship.

That warning has a concrete example. Open issue #8525 reports that Pydantic AI 2.42.0 could produce a mixed thinking history that DeepSeek rejected through a generic OpenAI-compatible endpoint. The report includes a workaround and a proposed fix. Release v2.46.0 also fixed Bedrock tool-choice handling and gateway IDs misclassified as OpenAI o-series models. A shared interface reduces rewriting; it cannot erase differences in vendor request formats.

What happened when we ran it

Our run at commit c93306e installed 122 packages in 23 seconds and occupied 140 MB. The build completed in 3 seconds. Pip-audit reported 0 known vulnerabilities in the installed environment. Our measurement setup was an unprivileged Debian container with 3 CPUs, 8 GB of RAM, Python 3.12, and no secrets, so these results cover repository setup rather than a paid model call.

The test command failed with exit code 4 after 2 seconds, before collecting the suite. The final log says tests/conftest.py imported MockerFixture, then Python raised ModuleNotFoundError: No module named 'pytest_mock'. That log establishes the missing module and nothing more. It does not show whether the checkout metadata, the install command, or another setup choice should have supplied it, so we would not call the repository tests passing on this setup.

The source checkout itself was substantial: 2,807 files, roughly 529,708 lines of source, and 264.9 MB. We found 33 CI workflow files and a tests directory, but no Dockerfile. Those numbers explain why the 3-second build is only part of the contributor experience. They also make the missing test dependency worth fixing or documenting, since a new contributor can reach the test command quickly and still stop before one test runs.

The slim package is the sensible production default

The regular pydantic-ai install includes libraries for 3 major hosted providers plus the CLI, MCP, evals, web UI, and Logfire integrations. That convenience produced 122 installed packages on our box. Teams that know their provider should start with pydantic-ai-slim and add only the matching extras. It gives up the everything-ready default in exchange for a dependency set that better matches the service being deployed.

Container work needs one detail that is easy to miss. Pydantic AI requires Python 3.10 or newer, and its own HTTP requests use the operating system trust store. A minimal image may need the ca-certificates system package, while a corporate proxy may require its private root certificate. Since the repository has no Dockerfile, your team owns that base image, certificate setup, provider credentials, and any local model process.

Two local model doubles make agent code testable

The testing guide provides 2 local stand-ins: TestModel generates schema-valid data and calls registered tools, while FunctionModel lets a test decide the response and tool arguments. Agent.override can replace the production model, and ALLOW_MODEL_REQUESTS=False blocks accidental calls to non-test models. These are good seams for checking application control flow without spending tokens or accepting network variability in every unit test.

Neither stand-in reproduces a provider. The guide says TestModel uses procedural Python and cannot emulate provider-executed native tools. A sensible suite therefore has two levels: fast local tests for tool routing and output validation, then a smaller set against the exact hosted or local model used in production. The failed repository test run is separate from that application-testing advice; it concerns developing this checkout at commit c93306e.

Same-day releases show activity and adapter churn

GitHub showed 20,035 stars and 918 open issues and pull requests when fetched on September 19, 2026. The last push was that same day, and release v2.46.0 was published on September 19. Recent issue and pull request updates were also arriving within hours. This is plainly maintained software with a large user and contributor queue, not a quiet package that changes twice a year.

Fast maintenance is necessary for this job. Open issue #8535 records a latest-dependency canary failure after AG-UI changed a type and OpenAI added model names that the known-name list lacked. The report says the v2.46.0 release itself was unaffected. That distinction matters: the maintainers are catching upstream drift, while buyers still need version pins and provider-level regression tests. Pydantic AI is a strong fit for typed Python agent systems, provided your team treats its adapters as active dependencies rather than invisible plumbing.

Alternatives

ProjectWhat it isPick it when
LangGraph gh↗A graph-oriented runtime for stateful, long-running agent workflows.pick this instead when explicit graph state, checkpoints, and branching are the main design problem.
OpenAI Agents SDK gh↗A smaller Python agent SDK centered on OpenAI's agent primitives and tracing.pick this instead when OpenAI is your settled provider and a narrower API is more useful than broad provider coverage.
Google Agent Development Kit gh↗Google's Python framework for composing and operating agents across its model and cloud stack.pick this instead when Gemini and Google Cloud services already define your deployment.

What people are saying

  1. [velocity-scout] pydantic/pydantic-ai

Sources

  1. Pydantic AI repository and README
  2. Pydantic AI installation guide
  3. Pydantic AI model provider guide
  4. Pydantic AI testing guide
  5. Pydantic AI v2.46.0 release
  6. OpenAI-compatible thinking history issue #8525
  7. Latest-dependency canary issue #8535

More llm tools reviews

cc-haha · agent-lightning · harness-sdk · 12306-mcp · ouroboros · headcount · the whole board →