Skip to main content
To trace PydanticAI with HoneyHive, install honeyhive and pydantic-ai, call HoneyHiveTracer.init(), run Agent.instrument_all(), and use your existing agent code unchanged. See the tracing quickstart and tracer initialization guides for setup details. PydanticAI is a Python agent framework from the Pydantic team, built for type-safe LLM applications with dependency injection, structured outputs, and multi-agent support. HoneyHive integrates with PydanticAI via its native OpenTelemetry support, automatically capturing agent runs, tool calls, and LLM interactions.

How do I trace Pydantic AI with HoneyHive?

Add HoneyHive tracing in just 3 lines of code. Initialize the tracer and call Agent.instrument_all(), and all agent runs, tool calls, and model calls are automatically traced.
To see where to initialize the tracer for your environment, including AWS Lambda and long-running servers, see Tracer Initialization.
Last tested with pydantic-ai 1.90.0 (May 2026). Requires PydanticAI 1.x (v3 OTel attributes) — earlier versions used different span attribute names and tool inputs/outputs will appear empty in the HoneyHive UI.

What Gets Traced

The instrumentation automatically captures:
  • Agent runs - Every agent invocation with inputs and outputs
  • LLM calls - Model requests, responses, and token usage
  • Tool calls - Each tool execution with arguments and results
  • Multi-turn conversations - Message history across turns
  • Streaming - Streamed responses captured as complete traces
No manual instrumentation required.

Example: Single Agent with Tools


Example: Multi-Agent Delegation

In HoneyHive, you’ll see the full trace hierarchy including coordinator agent, delegated policy specialist calls, and tool executions.

Troubleshooting

Traces not appearing

  1. Check environment variables — Ensure HH_API_KEY is set
  2. Call instrument_all() before running agents — Instrumentation must be active before agent execution:
  1. Check your model provider — Ensure the API key for your chosen model provider is set (e.g., ANTHROPIC_API_KEY, OPENAI_API_KEY)

Enrich Your Traces

Add user IDs and custom metadata to PydanticAI traces

Custom Spans

Create spans for business logic around agent calls

Distributed Tracing

Trace agents across service boundaries

Resources