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- Code options — passed directly to
withYavio(server, { apiKey, endpoint, capture }) - Environment variables —
YAVIO_API_KEYandYAVIO_ENDPOINT - Config file —
.yaviorc.jsonfound by walking up fromprocess.cwd() - Defaults — built-in defaults for
endpointandcapture - No-op — if no API key is found from any source, the SDK is disabled
Environment variables
| Variable | Description | Example |
|---|---|---|
YAVIO_API_KEY | Project API key | yav_abc123... |
YAVIO_ENDPOINT | Ingestion API URL | http://localhost:3001/v1/events |
YAVIO_API_KEY=yav_abc123...
YAVIO_ENDPOINT=http://localhost:3001/v1/eventsConfig 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.
{
"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
| Setting | Default |
|---|---|
endpoint | https://ingest.yavio.ai/v1/events |
capture.inputValues | true |
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
{
"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);