DSPy
Trace your DSPy applications by patching LiteLLM and configuring the Braintrust callback handler.
DSPy is a declarative framework for programming language models developed at Stanford NLP that enables you to iterate on structured code rather than brittle strings.
Installation
uv add braintrust dspyUsage
DSPy uses LiteLLM internally, so you need to patch LiteLLM before importing DSPy:
This will automatically log:
- DSPy module executions (Predict, ChainOfThought, ReAct, etc.)
- LLM calls with detailed token counts and costs (from LiteLLM)
- Tool invocations
- Hierarchical span relationships
- Complete observability of your DSPy pipelines
Learn More
- DSPy Documentation
- LiteLLM Integration - For direct LiteLLM usage