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.1.tar.gz (7.7 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.1.tar.gz.

File metadata

File hashes

Hashes for respan_instrumentation_pydantic_ai-0.1.1.tar.gz
Algorithm Hash digest
SHA256 16a9254c3aa2ec46fc32d0cec7e887c6a4e8c3a83d98f5b99f008b7a7a0f7779
MD5 c64a2ae4dbd8252b5c2c39cbfe0755b3
BLAKE2b-256 ec164d6b9ffdadd5d2bedb2e9670bf98b945f67ba3b680afc52a487a13019105

See more details on using hashes here.

Provenance

The following attestation bundles were made for respan_instrumentation_pydantic_ai-0.1.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for respan_instrumentation_pydantic_ai-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0f29f0b0f548af91f54eecbb1462d67bbfc91acd8a1c6743e670698f88ec4871
MD5 161c769777234d58e016bd5c370fd16c
BLAKE2b-256 07c2dce82016c5d7f7b8329c5e48ae99be921a35d830e9ea2cc7d8a320548bdb

See more details on using hashes here.

Provenance

The following attestation bundles were made for respan_instrumentation_pydantic_ai-0.1.1-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