Skip to content

Conversation

@bdsaglam
Copy link
Contributor

@bdsaglam bdsaglam commented Jan 12, 2026

Motivation

  • Provide first-class instrumentation support for the DSPy library via OpenInference to match existing integrations like LiteLLM.
  • Allow users to call logfire.instrument_dspy() to auto-instrument DSPy calls and capture LLM activity in Logfire.
  • Expose a documented, discoverable integration in the docs and navigation so users can find and install the optional extra.

Description

  • Added a new integration wrapper logfire/_internal/integrations/dspy.py which loads openinference.instrumentation.dspy and calls DSPyInstrumentor().instrument() with the Logfire tracer provider.
  • Added a public API method instrument_dspy on Logfire (logfire/_internal/main.py) and exposed it on the module surface (logfire/__init__.py).
  • Added documentation page docs/integrations/llms/dspy.md and added it to mkdocs.yml navigation.
  • Added the dspy optional dependency extra in pyproject.toml referencing openinference-instrumentation-dspy.

Also tested manually with a simple ReAct agent implemented here.
image

@bdsaglam bdsaglam marked this pull request as draft January 12, 2026 19:10
@codecov
Copy link

codecov bot commented Jan 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@bdsaglam bdsaglam marked this pull request as ready for review January 13, 2026 14:06
@bdsaglam bdsaglam force-pushed the codex/add-dspy-integration-to-logfire branch from 985cd95 to 2ee40b8 Compare January 14, 2026 18:03
@alexmojaki
Copy link
Contributor

please skip tests for old pydantic

@alexmojaki alexmojaki requested a review from Copilot January 15, 2026 15:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@alexmojaki
Copy link
Contributor

Thanks!

@alexmojaki alexmojaki enabled auto-merge (squash) January 16, 2026 09:53
@alexmojaki alexmojaki merged commit 7a3e157 into pydantic:main Jan 16, 2026
15 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