Skip to main content
Strands Agents SDK helps you build AI agents. Braintrust traces Strands agents end-to-end, covering the agent’s reasoning loop, model calls, and tool executions. The integration works with any model provider Strands supports.

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 trace Agent, 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

The auto-instrumentation example uses plain JavaScript so 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 with wrapStrandsAgentSDK 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 Graph and Strands 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.

Resources