Yavio

Configuration

Precedence chain, environment variables, and config file format

The SDK resolves configuration from multiple sources with a clear precedence order. The first source that provides a value wins.

Precedence chain

Code options → Environment variables → .yaviorc.json → Defaults → No-op
  1. Code options — passed directly to withYavio(server, { apiKey, endpoint, capture })
  2. Environment variablesYAVIO_API_KEY and YAVIO_ENDPOINT
  3. Config file.yaviorc.json found by walking up from process.cwd()
  4. Defaults — built-in defaults for endpoint and capture
  5. No-op — if no API key is found from any source, the SDK is disabled

Environment variables

VariableDescriptionExample
YAVIO_API_KEYProject API keyyav_abc123...
YAVIO_ENDPOINTIngestion API URLhttp://localhost:3001/v1/events
.env
YAVIO_API_KEY=yav_abc123...
YAVIO_ENDPOINT=http://localhost:3001/v1/events

Config file

The SDK walks up the directory tree from process.cwd() looking for a .yaviorc.json file. This is useful for local development and monorepo setups.

.yaviorc.json
{
  "apiKey": "yav_abc123...",
  "endpoint": "http://localhost:3001/v1/events"
}

Place it in your project root or any parent directory. The nearest file wins.

Add .yaviorc.json to your .gitignore to avoid committing API keys.

Defaults

SettingDefault
endpointhttps://ingest.yavio.ai/v1/events
capture.inputValuestrue

Capture options

The capture object controls which data is collected.

withYavio(server, {
  capture: {
    inputValues: false, // Don't capture tool input key names/types
  },
});

Example configurations

Production (Yavio Cloud)

// Code — just the API key, everything else uses defaults
withYavio(server, {
  apiKey: process.env.YAVIO_API_KEY,
});

Local development

.yaviorc.json
{
  "apiKey": "yav_dev_key",
  "endpoint": "http://localhost:3001/v1/events"
}
// No options needed — config file is auto-discovered
withYavio(server);

Disabled (CI / testing)

// No API key anywhere → no-op mode, zero overhead
withYavio(server);

On this page