Seer is currently in private beta. Email ben@seersearch.com to request access and receive SDK installation instructions.
Installation
The SDK supports both CommonJS and ES modules:Quick Start
Configuration
Environment Variables
| Variable | Description | Default |
|---|---|---|
SEER_API_KEY | API key (required) | — |
SEER_INGESTION_URL | Ingestion endpoint | https://api.seersearch.com/v1/log |
Constructor Options
SeerClient API
log()
Log a retrieval event.
fireAndForget=true(default):void, no await needed, event is queuedfireAndForget=false:Promise<string | null>, await to getrecord_id
flush()
Wait for all queued events to be sent.
stats()
Get client statistics.
ClientStats object:
close()
Shutdown client gracefully (flushes remaining events).
Context Format
Passages can be simple strings or objects with metadata:Function Wrapper
UsewrapWithSeerTrace to automatically log function calls:
Wrapper Parameters
| Parameter | Type | Description |
|---|---|---|
taskArgIndex | number | Index of argument containing the query |
contextArgIndex | number | Index of argument containing context |
contextFromReturn | boolean | Use return value as context |
metadata | Record<string, unknown> | Static metadata to attach |
sampleRate | number | Sampling rate (0.0-1.0) |
useOtelTrace | boolean | Use OTEL trace context (default: true) |
client | SeerClient | Client instance |
Fire-and-Forget vs Synchronous
Fire-and-Forget (Default)
Events are queued and sent asynchronously in the background. Noawait needed, just call log() and continue.
flush() explicitly before process.exit() or in worker threads.
Synchronous (Get Record ID)
If you need therecord_id back, use synchronous mode. The log() call returns a Promise that resolves to the record ID.
OpenTelemetry Integration
The SDK automatically captures OTEL trace context when available:Manual Trace IDs
Span Name Patterns
Span names are used for filtering in the UI:| Pattern | UI Color |
|---|---|
retrieval, retrieval_hop_N | Blue |
rerank, reranker | Purple |
llm_call, llm | Amber |
synthesis, answer | Emerald |
Ground Truth (Accuracy Testing)
Include expected results for accuracy measurement:Convenience Function
For simple cases, use the globalseerLog:
SeerClient on first call (fire-and-forget mode).
Error Handling
The SDK is designed to be non-blocking and fail gracefully:- Queue overflow: Events are dropped (logged to console)
- Network errors: Retried with exponential backoff, then dropped
- Invalid API key: Warning logged, event sent (server rejects)
client.stats() for failure counts.
TypeScript Types
The SDK exports all types for use in your application:Examples
- Basic usage
- OpenTelemetry integration
- Express middleware