Skip to main content

Raindrop integration for Strands Agents

Project description

raindrop-strands

Raindrop integration for Strands Agents (Python). Automatically captures agent invocations, model calls, tool usage, and token metrics via the Strands hook system.

Installation

pip install raindrop-strands strands-agents

strands-agents is a required dependency.

Quick Start

import os
from strands import Agent
from raindrop_strands import RaindropStrands

raindrop = RaindropStrands(
    api_key=os.environ.get("RAINDROP_API_KEY"),
    user_id="user_123",
    convo_id="session_456",
)

agent = Agent(
    model="us.amazon.nova-lite-v1:0",
    system_prompt="You are a helpful assistant.",
)

raindrop.handler.register_hooks(agent)

result = agent("What is the capital of France?")
print(result)

raindrop.flush()

Omitting api_key disables telemetry shipping (a warning is emitted) but does not crash your application.

Debug Mode

Enable verbose logging to troubleshoot telemetry issues:

raindrop = RaindropStrands(
    api_key=os.environ.get("RAINDROP_API_KEY"),
    debug=True,
)

Configuration

raindrop = RaindropStrands(
    api_key="rk_...",              # Optional: Raindrop API key
    user_id="user_123",            # Optional: associate events with a user
    convo_id="session_456",        # Optional: conversation/session ID
    project_id="support-prod",     # Optional: route events to a specific project (slug)
    tracing_enabled=True,          # Optional: enable OTEL-based tracing (default: True)
    bypass_otel_for_tools=True,    # Optional: bypass OTEL for tool spans (default: True)
    debug=False,                   # Optional: enable debug logging (default: False)
)

Projects

Route events to a specific project by passing its slug as project_id:

raindrop = RaindropStrands(
    api_key="rk_...",
    project_id="support-prod",
)

project_id sets the X-Raindrop-Project-Id header on every event. Omit it (or pass "default") to use your org's default Production project, which is the existing behavior. The same option is accepted by the create_raindrop_strands(...) factory. Invalid slugs are ignored with a warning and no header is sent.

Factory Function

A create_raindrop_strands() factory function is also available for convenience:

from raindrop_strands import create_raindrop_strands

raindrop = create_raindrop_strands(api_key="rk_...")
agent = Agent(model="us.amazon.nova-lite-v1:0")
raindrop.handler.register_hooks(agent)
result = agent("Hello!")
raindrop.flush()

Identifying Users

raindrop.identify(
    user_id="user_123",
    traits={"plan": "pro", "email": "user@example.com"},
)

Tracking Signals

Track user feedback or other signals on AI responses:

raindrop.track_signal(
    event_id="evt_...",
    name="thumbs_up",
    signal_type="feedback",
    sentiment="POSITIVE",
)

Flush & Shutdown

Always flush before your process exits to ensure all data is sent:

raindrop.flush()       # flush pending data
raindrop.shutdown()    # flush + release resources

What Gets Captured

  • Agent invocations: input prompt, output text, model name
  • Token usage: prompt tokens, completion tokens, and cached tokens (from Bedrock/Anthropic cacheReadInputTokens / cacheCreationInputTokens)
  • Tool call spans: individual tool spans tracked via interaction.track_tool() with name, input, output, duration, and error
  • Finish reason: stop_reason or finish_reason from model responses (e.g., end_turn, tool_use)
  • Errors: error type and message captured in event properties
  • Async support: preserved via Strands' hook system

API

RaindropStrands(api_key, user_id, convo_id, project_id, tracing_enabled, bypass_otel_for_tools, disable_auto_instrument, debug)

Option Type Default Description
api_key str | None None Raindrop API key (rk_...). Omit to disable telemetry
user_id str | None None Associate all events with a user
convo_id str | None None Group events into a conversation
project_id str | None None Route events to a specific project (slug); omit for the default Production project
tracing_enabled bool True Enable OTEL-based tracing
bypass_otel_for_tools bool True Bypass OTEL for tool spans
disable_auto_instrument bool True Library auto-instrumentation is opt-in (see below)
debug bool False Enable debug logging

Library auto-instrumentation is opt-in

As of 0.0.3, disable_auto_instrument defaults to True: the integration no longer lets Traceloop monkey-patch every LLM client library it recognizes in your process (including the botocore machinery Strands' default Bedrock provider drives). The hook handler captures input/output, token usage, model name, and tool calls directly from Strands hook events, so no library patching is needed for full dashboards.

If you specifically want LLM-call-level spans from library instrumentation and have verified compatibility in your environment, opt back in with disable_auto_instrument=False.

Properties:

  • handlerRaindropEventHandler instance to register on agents

Methods:

  • flush() — flush pending telemetry
  • shutdown() — flush and release resources
  • identify(user_id, traits) — identify a user with optional traits
  • track_signal(event_id, name, ...) — track a signal event

Testing

cd packages/strands-python
pip install -e '.[dev]'
python -m pytest tests/ -v

Full Documentation

See the Raindrop Strands integration docs for full details.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

raindrop_strands-0.0.10.tar.gz (36.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

raindrop_strands-0.0.10-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file raindrop_strands-0.0.10.tar.gz.

File metadata

  • Download URL: raindrop_strands-0.0.10.tar.gz
  • Upload date:
  • Size: 36.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for raindrop_strands-0.0.10.tar.gz
Algorithm Hash digest
SHA256 4ed978cbec0cbb7ae141ff568846afe36ffaead5f990e0b3af60d8a314274506
MD5 6f78287f0e17d758b0b56528d307a0a7
BLAKE2b-256 f0a59f8eed1b4624a4a456b72c7f1ac5a1ce887356266e5f94e3ec331396dde1

See more details on using hashes here.

File details

Details for the file raindrop_strands-0.0.10-py3-none-any.whl.

File metadata

File hashes

Hashes for raindrop_strands-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 3f5df485a38816b459d68cf8f88c3bf26c36b99611ea78d84d2d99728f7f0472
MD5 7a351a3829a40bb08c9b8f13dbb35798
BLAKE2b-256 0f70b20a344af99c443ed929988e5ef37379b62dee0047f86a84a4104b6c5cb5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page