Skip to main content
Strands Agents is an SDK for building model-driven agents. LangSmith provides a Strands Agents integration that exports Strands OpenTelemetry spans in a LangSmith-compatible format, including agent runs, model calls, tool calls, prompts, completions, and token usage.
In an agent-based workspace, create an agent once before sending traces. Use agent addressing to select its identifier and environment. If an integration requires project_name, use the selected environment’s tracer_session_name as a compatibility value.

Installation

Install LangSmith with Strands Agents support:
This installs LangSmith, Strands Agents, Strands Agents tools, and the OpenTelemetry OTLP HTTP exporter.

Setup

1. Configure environment variables

Set your LangSmith API key and the agent identifier and environment. If you use Amazon Bedrock as the model provider for Strands Agents, also configure AWS credentials with your preferred AWS authentication method.
The Strands Agents integration uses the standard OpenTelemetry OTLP exporter. Configure the LangSmith endpoint and headers before calling setup_langsmith_telemetry().

2. Enable Strands Agents telemetry

Call setup_langsmith_telemetry() once when your process starts, before creating or invoking agents:
For local debugging, pass console=True to also print transformed spans to stdout:

3. Create and run your agent

Once configured, Strands Agents traces are exported to LangSmith automatically:

View traces in LangSmith

After running your agent, select your agent and environment in LangSmith, then open Tracing to view traces that include:
  • Agent invocation spans
  • Event loop cycle spans
  • LLM call spans with prompts, completions, and token usage
  • Tool call spans with tool inputs and outputs when your agent uses tools

Customize the OTLP exporter

If you need to pass custom options to the underlying OpenTelemetry exporter, create a LangSmithSpanExporter with create_langsmith_exporter() and attach it to the Strands tracer provider manually:
Use this approach when you want to configure exporter options in code instead of environment variables.

Resources