Skip to main content
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:
  • 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

npm install @raindrop-ai/strands @strands-agents/sdk

Quick Start

import { Agent } from "@strands-agents/sdk";
import { createRaindropStrandsAgents } from "@raindrop-ai/strands";

// 1. Create the Raindrop client
const raindrop = createRaindropStrandsAgents({
  writeKey: process.env.RAINDROP_WRITE_KEY!,
  userId: "user_123",
});

// 2. Create your agent
const agent = new Agent({
  model: "us.amazon.nova-lite-v1:0",
  systemPrompt: "You are a helpful assistant.",
});

// 3. Register hooks
raindrop.handler.registerHooks(agent);

// 4. Use the agent normally — invocations are traced automatically
const result = await agent("What is the capital of France?");
console.log(result);

// 5. Flush before shutdown
await raindrop.flush();

What Gets Traced

The Strands integration automatically captures:
  • Agent invocations — input prompt (last user message), output text, model name
  • Token usage — prompt_tokens and completion_tokens from model responses
  • Model calls — output and usage extracted from each model call within an invocation
  • Tool calls — tool name, input, and output for each tool invocation
  • Errors — captured and re-raised; telemetry failures never crash your pipeline

Configuration

const raindrop = createRaindropStrandsAgents({
  writeKey: "rk_...",           // Optional: your Raindrop write key (omit to disable telemetry)
  userId: "user-123",          // Optional: associate events with a user
  convoId: "convo-456",        // Optional: conversation/thread ID
  endpoint: "https://...",     // Optional: custom API endpoint
});

Identifying Users

await raindrop.users.identify({
  userId: "user_123",
  traits: {
    email: "user@example.com",
    plan: "pro",
  },
});

Signals (Feedback)

Track user feedback on AI responses:
await raindrop.signals.track({
  eventId: "evt_...",
  name: "thumbs_up",
  type: "feedback",
  sentiment: "POSITIVE",
});

Flush & Shutdown

Always flush before your process exits to ensure all data is sent:
// Flush pending events
await raindrop.flush();

// Or shutdown gracefully (flush + release resources)
await raindrop.shutdown();

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!