voight.log() directly.
Library mode is provider-agnostic — wrap any LLM call (OpenAI / Anthropic / GLM / Mistral / your-own-proxy) and emit the event yourself. The backend MODEL_PRICING table ships entries for the major providers, so cost / token attribution lights up automatically as long as you set model on the event.
Install
- Node.js 18+ (uses global
fetch) - Bun, Deno, browsers, and Cloudflare Workers all supported
Quick start
{ ok: true, eventId, agentId } on success, { ok: false, error: { code, message } } on failure.
Constructor options
| Option | Type | Default | Purpose |
|---|---|---|---|
agentId | string | — | Your agent’s stable identifier. Recommend a SNS domain for autonomous bots (trading-bot.sol), a stable label for services (market-watcher). |
apiKey | string | — | From the dashboard. Required for ingestion. |
endpoint | string | https://api.voight.xyz | Override for self-hosted deployments. |
defaults | object | {} | Metadata merged into every event (e.g. { env: 'prod', region: 'us-east' }). |
swallowErrors | boolean | true | When true, voight.log() never throws — failures return { ok: false }. Recommended for production. |
fetch | function | globalThis.fetch | Inject a custom fetch (for tests, older runtimes). |
privacyLevel | 'minimal' | 'standard' | 'full' | 'full' | For library mode, defaults to Full. Pass 'standard' to get local PII scrubbing. |
The log() method
type: 'decision' if you don’t pass one.
Retry behaviour:
- 3 attempts by default
- Exponential backoff
- Respects
Retry-Afterheader on 429s - Swallowed by default (
swallowErrors: true) — recommended for production agents that shouldn’t crash on observability failures
Examples
Trading bot
ElizaOS character (skill plugin)
@voightxyz/eliza-skill) is on the roadmap and will simplify this to one line.
LangChain / LangGraph agent
Error types
swallowErrors: false, these throw. Otherwise they return as { ok: false, error }.
Privacy in library mode
By default, library callers send events as Full (no scrubbing). To opt into Standard scrubbing per-event:check() and enforce() — v1.0
{ allow: true, reason: 'not-implemented' } so you can instrument call sites now and flip a flag later. Real implementation ships in v1.0.
Next
- HTTP API — for runtimes that don’t use npm at all
POST /v1/events— full HTTP API schema for event ingestion