Skip to main content

Installation

Source code and releases live in raindrop-ai/go.

Quick Start: Interaction API

The Interaction API uses a simple three-step pattern:
  1. Begin() – Create an interaction and log the initial user input
  2. Update – Optionally call SetProperty, SetProperties, SetInput, or AddAttachments
  3. Finish() – Record the AI’s final output and close the interaction

Example: Chat Completion

Updating an Interaction

Update an interaction at any point using SetProperty, SetProperties, SetInput, or AddAttachments:

Resuming an Interaction

If you no longer have the interaction object returned from Begin(), resume it with ResumeInteraction():
ResumeInteraction() recovers an active in-memory interaction created by Begin() in the same process. It is not a cross-process restore mechanism. If the event ID is not found in memory, a new interaction handle is created for that ID.

Single-Shot Tracking (TrackAI)

For simple request-response interactions, you can use TrackAI() directly:
We recommend using Begin() → Finish() for new code to take advantage of partial-event buffering, tracing, and upcoming features like automatic token counts.
Use TrackEvent() for non-AI events:

Tracking Signals (Feedback)

Signals capture quality ratings on AI events. Use TrackSignal() 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 both Begin() 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.

Application Git provenance

The SDK reports raindrop.app.commit_sha, plus raindrop.app.commit_dirty and raindrop.app.branch when known. Without a selected source directory, Go prefers main-binary VCS build information, never dependency metadata, then reliable deployment metadata, bounded background application Git discovery, and provider-marked CI metadata. The first operations may omit metadata while discovery is pending; event calls, Close(), and flushing do not wait for it. Branch discovery is opt-in. Use WithAppGitDisabled() to disable all client enrichment. Setting AutoDetect to a pointer to false, or setting RAINDROP_GIT_AUTO_DETECT=false, disables automatic sources while retaining explicit config, canonical operation properties, and RAINDROP_COMMIT_SHA, RAINDROP_COMMIT_DIRTY, and RAINDROP_BRANCH. WithAppGitDisabled() does not remove canonical properties explicitly supplied on an operation. RAINDROP_GIT_DETECT_BRANCH=true enables branch discovery. The explicit values are a full 40- or 64-character hexadecimal SHA, true or false dirty state, and an ordinary branch string, respectively. Existing canonical operation properties always win, including invalid values; an overridden SHA does not acquire inferred dirty or branch values from another source. The properties are for reporting and filtering only, not simulation checkout selection, release, or SDK identity. Client config wins over the explicit Raindrop environment values and all automatic sources. A non-empty SourceDirectory or RAINDROP_GIT_SOURCE_DIRECTORY is made absolute and captured when the client is initialized. It exclusively selects the automatic AUT checkout after explicit config and RAINDROP_* identity values. If the repository is unavailable, metadata stays absent; ambient main-binary, build, deployment, and CI identity is not substituted. Discovery remains background work, so pending operations omit it without blocking.
This API requires the SDK release containing Git reporting. No version is documented until that release is published.

Projects

Pass WithProjectID 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 project slug is up to 63 lowercase letters, digits, and hyphens, and it must start and end with a letter or digit (^[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, use TrackTool 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

Use Tracer() 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!