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.2.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.2.tar.gz.

File metadata

File hashes

Hashes for respan_instrumentation_pydantic_ai-0.1.2.tar.gz
Algorithm Hash digest
SHA256 34797fbaa3dde57a7c93973499c736aac03f516f07b9c86e9d54e49cac53b693
MD5 34363567093dd73d11a03bfb663820b0
BLAKE2b-256 ebd69a54f7ea8fa6abb643344268caedd92f6fe38a575db7e2af5e090519908f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for respan_instrumentation_pydantic_ai-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 84a616f59a5a3e423d3fbe92faa8e95f2cae01b1bef05391dabaeb878c0f54ec
MD5 c3fe34e1b8f8e7c5dc7f0096d8283ff9
BLAKE2b-256 29286f2deb156b8752c7871989767f5fea7d5c82f8d525226b06eba387feb0a9

See more details on using hashes here.

Provenance

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