You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: add Strands built-in telemetry example to integrations page (opensearch-project#130)
Add a second Strands example showing how to use StrandsTelemetry()
for native OTel instrumentation pointed at the collector, with
@observe for custom spans Strands doesn't emit automatically.
Signed-off-by: Vamsi Manohar <reddyvam@amazon.com>
Strands Agents has native OpenTelemetry support via `StrandsTelemetry`. It automatically emits spans for agent invocations, tool executions, and LLM calls following GenAI semantic conventions. Point it at the OTel collector, then use `@observe` from the SDK to add spans for any custom logic that Strands doesn't instrument automatically.
# Use @observe for custom logic that Strands doesn't auto-instrument
73
+
@observe(op=Op.EXECUTE_TOOL)
74
+
deffetch_hotel_ratings(city: str) -> str:
75
+
"""Fetch hotel ratings from an external API."""
76
+
# Custom API call — not covered by Strands auto-instrumentation
77
+
returnf"4.5 stars average in {city}"
78
+
79
+
model = BedrockModel(model_id="us.anthropic.claude-sonnet-4-20250514-v1:0")
80
+
agent = Agent(
81
+
model=model,
82
+
tools=[fetch_hotel_ratings],
83
+
system_prompt="You are a helpful travel assistant.",
84
+
)
85
+
86
+
agent("Find top-rated hotels in Seattle")
87
+
```
88
+
89
+
> **Tip:**`StrandsTelemetry` handles agent, tool, and LLM spans automatically. Use `@observe` only for custom functions (API calls, database queries, post-processing) where you need visibility that Strands doesn't provide out of the box.
90
+
48
91
## LangGraph
49
92
50
93
[LangGraph](https://langchain-ai.github.io/langgraph/) builds stateful, multi-step agent workflows. Install the LangChain auto-instrumentor for automatic LLM tracing.
0 commit comments