Braintrust

Send Braintrust logs and spans to Respan for tracing.
  1. Sign up — Create an account at platform.respan.ai
  2. Create an API key — Generate one on the API keys page
  3. Add credits or a provider key — Add credits on the Credits page or connect your own provider key on the Integrations page

Add the Docs MCP to your AI coding tool to get help building with Respan. No API key needed.

1{
2 "mcpServers": {
3 "respan-docs": {
4 "url": "https://mcp.respan.ai/mcp/docs"
5 }
6 }
7}

What is Braintrust?

Braintrust is an AI evaluation and observability platform. The Respan exporter registers as Braintrust’s background logger to mirror experiment and logging data to Respan.

Setup

1

Install packages

$pip install braintrust respan-exporter-braintrust openai
2

Set environment variables

$export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"
$export BRAINTRUST_API_KEY="YOUR_BRAINTRUST_API_KEY"
$export OPENAI_API_KEY="YOUR_OPENAI_API_KEY"
3

Initialize and run

1import braintrust
2from openai import OpenAI
3from respan_exporter_braintrust import RespanBraintrustExporter
4
5client = OpenAI()
6
7with RespanBraintrustExporter():
8 @braintrust.traced
9 def generate_joke():
10 response = client.chat.completions.create(
11 model="gpt-4o-mini",
12 messages=[{"role": "user", "content": "Tell me a joke about AI"}],
13 )
14 return response.choices[0].message.content
15
16 @braintrust.traced
17 def joke_pipeline():
18 return generate_joke()
19
20 result = joke_pipeline()
21 print(result)
4

View your trace

Open the Traces page to see your Braintrust traces in Respan.

Configuration

ParameterTypeDefaultDescription
api_keystrRESPAN_API_KEY env varRespan API key.
base_urlstr | NoneNoneAPI base URL.

See the Braintrust Exporter SDK reference for the full API.