Skip to content

feat(examples): add Pydantic AI zero-code OTLP example#117

Merged
krisztianfekete merged 1 commit intoagentevals-dev:mainfrom
Navteca:feature/pydantic-ai-zero-code-example
Apr 15, 2026
Merged

feat(examples): add Pydantic AI zero-code OTLP example#117
krisztianfekete merged 1 commit intoagentevals-dev:mainfrom
Navteca:feature/pydantic-ai-zero-code-example

Conversation

@frivas-at-navteca
Copy link
Copy Markdown
Contributor

Addressing #92

Adds examples/zero-code-examples/pydantic-ai/ with run.py and requirements.txt, following the same pattern as the existing zero-code examples.

Added a TestPydanticAIZeroCode E2E test class in tests/integration/test_live_agents.py and updates the examples/README.md tables to include the new example.

@frivas-at-navteca frivas-at-navteca changed the title Addressing #92 feat(examples): add Pydantic AI zero-code OTLP example Apr 14, 2026
Comment thread examples/zero-code-examples/pydantic-ai/run.py Outdated
Comment thread examples/zero-code-examples/pydantic-ai/requirements.txt Outdated
Comment thread examples/zero-code-examples/pydantic-ai/run.py Outdated
@frivas-at-navteca frivas-at-navteca force-pushed the feature/pydantic-ai-zero-code-example branch 2 times, most recently from 5fffa96 to e47fd28 Compare April 14, 2026 15:19
Copy link
Copy Markdown
Contributor

@krisztianfekete krisztianfekete left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should drop the unnecessary logging related boilerplate, the unused ENV var, align the tests, and then we are good.

endpoint = os.environ.get("OTEL_EXPORTER_OTLP_ENDPOINT", "http://localhost:4318")
print(f"OTLP endpoint: {endpoint}")

os.environ.setdefault("OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT", "true")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, taking a closer look at their SDK. Are you sure this ENV var is being used?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. It was not used. I should have review the code again more thoroughly. Thank you very much!

Comment on lines +69 to +78
# Pydantic AI uses both spans (for structure/metadata) and log records
# (for message content). Both providers are required to capture full
# conversation content in agentevals.
tracer_provider = TracerProvider(resource=resource)
tracer_provider.add_span_processor(BatchSpanProcessor(OTLPSpanExporter(), schedule_delay_millis=1000))
trace.set_tracer_provider(tracer_provider)

logger_provider = LoggerProvider(resource=resource)
logger_provider.add_log_record_processor(BatchLogRecordProcessor(OTLPLogExporter(), schedule_delay_millis=1000))
set_logger_provider(logger_provider)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like by default their v2 is used, which is not using logs, see https://pydantic.dev/docs/ai/integrations/logfire/#version-2-default

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the link. I have checked the code and it already complies with the defaults. Thank you very much again!

@frivas-at-navteca frivas-at-navteca force-pushed the feature/pydantic-ai-zero-code-example branch from e47fd28 to 2cceab5 Compare April 15, 2026 13:05
Adds examples/zero-code-examples/pydantic-ai/ with run.py and requirements.txt, following the same pattern as the existing zero-code examples.

Added a TestPydanticAIZeroCode E2E test class in tests/integration/test_live_agents.py and updates the examples/README.md tables to include the new example.
@frivas-at-navteca frivas-at-navteca force-pushed the feature/pydantic-ai-zero-code-example branch from 2cceab5 to 6b380de Compare April 15, 2026 13:13
@frivas-at-navteca
Copy link
Copy Markdown
Contributor Author

I believe I made the changes you have suggested. Thank you very much for the time reviewing and all the suggestions!

@krisztianfekete krisztianfekete merged commit d0955cc into agentevals-dev:main Apr 15, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants