Install
- Python
dspy extra brings in DSPy itself along with the OpenInference instrumentor that emits its spans.
Set up
- Python
Usage
Once initialized, every DSPy module call and underlying LLM request is traced automatically:Verify
Run your code and confirm the trace arrives:- In the traceroot UI: Navigate to Tracing > Traces in traceroot Cloud. You should see a trace with root span
CoTQA.forward— the outer module — withChainOfThought.forwardandPredict(StringSignature).forwardnested beneath it. - Via the CLI: Run
traceroot traces listto inspect your recent traces from the terminal.
What gets captured
Limitations
- Requires installing the
dspyextra viapip install "traceroot[dspy]".
Run the example
Clone the repo and run a complete agent end-to-end.Python
Run the Python example
Next steps
Python SDK Reference
Explore the full Python SDK reference and instrumentation options.
Cost Tracking
Learn how traceroot calculates token costs and tracks model spend.