Skip to content
Crumple

Docs

Crumple sits between your agent and the world. Your agent asks; the gate decides from the contract, the facts you checked and your rules; the ledger records everything.

Going to production? Read where the gate goes, which guards to set, and how to crash-test every update in CI.

Quickstart

  1. Create a free account. You get a workspace and three free crash tests a day.
  2. Run a crash test from the dashboard on any Claude model, or on your agent with its own prompt.
  3. In Connect, create an API key. Send each action to the gate before you run it:
curl -X POST https://tether.wamasoda.com/api/v1/intents \
  -H "Authorization: Bearer $CRUMPLE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contract": "payments.refund",
    "input": { "orderId": "ord_4821", "amount": 120, "currency": "USD",
               "destination": "original_method", "reason": "Parcel lost" },
    "mode": "sandbox",
    "probes": { "order.exists": true, "order.paid": true, "refund.within_remaining": true,
                "refund.currency_matches": true, "refund.original_method": true },
    "targets": ["cus_1"], "scope": ["cus_1"]
  }'

Your first hour, by what you build

When you sign up, Crumple asks what you are testing and which field you work in, then shows these steps on your Overview. Each step is ticked from real data, not by clicking.

An AI agent

  1. Add the agent with its model and instructions in Agents and models.
  2. Describe its job in Scenarios. Crumple writes a test world, the actions and the situations that tempt it.
  3. Run a crash test and read the report.
  4. Write a contract for each action it takes in production.
  5. Put the gate in front of those actions with the SDK, the HTTP API or the MCP gateway.

An AI model

  1. Pick a Claude model, or add your own key for any OpenAI-compatible model.
  2. Run the 20 built-in traps: money, email, CRM, permissions and a robot arm.
  3. Run the next version and compare the two runs trap by trap.

A robot

  1. Try the simulator in Robots: command the arm and watch the gate stop unsafe moves.
  2. Write a contract for each motion from the Move a robot template: safe zone, top speed, checks, approvals.
  3. Crash-test a robot world, such as the tea-serving arm or the hospital delivery robot.
  4. Connect the real robot: HTTP from Python, a ROS 2 node, an ESP32, or a USB device from the browser.

Action contracts (open spec)

A contract describes one action: what it changes (effects), whether it can be undone (undoable, compensable or irreversible), how far it can reach (blast radius: amounts, rates, recipients, a safe zone), what must be true first (preconditions), when it is a duplicate (idempotency) and when a human must approve.

The format is JSON Schema, Apache 2.0: action-contract.schema.json. Built-in examples live under /spec/v0/contracts/, for example payments.refund@1.json.

Published versions never change. To change a contract, publish the next version. Every trace records the exact version that applied.

Writing a contract in the app

Open Contracts and choose Write a contract. Start from a template for your field (a bank transfer, a patient record update, a prescription refill, a support refund, a deploy, a robot move or a hot drink pour) and change it in five steps:

  1. Name the action and say in one line what it does.
  2. List what the agent sends. Anything not listed is refused.
  3. Pick what it changes and whether it can be undone.
  4. Set the limits: the largest amount, how many in a time window, no repeats, a safe zone, a top speed.
  5. Add the checks your code confirms first, and when a person must approve.

The right side explains the contract in plain words as you type, and shows the JSON. A published version never changes: to change it, publish the next version. Each contract page shows how to call it from TypeScript, Python and curl, and its latest gate decisions.

The gate API

POST /api/v1/intents with Authorization: Bearer tk_.... Send the contract id, the input, the mode, and the probes: the facts your server checked, named like the contract's preconditions. Add targets (who this touches) and scope (who the task is allowed to touch). Reuse traceId to keep one agent session in one trace.

  • allowRun the action, then report the outcome.
  • blockDo not run it. The message says why in plain words, for the agent to recover.
  • holdWait for a human. Do not retry.

Checks run in this order and are all recorded: contract, schema, preconditions, idempotency, blast radius, scope, rate limit, authority, approval, mode. Then report what happened with POST /api/v1/outcomes, including the undo handle. GET /api/v1/contracts lists the contracts your workspace can use.

Holds and approvals

When a contract says a human must approve (for example a refund over 200), the gate returns hold. Workspace admins get an email, and the action waits in Approvals. Poll GET /api/v1/holds/:intentId until it is approved or rejected, or call crumple.waitForApproval(intentId) in the SDK. On approval the gate checks everything again before saying allow. An agent can never approve its own action.

MCP agents (Claude Desktop, Cursor, any MCP client)

If your agent uses MCP tools, Crumple can sit in front of your MCP server without code changes. Each tool maps to the contract mcp.<server>.<tool>, or to any contract you name in a mapping file (--map tools.json, for example { "refund_order": "payments.refund" }). A tool with no contract is blocked.

  1. Step 1

    List your tools as contracts

    Run npx -y @crumple/mcp-gateway contracts --name shop -- <your server command>. It prints a draft contract for every tool: tools your server marks read-only are let through, anything else waits for a person. Edit the limits and publish them in Contracts.

  2. Step 2

    Swap one line in your MCP config

    Put npx -y @crumple/mcp-gateway proxy -- in front of the command that starts your server. Your agent sees the same tools with the same names.

  3. Step 3

    Every call now passes the gate

    Allowed calls run on your server and the result is recorded. Blocked calls never reach it. Held calls wait in Approvals, and run when the agent tries again after a person approves.

{
  "mcpServers": {
    "shop": {
      "command": "npx",
      "args": ["-y", "@crumple/mcp-gateway", "proxy", "--name", "shop",
               "--", "npx", "-y", "your-shop-mcp-server"],
      "env": { "CRUMPLE_API_KEY": "tk_...", "CRUMPLE_MODE": "live" }
    }
  }
}

Needs Node 20 or later. To practise first, run the gateway from a clone of the Crumple repo with no arguments and CRUMPLE_TRAP=double-refund-timeout: a local sandbox shop with one of the built-in traps, no key needed.

Robots

A robot is gated the same way as a refund. Your controller asks the gate before each motion, with the facts it measures, such as area.clear_of_people or sensor.ok. The gate checks the safe zone, the top speed and your rules, and answers allow, block or hold. Only allowed moves run.

  • HTTP from Python on a Raspberry Pi or a PC, with pyserial for the motor board.
  • A ROS 2 node that forwards only allowed goals to the planner.
  • An ESP32 that calls the gate over Wi-Fi before driving its servos.
  • A USB device from Chrome or Edge: the Connect a robot tab asks the gate and writes only allowed lines to the device. Your sketch acts only on lines it receives.

Code for each is in Robots, Connect a robot. Before the real robot, crash-test the model that drives it in a robot world: a simulated room with people, objects and faults. No real robot moves in a crash test.

Crash tests

A built-in crash test runs your agent against twenty traps in a sandbox copy of a small shop and a simulated robot arm, several times each. It produces a risk score with a published method, the spread between runs, and a verifiable trace for every episode. Bring Claude, or any OpenAI-compatible endpoint with your own key.

Custom scenarios for any agent

In Scenarios, describe your agent: what it does, what it can act on, the tasks it should handle and what worries you. Crumple writes a suite for you to review: the world as a JSON state, your agent's actions as contracts, named checks (probes) the gate runs against the state, and 9 to 12 scenarios across expected tasks, misuse and edge cases. Start from the AI flight instructor template to see a complete one.

During a run, a model simulates the world's answers, but the gate never trusts it: every precondition is a rule checked against the state, such as input.altitude_ft >= state.limits.msa_ft. Each scenario is judged by its rules: must_attempt, must_execute, never_attempt, never_execute and max_executions. Runs keep a frozen copy of the suite, so editing it later never changes an old score.

To test your own system rather than a model with a prompt, expose it as an OpenAI-compatible chat endpoint with tool calls and add it in Settings.

Security

  • The ledger is append-only, enforced by the database, and hash-chained, so any edit is detectable.
  • Workspaces are isolated by row level security. API keys are stored as hashes; model keys are encrypted.
  • The sandbox can never reach a live system. The gate decides from facts and rules, never from what the agent says.
  • Crumple is a guardrail and audit layer. It does not promise an agent is safe.