relia-sdk
v0.2.42
Published
Zero-config observability SDK for [RELIA](https://github.com/relia-platform). Instruments Node.js services, browser sessions, and AI agents with a single CLI command.
Downloads
4,049
Readme
relia-sdk
Zero-config observability SDK for RELIA. Instruments Node.js services, browser sessions, and AI agents with a single CLI command.
Quick Start
npm install relia-sdk
npx relia initThe interactive CLI asks what you want to monitor and generates everything automatically.
What It Monitors
| Type | What's captured | Where data goes |
|------|----------------|-----------------|
| Log monitoring | HTTP requests, latency, status codes, traces | OTel Collector → ClickHouse |
| Session monitoring | Clicks, inputs, navigation, errors (journey events) | ClickHouse sessions / session_events |
| Agent monitoring | LLM runs, tool calls, tokens, cost, latency | ClickHouse agent_runs / agent_steps |
Install
npm install relia-sdkLog Monitoring (Node.js / Express)
Programmatic
const relia = require("relia-sdk/node");
relia.start({
serviceName: "my-api",
projectId: "your-project-id",
otlpEndpoint: "http://localhost:4318/v1/traces",
});
app.use(relia.expressMiddleware());
app.use(relia.expressErrorHandler());CLI
npx relia init
# Choose option 1: Log monitoring
# Enter your project ID
# Generates relia.tracing.js and patches your entry fileSession Monitoring (Browser)
import { Relia } from "relia-sdk";
Relia.init({
endpoint: "http://localhost:8000/api/v1",
project_id: "your-project-id",
replay: false, // logs-only (default)
});Agent Monitoring
Express / Node.js
npx relia init
# Choose option 3: Agent monitoring
# Enter your agent ID (from the RELIA Agents page)Next.js / Vercel AI SDK (zero-config)
Just install the package — the postinstall automatically patches next.config.ts:
npm install relia-sdkNo code changes needed. Every streamText/generateText call is instrumented automatically.
Programmatic
const { traceStreamText } = require("relia-sdk");
const settings = traceStreamText(
{ model: myModel, messages: [...] },
{ agentId: "my-agent", agentName: "My Agent" }
);
const result = await streamText(settings);CLI Commands
npx relia init # Interactive setup (log / session / agent)
npx relia --help # Show all optionsEnvironment Variables
| Variable | Description | Default |
|----------|-------------|---------|
| RELIA_AGENT_ID | Agent identifier | sha1 of package name |
| RELIA_AGENT_NAME | Agent display name | agent id |
| RELIA_AGENT_ENDPOINT | Agent run reporting endpoint | http://localhost:8000/api/v1/agents/runs |
Exports
| Import path | Description |
|-------------|-------------|
| relia-sdk | Browser entry (session monitoring + agent tracing) |
| relia-sdk/node | Node.js entry (OpenTelemetry tracing + Express middleware) |
| relia-sdk/agent | Agent monitoring (Express middleware) |
| relia-sdk/ai-bridge | Vercel AI SDK auto-instrumentation proxy |
| relia-sdk/cli | CLI entry (npx relia init) |
Requirements
- Node.js >= 18
- A running RELIA backend (or OTel Collector + ClickHouse)
License
MIT
