Setup
Installbraintrust alongside eve and set your Braintrust API key.1
Install packages
2
Set environment variables
.env
Manual instrumentation
To trace Eve agents, 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, aggregated token metrics, and the session ID in metadata aseve.session_id. - 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 input and output.
- Token usage metrics (prompt, completion, total, prompt cached, prompt cache creation, and estimated cost) on step spans.
- Errors captured on every span.