Skip to content
ndStill is in development. These docs describe the v2 API as designed; the SDKs and the hosted MCP server are previews and not generally available.
Docs

The decision pipeline

The 11 stages every payment passes through, the gate strip, outcomes and plain-language reasons.

Every payment an agent makes goes through one decision pipeline: the same code for a card authorization, a pay() call, an x402 challenge, a bank payout or a simulated payment in test mode. It has 11 stages. Each stage writes a trace entry, and the trace is what the gate strip draws.

The 11 stages#

The 11 decision stages
#StageWhat it checksWhen it fails
1IdentityThe agent, its key or passport, and its org.Declines
2Plan and go-livePlan limits, verification status, sandbox or live.Declines
3Freeze checkNo freeze on the agent, its tree, team, org, credential or funding source.Declines
4Funding sourceA funding source the agent may use, with access.Declines
5CounterpartyWho is being paid, and how sure we are.Never stops a payment
6Mandate matchThe payment fits a signed human instruction.Holds
7Policy rulesLimits, allow and block lists, categories, time windows.Holds or declines
8RiskVelocity, spikes, loops, odd hours, sanctions.Holds
9BudgetRoom in every budget in scope; reserves the amount.Holds or declines
10Approval thresholdWhether a person must approve, and how.Holds
11Sign and recordThe decision is signed and written to evidence.Never stops a payment

Stages run in order. A stage that declines ends the decision: later stages are not reached, and only the final sign-and-record stage still runs, so the decline itself is signed. A stage that holds does not stop the pipeline: every later stage still runs, so a held payment reports all of its hold reasons at once, not just the first.

The pipeline is deterministic. It makes no model calls and no network calls beyond ndStill's own budget ledger and caches, so the same request against the same policy version always gets the same outcome. Every decision records the policy_version_hash it used, which is what makes replay exact.

Outcomes#

A decision (dec_…) has one of three outcomes:

Decision outcomes
OutcomeWhat happens nextPayment status
approveBudgets are reserved, a scoped credential is minted, and the agent pays.Approved, then Authorized and Settled
holdAn approval (apr_…) is created and routed to people. Nothing is reserved yet.Held
declineThe agent gets structured reasons it can act on. Nothing is reserved.Declined

When a person approves a held payment, the pipeline runs again from the top. Approval never skips a freeze, a budget check or a policy that changed while the payment waited.

Reading the gate strip#

The console, the mobile app and these docs draw a decision as a strip of 11 blocks, one per stage:

  • Passed
  • Held here
  • Declined here
  • Not on this rail
  • Not reached
Approved: every stage passed, and the decision was signed.
  • Passed
  • Held here
  • Declined here
  • Not on this rail
  • Not reached
Held twice: a first-time seller (policy rules) and above the approval line. Both reasons are reported.
  • Passed
  • Held here
  • Declined here
  • Not on this rail
  • Not reached
Declined at the freeze check: the agent is frozen. Later stages were not reached; the decline is still signed.
  • Passed
  • Held here
  • Declined here
  • Not on this rail
  • Not reached
An AI-provider call: there is no mandate check on usage-based rails, so that stage shows as not on this rail.

Colour is never the only signal. The skipped stage is a different shape, every strip has a text equivalent for screen readers, and each block has a tooltip with the stage's detail.

The trace#

The trace is an array on the decision, one entry per stage reached:

JSON
{
  "id": "dec_01JD9A7K2M",
  "object": "decision",
  "outcome": "hold",
  "rail": "card",
  "reasons": [
    {
      "code": "approval_required_amount",
      "stage": "approval",
      "effect": "hold",
      "params": { "amount": { "amount": 54000, "asset": "USD" }, "threshold": { "amount": 30000, "asset": "USD" } }
    }
  ],
  "trace": [
    { "stage": "authenticate", "result": "pass", "detail": "Agent key akey_7Q2… verified", "ms": 1 },
    { "stage": "entitlement", "result": "pass", "detail": "Live mode; plan limits OK", "ms": 0 },
    { "stage": "freeze", "result": "pass", "detail": "No freeze on the agent, its tree, team, org or funding source", "ms": 1 },
    { "stage": "funding", "result": "pass", "detail": "Travel card program (Stripe Issuing)", "ms": 2 },
    { "stage": "counterparty", "result": "pass", "detail": "Delta Air Lines (confidence 0.97)", "ms": 3 },
    { "stage": "mandate", "result": "pass", "detail": "Within mandate (up to $600.00)", "ms": 1 },
    { "stage": "policy", "result": "pass", "detail": "Within $1,000.00 per payment; category allowed", "ms": 1 },
    { "stage": "risk", "result": "pass", "detail": "Normal pace (2 payments in 10 min)", "ms": 4 },
    { "stage": "budget", "result": "pass", "detail": "Within Travel desk's monthly budget ($2,310.00 of $5,000.00)", "ms": 14 },
    { "stage": "approval", "result": "hold", "detail": "$540.00 is above the $300.00 approval line.", "code": "approval_required_amount", "ms": 0 },
    { "stage": "record", "result": "pass", "detail": "Decision signed (held)", "ms": 18 }
  ],
  "policy_version_hash": "sha256:9f2c…",
  "latency_ms": 45
}

Each entry is { stage, result, detail, code?, ms }. result is pass, hold, decline or skip. Fetch a decision with GET/decisions/{id}, or read the compact gate marks that every payment carries in its gates field.

Reasons, written for people#

Reasons are what an agent, an approver and an auditor all read. Each has a machine code, the stage that produced it, its effect, and parameters, and the API renders a sentence from them: "Over the Travel desk's weekly budget by $112.00", not BUDGET_EXCEEDED. Agents should branch on the code; people read the sentence.

Decline and hold reason codes
CodeStageExample message
agent_unknown1 IdentityThis agent isn't registered in the org.
key_revoked1 IdentityThe agent used a key that has been revoked.
passport_invalid1 IdentityThe agent's request signature didn't match its passport.
plan_limit2 Plan and go-liveThe org's plan limit for this has been reached.
verification_required2 Plan and go-liveThe org must finish verification before live payments.
sandbox_only2 Plan and go-liveThis agent can only make test payments.
agent_frozen3 Freeze checkTravel desk is frozen.
tree_frozen3 Freeze checkThe agent tree under Travel desk is frozen.
team_frozen3 Freeze checkTravel desk is frozen.
org_frozen3 Freeze checkEvery agent in the org is frozen.
credential_frozen3 Freeze checkThe credential used for this payment is frozen.
funding_frozen3 Freeze checkThe funding source Travel desk is frozen.
no_funding_access4 Funding sourceTravel desk isn't allowed to use Travel desk.
funding_insufficient4 Funding sourceTravel desk doesn't have enough available for $612.00.
mandate_missing6 Mandate matchNo signed mandate covers this payment.
mandate_amount_mismatch6 Mandate match$612.00 is above the mandate's limit of $600.00.
mandate_counterparty_mismatch6 Mandate matchThe mandate is for Delta Air Lines, but the agent is paying Acme Air.
mandate_expired6 Mandate matchThe mandate covering this payment has expired.
mandate_uses_exhausted6 Mandate matchThe mandate has already been used as many times as allowed.
over_per_payment_limit7 Policy rules$612.00 is over the $500.00 limit per payment.
blocked_counterparty7 Policy rulesAcme Air is on the block list.
blocked_category7 Policy rulesGambling purchases are blocked by policy.
outside_time_window7 Policy rulesPayments aren't allowed at this time of day by policy.
first_time_counterparty7 Policy rulesFirst payment to Acme Air; policy holds new sellers.
confidence_below_floor7 Policy rulesThe agent's confidence was below the policy's floor.
velocity8 Risk9 payments in 10 minutes is faster than usual for Travel desk.
spend_spike8 Risk$612.00 is far above Travel desk's usual payment.
loop_detected8 RiskThe agent sent the same request repeatedly; this looks like a loop.
off_hours8 RiskThe payment came outside this agent's usual hours.
price_drift8 RiskThe price drifted from what the mandate expected ($600.00).
stolen_key_signal8 RiskThe agent's key was used from an unfamiliar place.
sanctions_hit8 RiskAcme Air matched a sanctions list.
over_budget9 BudgetOver Travel desk's weekly budget by $112.00.
budget_nearly_exhausted9 BudgetThis would use the last of Travel desk's weekly budget.
approval_required_amount10 Approval threshold$612.00 is above the $250.00 approval line.
approval_required_counterparty10 Approval thresholdPayments to Acme Air always need approval.
approval_required_policy10 Approval thresholdPolicy requires a person to approve this payment.
rejected_by_personAfter the decisionRejected by Priya Shah: Not this vendor.
approval_expiredAfter the decisionNobody approved this in time, so it expired.
rail_errorAfter the decisionThe Not this vendor returned an error; no money moved.

Three more codes appear after the decision rather than inside it: rejected_by_person, approval_expired and rail_error.

Where decisions come from#

Most decisions start with an agent's pay() call. Some start elsewhere, and still go through the same stages:

  • Card authorizations. When an agent uses an ndStill card, or a card on a program the owner connected, the processor's authorization webhook comes to ndStill. The decision service matches it to the open reservation from the approved payment, or decides it fresh against policy (a recurring charge, for example). This is the strictest path; it is designed for a p99 under 300 ms.
  • 402 challenges. The SDK's x402 hook, or the MCP pay_402 tool, passes the challenge's amount, asset, payTo and resource to ndStill before the wallet signs.
  • The AI proxy. Each model call reserves its maximum cost before the request goes upstream.
  • Simulations and replays. The same code runs with simulate: true, against a snapshot, with nothing reserved or minted.

Timing and reliability#

Each stage reports its own ms, and the decision records latency_ms. Budget reservation and signing take most of the time; the policy itself evaluates in memory. When a dependency is slow, each rail has a documented fallback: card programs are minted with spending controls equal to their scope, so a processor that falls back to its own rules still cannot exceed the mandate. See Cards and issuing.