To use an agent for automatic setup, see the Quickstart.
Sign up
If you don’t have a Braintrust account, sign up for free at braintrust.dev.Install the SDK
The Braintrust Go SDK requires Go 1.25 or later. Add the SDK to your module:Set an API key
Create an API key in API key settings and set it as an environment variable:.env
BRAINTRUST_API_KEY from the environment. Keep it out of version control.
Configure tracing
There are two ways to instrument your app:- Auto-instrumentation (recommended): Build and run your application with Orchestrion so supported AI provider calls are traced automatically.
- Manual instrumentation: Initialize Braintrust yourself and create OpenTelemetry spans around application work. Use this approach if you need precise custom spans or if your provider is not supported by auto-instrumentation.
- Auto-instrumentation
- Manual instrumentation
1
Initialize Braintrust
Set up OpenTelemetry and create a Braintrust client during application startup:
main.go
2
Add Orchestrion and provider integrations
Orchestrion instruments supported provider calls at build time. Install a pinned Orchestrion version:Then install and import the integrations your app uses. Each integration is its own Go module:Add a tools file in the same directory as your If your app uses many supported integrations, install and import
go.mod. Prefer importing only the integrations your app uses:orchestrion.tool.go
github.com/braintrustdata/braintrust-sdk-go/trace/contrib/all instead.3
Persist Orchestrion in your build and run path
Auto-instrumentation only works when your app is built or run through Orchestrion. Update the commands your team and CI use, for example:If your project uses a Makefile, Dockerfile, CI workflow, or checked-in script, update that normal path instead of relying on a one-off local command.
4
Find your AI provider
To learn more about what gets traced, find your AI provider in SDK integrations.
Verify tracing
Run your app and make an AI call. A trace will show up in your Braintrust Logs, usually within seconds.If traces appear in Braintrust, you’ve successfully set up the SDK.
Next steps
Learn more about using the SDK to observe, evaluate, and improve your AI application:- Instrument — trace LLM calls and application logic
- Observe — search and analyze production traces
- Annotate — label traces and build datasets
- Evaluate — measure quality and catch regressions
- Deploy — ship to production with the AI gateway