Also verified: pydantic-ai 1.25.1 with instrumentor 0.1.27. The extra no longer installs that older instrumentor. See supported frameworks for how verification works.
In code
Calltracing.init(), attach the framework instrumentor to the provider it returns, and wrap the work in tracing.turn() and tracing.agent().
The install line uses PydanticAI 2.57, which needs Python 3.11 or newer and no other pins.
Python 3.10: use PydanticAI 1.25
Python 3.10: use PydanticAI 1.25
On Python 3.10, use the tested PydanticAI 1.25 instead. It needs OpenTelemetry 1.39 and
genai-prices older than 0.1 to record token counts, because PydanticAI before 2.17 records none with genai-prices 0.1.0 or newer, and the trace would then show zero cost. In code, pass version=3 to InstrumentationSettings on PydanticAI 1.x and version=5 on 2.x.terminal
1
Install
terminal
2
Add the code
app.py
3
Run
terminal
BOTGAUGE_API_KEY, OPENAI_BASE_URL, OPENAI_API_KEY, OPENAI_MODEL.Zero-code
Leave your app unchanged and start it withbotgauge instrument. The sample still wraps the work in tracing.turn() and tracing.agent() so spans carry session and agent ids.
The install line uses PydanticAI 2.57, which needs Python 3.11 or newer and no other pins.
Python 3.10: use PydanticAI 1.25
Python 3.10: use PydanticAI 1.25
On Python 3.10, use the tested PydanticAI 1.25 instead. It needs OpenTelemetry 1.39 and
genai-prices older than 0.1 to record token counts, because PydanticAI before 2.17 records none with genai-prices 0.1.0 or newer, and the trace would then show zero cost. botgauge instrument picks the right instrumentation version for you.terminal
1
Install
terminal
2
Add the code
app.py
3
Run
terminal
BOTGAUGE_API_KEY, OPENAI_BASE_URL, OPENAI_API_KEY, OPENAI_MODEL.View PydanticAI spans live
Watch your PydanticAI agent runs with token counts appear in BotGauge.
.png?fit=max&auto=format&n=rExdh2xAS2_ywWU5&q=85&s=2336659947d2543be68f95bf2d539b85)