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
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