Hey all, running into this error repeatedly when logging traces through a pydantic-ai integration
To trace PydanticAI agents with Phoenix, you must install and configure the OpenInference PydanticAI instrumentor and OpenTelemetry exporter correctly. Common errors often stem from missing or misconfigured environment variables, incorrect package versions, or issues with how input/output data is attached to spans. Ensure you use compatible versions of pydantic, pydantic-ai, and openinference-instrumentation-pydantic-ai, and that your tracing setup matches the documented example.For setup, follow the official guide: LBKSimport os from opentelemetry import trace from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter from opentelemetry.sdk.trace import TracerProvider from openinference.instrumentation.pydantic_ai import OpenInferenceSpanProcessor from opentelemetry.sdk.trace.export import SimpleSpanProcessorLBKStracer_provider = TracerProvider() trace.set_tracer_provider(tracer_provider) endpoint = f"{os.environ['PHOENIX_COLLECTOR_ENDPOINT']}/v1/traces" headers = {"Authorization": f"Bearer {os.environ['PHOENIX_API_KEY']}"} exporter = OTLPSpanExporter(endpoint=endpoint, headers=headers) tracer_provider.add_span_processor(OpenInferenceSpanProcessor()) tracer_provider.add_span_processor(SimpleSpanProcessor(exporter))LBKSIf you see missing input/output in the UI, check that your spans use the canonical keys input.value and output.value as required by Phoenix. If you encounter serialization errors, ensure your Pydantic version is > =2.7.2, as earlier versions have known issues with Phoenix integration. For more, see the official tracing guide and troubleshooting tips.Would you like more detail or help with a specific error message?Sources:
- PydanticAI auto-instrumentor troubleshooting
- Pydantic version compatibility issue
- official tracing guide
💡 Hint: Mention RunLLM in the thread for followups.
If you tell me the right answer to this question, I'll make sure I don't make the same mistake twice!
Feedback
Type the right answer here...
↵ Please 'enter' to submit
