Setup
Install DSPy alongside the Braintrust SDK:Trace with DSPy
DSPy uses LiteLLM internally, so Braintrust tracing requires patching LiteLLM and configuring a DSPy callback. Patch LiteLLM before importing DSPy, and then configure the Braintrust callback:trace-dspy.py
- DSPy module executions (Predict, ChainOfThought, ReAct, etc.)
- LLM calls with detailed token counts and costs (via LiteLLM)
- Tool invocations
- Hierarchical span relationships
- Complete pipeline observability