TOOL WIKI · OBSERVABILITY

Pydantic Logfire

Provides application observability with integrations for Python and AI workflows.

Download example files Code + setup + checks in a ZIP
Jump to a section 10 sections

EXAMPLE USE CASE

Attach a structured outcome to a support trace

A developer needs evidence of what ran, which child operation failed, and how to turn that failure into a reproducible test.

Input
An order lookup performed inside a named span.
Expected output
A structured status event in the selected Logfire project.
  • Success check: One span contains a structured event with status packed in the selected project.
  • Try a failure: An exported packed event should correspond to the lookup result, not a hardcoded success on an exception path.

Example scope: Actual trace/log export with a synthetic fixture.

Official reference · Pydantic Logfire

WHAT IT ISObservability platform
WHERE IT FITSObservability
SEE HOW THE SYSTEM FITS TOGETHERSELECT A COMPONENT
inputprocessresultcheckoutputAgent runOne trace identityInstrumentationRedacted spans + eventsPydantic LogfireObservability platformInvestigationFollow a failed taskRegression datasetConfirmed failuresOperational decisionFix, release, or alert
  1. Propagate a trace identifier through models, retrieval, and tools.

  2. Capture meaningful timings and outcomes while excluding unnecessary content.

  3. Correlating agent behavior with broader application traces. Inspect the data your instrumentation exports and its retention.

  4. Join parent-child spans and compare observed results with task expectations.

  5. Turn verified failures into repeatable evaluation cases.

  6. Use task success, error rates, latency, and cost to decide what to change.

    Result or stopping point
Pydantic Logfire

Correlating agent behavior with broader application traces. Inspect the data your instrumentation exports and its retention.

Follow the arrows, then select a component to inspect its responsibility. On mobile, downward arrows connect the next step; bent arrows identify branches and return paths. Select a destination to jump to that component.

When to consider it

  • Correlating agent behavior with broader application traces.

A design decision to make

  • Inspect the data your instrumentation exports and its retention.

Prerequisites and setup

  • Python 3.11+ and synthetic fixtures. Managed tracing sends the recorded data to the configured project.
Shell
python3 -m venv .venv
source .venv/bin/activate
pip install logfire
export LOGFIRE_TOKEN="YOUR_PROJECT_WRITE_TOKEN"

Try a small integration

trace.py

Python · trace.py
import os
import logfire

logfire.configure(token=os.environ["LOGFIRE_TOKEN"])
with logfire.span("Read order {order_id}",order_id="A104"):
    status = {"A104":"packed"}.get("A104","not_found")
    logfire.info("Order lookup completed",status=status)
logfire.force_flush()

Run and check the result

Shell
python trace.py
  • One span contains a structured event with status packed in the selected project.
  • A span template keeps the operation name stable while attributes carry the synthetic order ID.

Common failures

  • No trace: check the project/region, credentials, collector protocol and exporter flush before changing instrumentation.
  • Avoid double instrumentation that produces duplicate model spans or conflicting trace providers.

Production decisions

  • Redact keys, private prompts, personal data and sensitive tool results before exporting telemetry. Configure sampling and retention.
  • Connect request, agent, model and tool spans with parent/child trace context. A successful span is not a quality or authorization verdict.

Keep exploring

An evaluation gate for agent releasesThe real cost of an agent run

Explore the same layer

LangfuseLangSmithArize PhoenixOpenTelemetry

Compare candidates on your own workload. This entry describes a product’s role; it is not a claim that products in the category are interchangeable.