Test mode, simulation and replay
Dry-run any payment through the whole pipeline, and replay real traffic against a new policy.
You should know what a policy will do before it runs on real money. ndStill gives you two tools for that: simulation, which runs one payment through the whole pipeline without moving anything, and replay, which re-runs a window of real history against a policy version you haven't activated yet.
Simulating a payment#
Every decision endpoint accepts a simulation. It runs the same pipeline code as a real payment, against a snapshot of the org, but with no reservation, no credential, no rail call and nothing written to evidence. You get the outcome it would have had, every reason, and the full trace.
curl -X POST https://api.ndstill.com/v2/decisions/simulate \
-H "Authorization: Bearer $NDSTILL_TEST_KEY" \
-H "Ndstill-Version: 2026-11-01" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "agt_01JD8Q3W6Z",
"amount": { "amount": 4200, "asset": "USD" },
"counterparty": "Delta Air Lines",
"rail": "card"
}'The response is a simulation object: would_outcome, reasons[], trace[] (one entry per stage with result, detail and milliseconds), the rail it would use, the budget_impact on each budget in scope, and the policy_version_hash it was evaluated against. Pass policy_version_id to test a draft version instead of the active one.
Simulations need the decisions:simulate scope. Test keys (nds_test_…) can only simulate: they never move money, so they're safe in CI and in agent development. Simulations are rate-limited separately and go to a cheaper audit stream, not to the evidence record.
In CI#
Treat policy like code. A typical setup keeps policies as YAML in your repository, validates every change with POST/policies/{id}/validate, and runs a handful of must-pass simulations:
// policy.test.ts — fails the build if a normal purchase would be blocked.
for (const p of [
{ counterparty: "Delta Air Lines", amount: 45000 },
{ counterparty: "Marriott", amount: 32000 },
]) {
const sim = await ndstill.simulate({ agent: TRAVEL_AGENT, amount: { amount: p.amount, asset: "USD" }, counterparty: p.counterparty });
expect(sim.would_outcome).not.toBe("decline");
}The MCP server offers the same as the simulate_payment tool, so an agent can check whether a payment would go through before it commits to a plan.
Replaying history#
Replay answers "what would this change have done last month?". It takes a policy version and a window of up to 92 days, re-runs every stored decision in the policy's scope against it (with its parent policies), and returns the difference:
{
"object": "replay",
"decisions_replayed": 1284,
"changed": 37,
"totals": {
"newly_held": 29,
"newly_declined": 6,
"newly_allowed": 2,
"amount_blocked": { "amount": 412300, "asset": "USD" },
"amount_newly_allowed": { "amount": 18000, "asset": "USD" }
},
"samples": [
{ "counterparty": "Hilton", "amount": { "amount": 61200, "asset": "USD" }, "before": "approve", "after": "hold", "reason": "$612.00 is above the $600.00 approval line." }
]
}Run it with POST/policies/{id}/replay. The console shows this diff before anyone activates a version. You can also replay an uploaded CSV or provider export (for example, last quarter's card statement) with replay uploads, which is useful before an agent has any history in ndStill.
Replays are exact because every stored decision records the policy_version_hash it was made with, and the pipeline is deterministic: no model calls, no network calls outside ndStill's own ledgers.
Try it here#
- The policy playground runs a pasted policy against a sequence of sample payments in your browser.
- Every endpoint in the API reference has a "try it" panel backed by an in-browser mock, with a test key.