Environment variables, API key formats, provider configuration, and SDK options.
| Variable | Required | Description |
|---|---|---|
INVARIANCE_API_KEY | Yes | API key for authentication. Formats: inv_*, dev_*, org_* |
INVARIANCE_API_URL | No | API endpoint. Default: https://api.useinvariance.com |
INVARIANCE_PRIVATE_KEY | No | Ed25519 private key (64 hex chars) for signing receipts |
ANTHROPIC_API_KEY | No | Used for narrative synthesis (LLM-summarized run views) |
Invariance uses tiered API keys with different permission levels:
| Prefix | Type | Scope |
|---|---|---|
dev_* | Developer | Full access to developer resources |
org_* | Organization | Access scoped to organization resources |
inv_* | Scoped API Key | Per-function access control via api_keys table |
(agent key) | Agent | Per-agent auth, scoped to agent resources |
Full configuration object for Invariance.init():
interface InvarianceConfig {
apiKey: string; // Required. API key for authentication
apiUrl?: string; // Default: "https://api.useinvariance.com"
privateKey?: string; // Ed25519 private key (64 hex chars)
policies?: PolicyRule[]; // Local policy rules
flushIntervalMs?: number; // Batch flush interval (default: 5000ms)
maxBatchSize?: number; // Max batch size (default: 50)
maxQueueSize?: number; // Max queue size (default: 1000)
onError?: (err: InvarianceError) => void; // Error callback
mode?: 'DEV' | 'PROD'; // Observability mode (default: 'PROD')
sampleRate?: number; // Trace sampling rate in PROD mode
devOutput?: 'ui' | 'console' | 'both'; // DEV mode output
onMonitorTrigger?: (event: MonitorTriggerEvent) => void; // Monitor callback
monitorPollIntervalMs?: number; // Monitor poll interval
}# ── Invariance Core ──
INVARIANCE_API_KEY=inv_8417fb46c0f79dec84eb91ccf08e2ca20a0932ea9e4bdc7ec11cedff22914ffd
INVARIANCE_API_URL=https://api.useinvariance.com
INVARIANCE_PRIVATE_KEY=28fb14d95e2ac3126d23b82497b0d4e8e4b04473a46015d939e9979fd84fce8e
# ── LLM Providers (for judge evals) ──
ANTHROPIC_API_KEY=sk-ant-api03-...
OPENAI_API_KEY=sk-...
# ── Testing ──
# EVAL_JUDGE_MOCK=true