> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tracectrl.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# AWS Strands

> Instrument AWS Strands agents with TraceCtrl

## Installation

Both packages are published to PyPI.

```bash theme={"dark"}
pip install tracectrl tracectrl-instrumentation-strands
```

## Usage

```python theme={"dark"}
import tracectrl
from tracectrl import tag_agent
from tracectrl.instrumentation.strands import StrandsInstrumentor

tracectrl.configure(service_name="my-strands-agent")
StrandsInstrumentor().instrument()

from strands import Agent

agent = Agent(model="anthropic.claude-sonnet-4-5-20250929-v1:0")
tag_agent(agent)

agent("Summarize this report")
```

`tag_agent(agent)` stamps the agent's identity onto subsequent spans so the agent surfaces correctly in TraceCtrl's topology and session views.

## Implementation Note

Unlike the other instrumentors (which wrap an OpenInference `Instrumentor` class), the Strands integration uses `StrandsAgentsToOpenInferenceProcessor` — a processor-based pattern. The `StrandsInstrumentor` wrapper provides the same `.instrument()` / `.uninstrument()` API for consistency.

## What Gets Captured

* Agent execution spans with model information
* Tool calls with risk category classification
* Input/output values
* Session correlation via `tracectrl.session_id`

## API

### `StrandsInstrumentor()`

<ParamField path="instrument" type="method">
  `instrument(tracer_provider=None, **kwargs)` — Registers the TraceCtrl span processor and the Strands-to-OpenInference processor. Only `tracer_provider` is consumed; extra kwargs are accepted but ignored.
</ParamField>

<ParamField path="uninstrument" type="method">
  `uninstrument()` — Shuts down the TraceCtrl processor. The underlying Strands processor cannot be removed from the tracer provider.
</ParamField>

<ParamField path="instrumented" type="bool">
  Whether the instrumentor is currently active.
</ParamField>
