When to use frameworks
Use framework integrations when:- You’re already using LangChain, LangGraph, or similar frameworks
- You want automatic tracing without wrapping individual clients
- Your application uses complex chains, agents, or multi-step workflows
- You’re making direct API calls without a framework
- You want simpler, more lightweight instrumentation
LangChain
LangChain is a framework for building applications with language models. Braintrust integrates using callback handlers to automatically trace chains, agents, and LLM calls. See the LangChain integration guide for complete documentation.1
Install packages
2
Add callback handler
Add the Braintrust callback handler to your LangChain application:The callback handler captures chains, agents, retrievers, and individual LLM calls automatically.
OpenTelemetry
OpenTelemetry is an open standard for distributed tracing. Braintrust acts as an OpenTelemetry backend, accepting spans from any OTel-instrumented application. See the OpenTelemetry integration guide for complete documentation.1
Install packages
2
Configure span processor
Route OpenTelemetry spans to Braintrust:
3
Set environment variables
Set these environment variables:
.env
Other frameworks
Braintrust provides integrations for many popular frameworks:LangGraph
Build stateful, multi-agent applications
Vercel AI SDK
Stream AI responses in web applications
LlamaIndex
RAG and data-aware applications
DSPy
Programming with foundation models
Pydantic AI
Type-safe agent framework
Instructor
Structured outputs from LLMs
CrewAI
Multi-agent orchestration
Autogen
Multi-agent conversation framework
Next steps
- Add custom tracing for application logic beyond frameworks
- Capture user feedback like thumbs up/down
- View your logs in the Braintrust dashboard