The Strands Agents integration instruments the Strands Agent SDK via its hook system to capture agent invocations, model calls, tool usage, and token metrics. Features:Documentation Index
Fetch the complete documentation index at: https://raindrop.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
- No OpenTelemetry setup required
- Automatic input/output capture from agent invocations
- Model call tracking with token usage
- Tool call span tracking
- Works with both TypeScript and Python SDKs
Installation
- TypeScript
- Python
Quick Start
- TypeScript
- Python
What Gets Traced
The Strands integration automatically captures:- Agent invocations — input prompt (last user message), output text, model name
- Token usage — prompt_tokens, completion_tokens, and cached_tokens (from Bedrock/Anthropic
cacheReadInputTokens/cacheCreationInputTokens) - Model calls — output and usage extracted from each model call within an invocation
- Tool call spans — individual tool spans tracked via
interaction.track_tool()with name, input, output, duration (ms), and error - Finish reason —
stop_reasonorfinish_reasonfrom model responses (e.g.,end_turn,tool_use), included in properties asstrands.finish_reason - Errors — captured and re-raised; telemetry failures never crash your pipeline
Configuration
- TypeScript
- Python
Identifying Users
- TypeScript
- Python
Signals (Feedback)
Track user feedback on AI responses:- TypeScript
- Python
Flush & Shutdown
Always flush before your process exits to ensure all data is sent:- TypeScript
- Python
Captured Properties
The following properties are automatically included in tracked events:| Property | Description |
|---|---|
ai.usage.prompt_tokens | Input token count |
ai.usage.completion_tokens | Output token count |
ai.usage.cached_tokens | Cached input tokens (Bedrock/Anthropic) |
strands.finish_reason | Model stop reason (e.g., end_turn, tool_use) |
error.type | Exception class name (when an error occurs) |
error.message | Error message text (truncated to 500 chars) |
Token Tracking
The integration automatically captures token usage from model responses:| Property | Description |
|---|---|
ai.usage.prompt_tokens | Input token count (inputTokens from Strands model response) |
ai.usage.completion_tokens | Output token count (outputTokens from Strands model response) |
ai.usage.cached_tokens | Cached input tokens (prefers cacheReadInputTokens, falls back to cacheCreationInputTokens) |
stop_response.usage) and accumulated metrics (result.metrics.accumulated_usage).
Finish Reason
The model’s stop reason is captured automatically and included in event properties asstrands.finish_reason. The integration checks stop_reason first (Bedrock convention), then falls back to finish_reason.
Factory Function
Acreate_raindrop_strands() factory is available for convenience:
- Python
Known Limitations
- Streaming: The integration captures the final result of each model call. Streaming token-by-token output is not individually traced.
- Multi-agent: Each agent needs its own
registerHooks()/register_hooks()call. Nested agent hierarchies are not automatically linked. - Python WeakRef: The Python handler uses
id(agent)for internal tracking since some agent-like objects don’t support weak references. Context is cleaned up explicitly after each invocation.
That’s it! You’re ready to explore your Strands agent events in the Raindrop dashboard. Ping us on Slack or email us if you get stuck!