---
title: Braintrust
description: Export AI SDK spans to Braintrust for tracing, evals, and monitoring.
type: instrumentation
keywords:
  - otel
  - opentelemetry
  - tracing
  - observability
  - evals
  - monitoring
---

# Braintrust

Instrumentation integration for eve. Export AI SDK spans to Braintrust for tracing, evals, and monitoring.

## Install

Add the Braintrust integration from eve's registry:

```bash
eve add instrumentation/braintrust
```

## Quick start

eve installs a hook that traces agent activity and an instrumentation file that initializes the Braintrust logger:

```ts
// agent/hooks/braintrust.ts
import { braintrustEveHook } from "braintrust";
import { defineState } from "eve/context";
import { defineHook } from "eve/hooks";

export default defineHook(
  braintrustEveHook({
    defineState,
    metadata: {
      app: "my-eve-agent", // Replace with your app name
    },
  }) as Parameters<typeof defineHook>[0],
);
```

```ts
// agent/instrumentation.ts
import { braintrustEveInstrumentation, initLogger } from "braintrust";
import { defineState } from "eve/context";
import { defineInstrumentation } from "eve/instrumentation";

export default defineInstrumentation(
  braintrustEveInstrumentation({
    defineState,
    setup: ({ agentName }) => {
      initLogger({
        projectName: agentName,
        apiKey: process.env.BRAINTRUST_API_KEY,
      });
    },
  }) as Parameters<typeof defineInstrumentation>[0],
);
```

## Configure

Create an API key in the Braintrust dashboard and expose it as `BRAINTRUST_API_KEY`. Replace the hook's `app` metadata with your app name. Spans land in the Braintrust project named after your agent. See the [instrumentation guide](/docs/guides/instrumentation) for the trace hierarchy and the `recordInputs`/`recordOutputs` controls.

[Read the full instrumentation documentation](/docs/guides/instrumentation)

---

For a semantic overview of all documentation, see [/sitemap.md](/sitemap.md)

For an index of all available documentation, see [/llms.txt](/llms.txt)

For agent-facing discovery, including API and MCP surfaces, see [/agents.md](/agents.md)