Docs/Quick Start

Quick Start

From signup to your first instrumented run in under 60 seconds.

1. Get an API key

Sign in at platform.useinvariance.com and create a key under Settings → API keys → New API key.

2. Set the env var

bash
export INVARIANCE_API_KEY=inv_live_...

3. Instrument a run

Pick your stack — each block is the complete first run.

TypeScript

bash
npm install @invariance/sdk
instrument-run.tstypescript
import { Invariance } from '@invariance/sdk';

const inv = Invariance.init({ apiKey: process.env.INVARIANCE_API_KEY! });

await inv.runs.start({ name: 'hello-invariance' }, async (run) => {
  await run.log('prompt received', { prompt: 'Hello, world?' });
  await run.tool('greet', { who: 'world' }, async () => ({
    greeting: 'Hello, world!',
  }));
});

Python

bash
pip install invariance-sdk
instrument_run.pypython
from invariance import Invariance

inv = Invariance()  # reads INVARIANCE_API_KEY

with inv.runs.start(name="hello-invariance") as run:
    with run.step("greet", input={"who": "world"}) as s:
        s.output = {"greeting": "Hello, world!"}

CLI

bash
npm install -g @invariance/cli
bash
inv login --api-key "$INVARIANCE_API_KEY"
RUN=$(inv runs start --name hello --json | jq -r .id)
inv nodes write "$RUN" \
  --action-type tool_call \
  --input '{"who":"world"}' \
  --output '{"greeting":"Hello, world!"}'
inv runs update "$RUN" --status completed
inv runs inspect "$RUN" --json   # full run + nodes (agent-friendly)

MCP (for AI agents)

Add the MCP server to your Claude Desktop / Claude Code / Cursor config:

json
{
  "mcpServers": {
    "invariance": {
      "command": "npx",
      "args": ["-y", "@invariance/mcp"],
      "env": { "INVARIANCE_API_KEY": "inv_live_..." }
    }
  }
}

Then ask the agent: “Start a run named hello and write a node.”

4. View it in the dashboard

Open the Runs page in the dashboard — your run appears with its nodes, status, and a verifiable proof chain.

Next Steps

On this page
1. Get an API key2. Set the env var3. Instrument a run4. View it in the dashboardNext Steps