Typed tools validate parameters before code runs; switching models takes one string change, but proving safety requires evals and version pinning.

Key takeaways

  • Pydantic AI validates tool parameters against a schema before code runs, and switching models requires changing only one string.
  • Pydantic Evals is a standalone package that doesn't depend on pydantic-ai. It tests agent behavior the way pytest tests code.
  • v2 changed the meaning of the openai: model name and shortened the no-breaking-changes window between major versions from 6 months to 3 months, so pin your versions.

Imagine you're embedded at a logistics company. An agent that reads complaint emails has run smoothly through a two-week demo. One morning, it calls the order lookup tool and passes an entire sentence as the order number, and the backend returns a 500 error. Pydantic AI was built to catch exactly this kind of error early.

Pydantic AI positions itself as a Python SDK for AI, centered on a typed, extensible agent loop where switching models requires changing only one string. It's developed by the team behind Pydantic and released under the MIT license. Its GitHub repository sums it up in one sentence: every model, every interface is end-to-end typed.

For a Forward Deployed Engineer (FDE), the value lies in the word "typed". On-site at a customer, the challenge is rarely writing better prompts; it's wiring the agent into the customer's real systems, and those systems reject malformed data.

Where do types catch errors?

Pydantic AI enforces types in three places: structured output, typed dependency injection, and typed tools. Tools are the most critical one. Parameters generated by the model are validated against a schema before the code runs.

Back to the logistics example. You declare a tool

tra_don_hang

(order lookup) that accepts an order number in a fixed format. When the model passes the entire sentence "my order is late", validation intercepts it before the request reaches the customer's API. The error happens inside the agent, where you still have a chance to handle it, instead of showing up in the customer's ops logs.

Output works the same way. You can require the agent to return a ticket with three fields: issue type, order number, and priority. The receiving end is the customer's ticketing system, which needs exactly those three fields, not a paragraph of text. The data contract is written in Python, so the customer's engineers can read it directly instead of guessing from prompts.

Switching models takes one string; validating that switch takes a set of evals

When a customer asks "can we use a cheaper model?", switching models with one string is indeed convenient. But convenient doesn't mean safe. To answer this question seriously, you need a measurable number, and Pydantic Evals is the tool for measuring it.

Pydantic Evals is a standalone package that can be installed separately with pip or uv and doesn't depend on pydantic-ai. This means it can also be used for AI systems not built on Pydantic AI. If you want to visualize results, you can optionally install the Logfire dependency.

Evals organizes tests in a simple way. A Dataset contains multiple Cases, and each Case is a test scenario. The Task is the thing being run, here the agent. An Evaluator analyzes and scores the Task's output on each Case. The Pydantic team likens it to how pytest tests code, and you should treat it that way in practice.

What does a small eval set look like?

Suppose you get 30 real, anonymized customer emails. Each email forms a Case, paired with the correct ticket assigned by a support agent. The Evaluator checks two things: whether the extracted order number matches, and whether the priority is correct. The numbers below are hypothetical, for illustration.

ConfigurationCases passed / 30Pass rate
Current model2790%
Customer's proposed cheaper model2480%

The cheaper model fails 3 more Cases, meaning 3 more wrong tickets per 30 emails. Now the customer can judge for themselves whether the savings are worth those 3 extra wrong tickets. Without this table, you can only go on gut feeling; with it, the meeting shifts from arguing over impressions to discussing trade-offs.

At the customer's site, the first thing to do is ask for data to build a Dataset, even before writing the agent. 30 correctly labeled Cases are worth more than any demo.

Limitation: the API changes faster than you think

v1 was released on September 4, 2025, promising no breaking changes for at least 6 months. It introduced durable execution: an agent that crashes midway through a complex workflow can resume exactly where it stopped. For long-running enterprise processes, this feature is worth trying.

But the release cadence is fast. In Douwe Maan's June 23, 2026 article introducing v2, the concept of capability was introduced, bundling instructions, tools, hooks, and model settings into one composable unit.

v2 also brings a breaking change that can fail silently:

openai:

model names now use the Responses API; to keep using Chat Completions, you must change it to

openai-chat:

. The no-breaking-changes window between major versions has also been shortened from 6 months to 3 months.

The latest version on PyPI is 2.54.0, released on October 3, 2026, requiring Python 3.10 or higher. The lesson for FDEs: always pin versions in customer projects, and rerun the eval set on every upgrade. The same eval set serves both to compare models and as a safety net for upgrades.

What to learn first, and what to put on your resume

If you already know Pydantic through FastAPI, you're halfway there. The learning order is: structured output first, then typed tools, then dependency injection, and only then v2's capability. Also, write your first eval set in the first week, not at the end of the project.

When reading job descriptions for FDE or AI engineer roles, watch for phrases like "evaluation", "structured output", and "production agent". Writing "used Pydantic AI" on a resume says little. Writing "built a Dataset of 30 Cases and found before a replacement model went to production that it dropped the pass rate by 10 percentage points" shows recruiters you work the FDE way.

This library will keep changing. The way of working it advocates is worth keeping: define data in code, measure behavior with evals, and only then switch models.

Was this article helpful?

Thanks for your feedback!

6 sources

Next on the roadmap · Phase 3: AI applicationsn8n can put on a demo in half a day; the hard part is knowing when to leave itThe Code node's limitations, license scope, and extensibility determine whether drag-and-drop workflows can survive production at a customer site.