OpenInference Strands Agents Instrumentation
Python instrumentation library for Strands Agents.
This package provides a span processor that transforms Strands' native OpenTelemetry spans to OpenInference format. The traces are fully OpenTelemetry compatible and can be sent to an OpenTelemetry collector for viewing, such as Arize Phoenix or Arize AX.
Installation
pip install openinference-instrumentation-strands-agents
Quickstart
In this example we will instrument a small Strands agent program and observe the traces via arize-phoenix.
Install packages.
pip install openinference-instrumentation-strands-agents strands-agents arize-phoenix opentelemetry-sdk opentelemetry-exporter-otlp
Start the phoenix server so that it is ready to collect traces. The Phoenix server runs entirely on your machine and does not send data over the internet.
python -m phoenix.server.main serve
In a python file, setup the Strands telemetry and add the StrandsAgentsToOpenInferenceProcessor to transform spans.
import os
from strands import Agent, tool
from strands.models.openai import OpenAIModel
from strands.telemetry import StrandsTelemetry
from openinference.instrumentation.strands_agents import StrandsAgentsToOpenInferenceProcessor
# Setup Strands native telemetry
telemetry = StrandsTelemetry()
telemetry.setup_otlp_exporter(endpoint="http://127.0.0.1:6006/v1/traces")
# Add OpenInference processor to transform spans
telemetry.tracer_provider.add_span_processor(StrandsAgentsToOpenInferenceProcessor())
@tool
def get_weather(city: str) -> dict:
"""Get the current weather for a city.
Args:
city: The name of the city
"""
return {
"status": "success",
"content": [{"text": f"The weather in {city} is sunny and 72°F."}],
}
if __name__ == "__main__":
# Create and run agent
model = OpenAIModel(model_id="gpt-4o-mini")
agent = Agent(
name="WeatherAgent",
model=model,
tools=[get_weather],
system_prompt="You are a helpful weather assistant.",
)
result = agent("What's the weather in San Francisco?")
print(result)
Since we are using OpenAI, we must set the OPENAI_API_KEY environment variable to authenticate with the OpenAI API.
export OPENAI_API_KEY=your-api-key
Now simply run the python file and observe the traces in Phoenix.
python your_file.py
Important: Processor Ordering
The StrandsAgentsToOpenInferenceProcessor mutates spans in-place. This means the order in which you add span processors matters.
Add the StrandsAgentsToOpenInferenceProcessor before any exporters that should receive the transformed OpenInference spans:
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
# Correct order: processor first, then exporter
telemetry.tracer_provider.add_span_processor(StrandsAgentsToOpenInferenceProcessor())
telemetry.tracer_provider.add_span_processor(BatchSpanProcessor(OTLPSpanExporter()))
If you need to export both the original GenAI spans and transformed OpenInference spans to different destinations, you'll need to set up the processors carefully or consider using separate tracer providers.
More Info
Metadata
Release files for openinference-instrumentation-strands-agents 0.1.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| openinference_instrumentation_strands_agents-0.1.11.tar.gz | 19.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| openinference_instrumentation_strands_agents-0.1.11-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.7 kB
Release files / openinference_instrumentation_strands_agents-0.1.11.tar.gz
| Download URL | openinference_instrumentation_strands_agents-0.1.11.tar.gz |
|---|---|
| Size | 19.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dcf34dd673621014df213b35b0831ecade2ccf45c54680d087069a06612f226b
|
|
BLAKE2b-256 checksum How to use checksums |
b241081e3b3e3040d5bd177b64e8541e5a8fd88fd09ab848a0f82232d27c7706
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.
Transparency logRelease files / openinference_instrumentation_strands_agents-0.1.11-py3-none-any.whl
| Download URL | openinference_instrumentation_strands_agents-0.1.11-py3-none-any.whl |
|---|---|
| Size | 21.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bdcc10fe5b3124acda684162d8a253876560eb541001cc855828accc47c91218
|
|
BLAKE2b-256 checksum How to use checksums |
8ef0d18bc7f147aa37ba65fa7a0de14984336503cef3dc5ca1a1f9de20c25e0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 7, 2026.
Transparency log