Send Pydantic AI agent runs to Runtype at full fidelity: one call, composes with Logfire and any OpenTelemetry setup.
pip install runtype-pydantic-ai Copy PIP instructions
pip install runtype-pydantic-ai Quick start Set RUNTYPE_API_KEY to a key with the TELEMETRY:WRITE scope and RUNTYPE_AGENT_ID to the Runtype agent that owns the runs. Then add one call at startup:
import runtype_pydantic_ai runtype_pydantic_ai.instrument() Every Agent in the process is now traced. Spans are exported in batches, so a run reaches Runtype a few seconds after it ends. In a short-lived script or a test that checks the export, keep the handle and flush before exit or before asserting:
handle = runtype_pydantic_ai.instrument() ... handle.force_flush() With Logfire Call instrument() after logfire.configure() and it joins Logfire's provider. Alternatively, pass the processor in:
import logfire import runtype_pydantic_ai logfire.configure(additional_span_processors=[runtype_pydantic_ai.span_processor()]) logfire.instrument_pydantic_ai(include_content=True, version=5) Any instrumentation format from 2 up works, so keep the one your Logfire queries read. Format 2 uses the older span names (agent run, running tool), and Runtype receives the same attributes from it as from format 5. instrument() itself sets format 5.
instrument() leaves a global non-Logfire provider alone and traces through a private one, because prompt content would otherwise reach every exporter on it. To share a provider, pass it:
runtype_pydantic_ai.instrument(tracer_provider=provider) Its other exporters then receive raw content, and redact does not apply to them. Use content=False to keep content off every exporter.
If Agent.instrument_all() already ran, instrument() keeps those settings and joins the provider they use, and raises if it cannot reach that provider. An agent with its own instrumentation, such as Agent(instrument=True), traces to its own provider, so pass that provider too.
Map Pydantic AI agent names to Runtype agents, or pin a block of code to one:
runtype_pydantic_ai.instrument(agent_ids={"chat": "agent_a", "run": "agent_b"}) with runtype_pydantic_ai.runtype_agent("agent_c"): await agent.run("...") A sub-agent called from a tool stays a branch of the outer run, under the outer run's Runtype agent.
Every top-level run is its own Runtype execution, even when several share a web request's span. A run under such a span gets a new trace id in Runtype, so it will not match the id in your other backend.
To trace a single agent rather than all of them:
By default Runtype receives prompts, instructions, model output and tool arguments and results as written. Any personal data your prompts carry, such as a user's record placed in the first message, reaches Runtype too. Turn it off or scrub it here:
from runtype_pydantic_ai import ContentOptions runtype_pydantic_ai.instrument(content=False) runtype_pydantic_ai.instrument(content=ContentOptions(tool_results=False, max_chars=16_384)) runtype_pydantic_ai.instrument(content=ContentOptions(redact=lambda value, attribute: scrub(value))) Each switch also applies inside message lists. tool_arguments=False and tool_results=False remove those payloads from tool call parts, system_instructions=False removes system messages, and output_messages=False removes earlier assistant turns from gen_ai.input.messages.
redact receives the parsed value and the attribute name. Returning None, or raising, drops that one attribute and keeps the span.
Values are capped to fit ingest's limits. Oversized message lists stay valid JSON: large parts become a marker, then the oldest turns are dropped and the newest kept.
Attributes are allow-listed. To send your own, name their prefixes:
runtype_pydantic_ai.instrument(passthrough_attribute_prefixes=["myapp."]) Options Environment variable Purpose RUNTYPE_API_KEY Runtype key with the TELEMETRY:WRITE scope. Required. RUNTYPE_AGENT_ID Default Runtype agent for runs. RUNTYPE_OTLP_URL Full trace URL. Defaults to https://api.runtype.com/v1/otel/v1/traces. Project links Documentation Homepage Key dates PyPI data Data sourced directly from PyPI's database. Released: Nov 6, 2026 Latest release Owner PyPI data Data sourced directly from PyPI's database. Runtype Credits Author: Runtype Labs
gen-ai observability opentelemetry otel pydantic-ai runtype
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
None of the files in this release were uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




