Skip to main content
Eve is a TypeScript agent runtime for building multi-turn agentic applications. Braintrust traces Eve agent sessions, turns, LLM steps, tool calls, and subagent interactions.

Setup

Install braintrust alongside eve and set your Braintrust API key.
1

Install packages

2

Set environment variables

.env

Manual instrumentation

To trace Eve agents, add Braintrust instrumentation to your Eve agent. The setup depends on your Eve version:

Eve 0.62 or later

Eve 0.62 and later load instrumentation from files under agent/instrumentation/. Requires braintrust v3.37.0 or later.
1

Add Braintrust instrumentation

Create a Braintrust instrumentation file. The setup callback runs once per agent process and initializes the Braintrust logger:
agent/instrumentation/braintrust.ts
Running eve add instrumentation/braintrust in your agent project creates this file.
2

Build and run your agent

Build and start your Eve agent. The Eve runtime loads the instrumentation file automatically:
Eve versions 0.34 to 0.61 also support this setup if you set experimental: { instrumentationProviders: true } in defineAgent() in your agent.ts.

Eve versions before 0.62

Eve versions before 0.62 load instrumentation from a root instrumentation.ts file. Register a Braintrust hook and instrumentation in your Eve agent. The hook handles the full span lifecycle; the instrumentation initializes the logger and captures LLM inputs for step spans.
1

Add a Braintrust hook

Create a hook file in your agent’s hooks directory. Eve loads hook files automatically at startup:
hooks/braintrust.ts
2

Add Braintrust instrumentation

Create an instrumentation file in your agent’s instrumentation directory. The setup callback runs once per agent process and initializes the Braintrust logger:
instrumentation.ts
3

Build and run your agent

Build and start your Eve agent. The hook and instrumentation are loaded automatically by the Eve runtime:

What Braintrust traces

Braintrust captures:
  • Turn spans (eve.turn), as individual traces, with the user message as input, the agent’s final response as output, and the session ID in metadata as eve.session_id. With the setup for Eve versions before 0.62, turn spans also have aggregated token metrics.
  • Parent-child nesting under the caller’s span, with the setup for Eve 0.62 or later, when the caller propagates W3C trace context to Eve. Eve forwards the caller’s traceparent header for session requests that include a remote subagent callback. Requires braintrust v3.37.0 or later.
  • Step spans (eve.step), as LLM spans nested under their turn, with the full message history as input, the model response as output, and model name and provider in metadata.
  • Tool call spans (named after the tool), as tool spans nested under their turn, with the tool arguments as input and the tool result as output.
  • Subagent spans (named after the subagent), as tool spans nested under their turn, with the subagent’s turn spans nested under them.
  • Token usage metrics (prompt, completion, total, prompt cached, and prompt cache creation) on step spans. With the setup for Eve versions before 0.62, step spans also have estimated cost when Eve reports it.
  • Errors captured on every span.

Resources