Evals

Pydantic AI

Status of Pydantic AI support in Viewport Evals. The adapter is designed but deferred past 0.1.

Adapter status: Planned. There is no Pydantic AI adapter in 0.1, and no Pydantic AI example in the repository.

What is designed

Pydantic AI has no global registry for hooks, and Agent.instrument_all() would override your own Logfire setup, so the adapter is designed as one explicit line: a capability you add to the agent, Agent(..., capabilities=[capture()]). It would record each model request with usage (cache reads and writes included) and the provider response id, each tool execution with its error, and run errors. A script(...).pydantic_ai() fake built on Pydantic AI's FunctionModel would run the real agent with no keys.

What you can do today

Everything in Viewport Evals that does not depend on the adapter works with any Python code:

  • Wrap the provider client your Pydantic AI model uses with wrap(...) from viewportai.evals.anthropic or viewportai.evals.openai. This path is not tested with Pydantic AI in 0.1, so verify that t.model_calls holds the calls you expect before you rely on it.
  • Record tool calls by building tools with Viewport Core's @tool, or fake them with fake_tool.
  • Assert on the output you get back from agent.run(...), including with judges.

Follow the repository for the adapter.

On this page