Skip to main content
Instrumentation captures detailed traces from your AI application, recording inputs, outputs, model parameters, latency, token usage, and metadata for every request. This gives you visibility into:
  • How your application behaves with real user inputs
  • Where failures and edge cases occur
  • Performance bottlenecks and token usage
  • Data for building evaluation datasets
Braintrust makes instrumentation simple with automatic wrappers for popular AI providers and frameworks, or manual tracing for custom workflows.

Anatomy of a trace

A trace represents a single request or interaction in your application. Each trace contains one or more spans. Anatomy of a trace A span represents a unit of work with a start and end time. Common examples include:
  • LLM API calls
  • Vector database searches
  • Tool or function invocations
  • Agent reasoning steps
  • Scoring functions
Each span captures:
  • Input: The data sent to this step
  • Output: The result produced
  • Metadata: Model parameters, tags, custom data
  • Metrics: Latency, token counts, costs
  • Scores: Quality metrics (added later)
Spans nest inside each other to represent your application’s execution flow. Well-designed traces make it easy to understand what happened and debug issues.

How to instrument

Braintrust provides three approaches to instrumentation, from simple to advanced:

What gets captured

Every instrumented request automatically captures:
  • Request inputs and outputs
  • Model parameters (model name, temperature, etc.)
  • Timing information (start time, duration)
  • Token usage and costs
  • Nested function calls and tool invocations
  • Errors and exceptions
  • Custom metadata you add
This data flows directly to Braintrust, where you can view it in real time, filter and search, add human feedback, and build evaluation datasets.

Provider and framework support

Braintrust integrates with all major AI providers and frameworks:
  • AI Providers: OpenAI, Anthropic, Gemini, AWS Bedrock, Azure, Mistral, Together, Groq, and many more
  • Frameworks: LangChain, LangGraph, OpenTelemetry, Vercel AI SDK, LlamaIndex, DSPy, Pydantic AI, and many more
Browse the complete integrations directory to find setup guides for your stack.

Next steps

Get started instrumenting your application: