Installation
Quick Start: Interaction API
The Interaction API uses a simple three-step pattern:Begin()– Create an interaction and log the initial user input- Update – Optionally call
SetProperty,SetProperties,SetInput, orAddAttachments Finish()– Record the AI’s final output and close the interaction
Example: Chat Completion
Updating an Interaction
Update an interaction at any point usingSetProperty, SetProperties, SetInput, or AddAttachments:
Resuming an Interaction
If you no longer have the interaction object returned fromBegin(), resume it with ResumeInteraction():
Single-Shot Tracking (TrackAI)
For simple request-response interactions, you can use TrackAI() directly:
We recommend usingUseBegin()→Finish()for new code to take advantage of partial-event buffering, tracing, and upcoming features like automatic token counts.
TrackEvent() for non-AI events:
Tracking Signals (Feedback)
Signals capture quality ratings on AI events. UseTrackSignal() with the same event ID from Begin() or TrackAI():
Identifying Users
Attachments
Attachments let you include additional context—documents, images, code, or embedded content—with your events. They work with bothBegin() interactions and TrackAI() calls.
Configuration
Call
client.Close() before your process exits to flush any buffered events and spans. If writeKey is omitted, the client becomes a no-op instead of failing.
Projects
PassWithProjectID to scope every event from a client to a specific project. Under the hood this sets the X-Raindrop-Project-Id header on each request.
^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$).
Omitting WithProjectID (or passing "default") sends to the default Production project, which is the existing behavior, so single-project orgs need nothing here. See Projects for isolation, archival, and the full behavior table.
Tracing
Tracing captures detailed execution information from your AI pipelines—multi-model interactions, chained prompts, and tool calls. This helps you:- Visualize the full execution flow of your AI application
- Debug and optimize prompt chains
- Understand the intermediate steps that led to a response
Using WithSpan
Use WithSpan to trace tasks or operations:
Using WithTool
Use WithTool to trace agent tool calls with automatic input/output capture:
WithTool is a generic function—the return type matches your callback’s return type.
Manual Tool Tracking
For more control over tool span tracking, useTrackTool or StartToolSpan.
TrackTool – Retroactive Logging
Use TrackTool to log a tool call after it has completed:
StartToolSpan – Real-Time Tracking
Use StartToolSpan to track a tool as it executes:
Standalone Tracer
UseTracer() for batch jobs or non-conversation work where you still want spans and tool traces:
Span Attributes
The SDK provides helpers for creating OTLP-compatible attributes:That’s it! You’re ready to explore your events in the Raindrop dashboard. Ping us on Slack or email us if you get stuck!