Setup
Install Braintrust, the Amazon Strands Agents SDK, and the model provider package your agent uses. The examples below use OpenAI.1
Install packages
2
Set environment variables
.env
Auto-instrumentation
To traceAgent, Graph, and Swarm invocations from @strands-agents/sdk without changing your agent construction code, run your app with Braintrust’s import hook.1
Initialize Braintrust and invoke your agent
2
Run with the import hook
node --import can run the file directly. The Braintrust APIs work the same in TypeScript projects — compile your TypeScript to JavaScript, then run the compiled file with the import hook.If you’re using a bundler, see Trace LLM calls for plugin and loader setup.
Manual instrumentation
To trace Strands manually, wrap the SDK module withwrapStrandsAgentSDK to opt into tracing explicitly.What Braintrust traces
Braintrust captures the Strands span tree for agent and multi-agent runs:- Agent spans such as
Agent: weather-agent, with invocation input, final output, agent ID, agent name, model ID, stop reason, token metrics, and duration. - Model spans such as
Strands model: gpt-5-mini, nested under the agent span, with model metadata, stop reason, token metrics, and latency metrics. - Tool spans such as
tool: lookup_weather, with tool input, output, tool call ID, tool name, status, errors, and duration. - Multi-agent orchestration spans (
Strands GraphandStrands Swarm), including per-node spans (node: <node-id>), handoffs, status, output, token metrics, and duration. - Inline document, image, and video content in span inputs stored as Braintrust attachments rather than embedded bytes.
- Parent-child nesting under any enclosing Braintrust span.