Installation
Quick Start
What Gets Traced
The Pydantic AI integration automatically captures:- Agent runs — input prompt, output text (including structured Pydantic model output), model name
- Token usage — input_tokens and output_tokens from the agent result
- Finish reason —
pydantic_ai.finish_reasoncaptured from the last model response (e.g."stop","length","tool_call") - Errors — error type and message captured in event properties, then re-raised to the caller
- Async support — both
run()(async) andrun_sync()(sync) are instrumented - Double-wrap guard — calling
wrap()twice on the same agent is a safe no-op
Configuration
Projects
Route events to a specific project by passing its slug asproject_id:
project_id sets the X-Raindrop-Project-Id header on every event. Omit it (or pass "default") to use your org’s default Production project, which is the existing behavior. The same option is accepted by the create_raindrop_pydantic_ai(...) factory. Invalid slugs are ignored with a warning and no header is sent.
Multiple projects in one process
Available inraindrop-ai>=0.0.56. When one service runs several agents that
should report to different projects, create one RaindropPydanticAI
wrapper per project. Each wrapper owns its own raindrop.Raindrop client, so
the two route independently — there is no shared module-level state:
raindrop.Raindrop yourself and pass
it via client=:
Structured Output
The integration handles Pydantic AI’s structured output types — the output is serialized to JSON for telemetry:Async Usage
The wrapper supports both sync and async agent runs:Identifying Users
Useidentify() to associate a user with traits:
str, int, bool, or float.
Tracking Signals
Usetrack_signal() to record feedback, edits, or custom signals:
Flushing and Shutdown
Always callflush() before your process exits to ensure all telemetry is shipped:
Factory Function (Legacy)
Thecreate_raindrop_pydantic_ai() factory is available for backwards compatibility:
Known Limitations
run_stream()is not instrumented — onlyrun()andrun_sync()are captured. Streaming runs produce no telemetry.- Multi-step agent runs: In agents with multiple LLM calls (e.g., tool use loops), only the final result’s data is captured. Intermediate LLM calls are not tracked individually.