In short.
This Pydantic documentation guide helps Python developers connect Pydantic Evals (pydantic-evals), a Python package for evaluating AI agents or other task functions against datasets of test cases, to Pydantic Logfire, a hosted, OpenTelemetry-compatible service with a web interface for viewing traces. Traces can include sensitive inputs, outputs and execution details. It provides setup examples and a detailed reference for evaluation spans, result attributes, failures and CI provenance. Its strongest use is connecting evaluation results to what happened inside a task. Prices, licensing and data-handling terms are unknown from the page, and runtime behavior has not been assessed.
Researched and written by an AI model and checked by a second AI model. How it works
Coverage includes the complete text of [https://pydantic.dev/docs/ai/evals/how-to/logfire-integration/index.md], including introductory documentation notices, installation, configuration, examples, CI provenance, span reference, troubleshooting and best practices. Linked pages, the documentation index, screenshot image files, package source and service terms are excluded. Nothing was executed. Runtime compatibility, actual exports, UI behavior and performance remain unassessed; missing pricing, licensing and data-handling details remain unknown.
The overview
Identity
Logfire Integration is a Pydantic documentation guide explaining how to visualize and analyze Pydantic Evals results using Pydantic Logfire. It combines a setup tutorial with an OpenTelemetry span reference at [https://pydantic.dev/docs/ai/evals/how-to/logfire-integration/index.md].
Assessment
The guide is useful when an evaluation score does not explain why a case failed or where execution time went. It describes how to move from an evaluation overview to case inputs, outputs and the underlying task trace.
Run comparison is illustrated through timestamp or attribute filtering. CI provenance adds code-revision context, but the page does not demonstrate automatic regression gates, measured debugging improvements or performance gains.
Users
The main audience is Python developers maintaining evaluations for AI agents or other task functions. The documented views address failed cases, slow execution and tool-use patterns; the CI details also serve teams comparing evaluations across commits.
Beginners will benefit from familiarity with Python functions, evaluation datasets and evaluators. Developers building dashboards or trace-processing tools get additional detail about span names, attribute encodings and failure behavior.
Capabilities
The documented Logfire interface offers an evaluation table with case names, pass/fail status, scores, assertions, duration, filtering and sorting. Individual cases expose inputs and outputs, while the trace view shows recorded operations within the task.
Trace data includes evaluation metadata, expected outputs, result reasons when present and evaluator failures. Span-based evaluators can inspect ctx.span_tree; the guide illustrates HasMatchingSpan for checking whether a named operation occurred.
GitHub Actions and GitLab CI runs can receive commit, branch, pull-request or merge-request, repository and CI-run attributes when those values are known. Explicit environment variables can override commit and branch detection.
Using it
Requirements
The setup requires a Python environment with Pydantic Evals and its optional Logfire dependency. The uvx command must be available for the documented sign-in step; the page gives no instructions for installing it. Hosted use requires signing in, choosing or creating a Logfire project, configuring the integration and providing LOGFIRE_TOKEN. Network connectivity is also needed to send traces.
Detailed task visibility depends on the relevant instrumentation being enabled. The page names Pydantic AI and HTTPX instrumentation. Minimum Python and package versions, operating-system support and hardware requirements are not specified.
Mechanism
OpenTelemetry records operations as spans. An evaluate {name} root contains case spans, with task execution and evaluator spans beneath each case; report-evaluator spans sit directly beneath the root. Evaluation spans use the pydantic-evals instrumentation scope, while task spans retain their own scopes.
Boolean evaluator results become assertions, numeric results become scores and string results become labels. Result objects include evaluator-source and version information. Complex attribute values are stored as JSON-encoded strings, described by logfire.json_schema.
With repeat, case spans have run-indexed names while n_cases still counts the original dataset cases. With retry_task, each task attempt receives its own execution span. Task exceptions appear on task and case spans; evaluator exceptions appear on evaluator spans. Online evaluation uses gen_ai.evaluation.result log events instead of this span structure.
Setup
The documented installation command is pip install 'pydantic-evals[logfire]'. The sign-in and project-selection step is uvx logfire-cli wizard --task pydantic-ai, run once from the project.
Configure Logfire before running evaluations with logfire.configure(send_to_logfire='if-token-present'). This setting sends data to Logfire only when LOGFIRE_TOKEN is present. The guide also shows service_name and environment settings for identifying runs.
For missing data, the troubleshooting guidance covers token availability, configuration, connectivity and the destination project. Missing task spans call for checking configuration order and enabling the instrumentations needed by the task.
Example
The basic example creates one case with inputs='example', defines a function that returns f'result for {inputs}', and calls dataset.evaluate_sync(my_task). It illustrates integration setup without an explicit quality evaluator or model call.
The span-based example configures HasMatchingSpan with query={'name_contains': 'search_tool'} and evaluation_name='used_search'. Its sample task only returns a string and shows no tool call or matching span, so it does not demonstrate a successful tool-use assertion.
The two-run comparison example changes the returned text between original_task and improved_task. Those names do not establish a measured quality improvement. None of these examples was executed.
Assessment & evidence
Limitations
The documented export includes inputs, outputs, expected outputs, metadata and task traces that may cover tool calls, API calls and database queries. These can contain sensitive information. The page does not establish redaction guarantees or precise payload-capture boundaries.
CI provenance is conditional: attributes are added only when their values are known and the experiment span is recording. An unreadable GitHub pull-request payload causes the commit to be omitted. Some workflow events also omit commit and branch because their default environment values may identify different code from the checkout.
The guide warns that span attributes may change in minor releases. Custom queries, dashboards and trace consumers therefore depend on a schema whose compatibility is not guaranteed across those releases.
Reasoning
The practical value follows from connecting case results to execution details: a failed assertion can be investigated alongside the operations that produced it. This makes the guide a useful starting point for diagnosing evaluation failures and investigating duration.
Its usefulness depends on meaningful cases and evaluators, sufficient instrumentation and whether the relevant data can be sent to the chosen backend. Trace visibility alone does not establish evaluator validity or agent reliability.
Alternatives
The page explicitly says Pydantic Evals traces can be sent to any OpenTelemetry-compatible backend. It does not name another backend or establish that other destinations provide equivalent evaluation tables, case views or comparison features.
The examples also retain the report returned by dataset.evaluate_sync. The page does not compare using that report with using a hosted trace interface, and supplies no comparative pricing or usability evidence.
Evidence
The evidence is the complete first-party documentation text at [https://pydantic.dev/docs/ai/evals/how-to/logfire-integration/index.md], captured as selected-page.txt on 2026-11-15T07:16:36.305Z. Its source revision is sha256:31d96334062bb49a3d4b7774e224bdc74c6ea78fbb003dfe582f8ded719fb8b6.
It contains setup instructions, illustrative code, UI descriptions and a span reference. It supplies no independently observed execution results or benchmarks. Screenshot files and linked documentation were not available as evidence; no commands, examples or UI interactions were run.
Access & freshness
Costs
The page supplies no Logfire prices, free allowances, billing rules or retention limits, so hosted cost is unknown. It provides no measurements of tracing overhead or resource consumption. Costs for any model, API or infrastructure used by a real task are also unspecified.
Rights
The page does not establish documentation or software licensing, or permission to redistribute its text and examples. Logfire terms governing data ownership, retention, residency and access are also unknown from this evidence.
Freshness
The capture date identifies this documentation snapshot, rather than a software release. The page states no package version, publication date or last-update date, so exact version compatibility and later behavior are unknown. Its warning about minor-release span changes is particularly relevant to integrations built against the attribute reference.
Actions
Start with a small synthetic dataset, follow the installation and project-configuration steps, and confirm that case details and required task spans appear in the intended project. Match span-based evaluators to operations that the actual task emits.
For CI comparisons, confirm that the recorded commit matches the checked-out code. Where automatic detection is insufficient, use PYDANTIC_EVALS_GIT_COMMIT_SHA and PYDANTIC_EVALS_GIT_BRANCH to supply the correct values.
Before adopting the hosted integration for real datasets, establish pricing, data-handling terms and applicable licences. Check the installed version's span attributes before relying on custom queries or dashboards.
