Skip to main content

Respan instrumentation plugin for PydanticAI

Project description

respan-instrumentation-pydantic-ai

Respan instrumentation plugin for PydanticAI.

This package enables PydanticAI's native OpenTelemetry emission and maps the resulting PydanticAI attributes directly into the Respan/Traceloop conventions used by the OTLP pipeline.

Install

pip install respan-instrumentation-pydantic-ai

Quickstart

import os

from pydantic_ai import Agent
from pydantic_ai.models.openai import OpenAIModel
from pydantic_ai.providers.openai import OpenAIProvider
from respan import Respan
from respan_instrumentation_pydantic_ai import PydanticAIInstrumentor

respan = Respan(
    api_key=os.environ["RESPAN_API_KEY"],
    instrumentations=[PydanticAIInstrumentor()],
)

agent = Agent(
    OpenAIModel("gpt-4o-mini", provider=OpenAIProvider(api_key=os.environ["OPENAI_API_KEY"]))
)

result = agent.run_sync("Write a one-line haiku about tracing.")
print(result.output)

respan.flush()

Notes

  • By default the instrumentor enables global PydanticAI instrumentation via Agent.instrument_all(...).
  • Pass agent=... to PydanticAIInstrumentor(...) if you only want to instrument one agent instance.
  • The plugin uses explicit InstrumentationSettings(version=4) to keep emitted spans on the current GenAI semantic conventions used elsewhere in this repo.
  • This package does not depend on OpenInference at runtime; it consumes native PydanticAI telemetry directly.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

respan_instrumentation_pydantic_ai-0.1.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file respan_instrumentation_pydantic_ai-0.1.0.tar.gz.

File metadata

File hashes

Hashes for respan_instrumentation_pydantic_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7e706aed639fbed1d54e3b470b71e1481f235d37431176dd57385b2b73fdef41
MD5 c58a7642da1e52a005f9e1c28bc11053
BLAKE2b-256 c2e79845eb3baa95958f47a00ed369f7cd0b42ff4aede21e04af525a413e438a

See more details on using hashes here.

Provenance

The following attestation bundles were made for respan_instrumentation_pydantic_ai-0.1.0.tar.gz:

Publisher: publish.yml on respanai/respan

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file respan_instrumentation_pydantic_ai-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for respan_instrumentation_pydantic_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e3c38ae4356e59f3be635c46e902ad62d6b287a61fb6f602028fb6af397e0832
MD5 3cb19781e7524149607468fda326c268
BLAKE2b-256 89c9d0ea0e8304df2c3674d98a78f9f0f2b1b85bdbc44878d907f5f09dca575f

See more details on using hashes here.

Provenance

The following attestation bundles were made for respan_instrumentation_pydantic_ai-0.1.0-py3-none-any.whl:

Publisher: publish.yml on respanai/respan

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page