Skip to main content
A policy is the thing standing between an agent and your money, so the expensive mistakes are both directions: a rule that refuses work you meant to allow, and a rule that allows work you meant to refuse. Three steps separate writing a rule from letting it decide anything real.

Before you start

Identifiers
KORDIO_AGENT_KEY is the test agent’s key. A policy belongs to one agent, so the two agent ids matter: rolling out means writing the rules against the live agent once they behave. The amounts here assume the agent’s starter policy is disabled, as the quickstart does in step 2. Leave it on and it holds anything over $100 for a person before your own rules get a say.

1. Preview the draft against nothing

policy_previews evaluates a policy you have not saved, on a request that never happened:
200 OK
No policy, no intent, no reservation, no audit event. The rule_id is minted for that one evaluation and thrown away, so it will not match the id the rule gets when you save it. imports resolve against the modules the workspace really has, so a draft that builds on a saved module previews honestly. session_budget_cents sets the synthetic budget and defaults to 100000. Previewing needs only the read capability, deliberately, because it changes nothing. Two things preview will not tell you. It evaluates the draft alone, so it says nothing about how the draft interacts with the agent’s other active policies, and window rules read the agent’s real recent usage rather than a clean slate.

2. Let a test agent run into it

Save the draft against the test-mode agent:
201 Created
A test agent runs the same engine, the same rules, and the same shapes as a live one. Replay yesterday’s real requests through it, either as real authorizations or through simulate, which records an action.simulated audit event and reserves nothing:
200 OK
Unlike preview, this runs every active policy on the agent, which is the number you actually care about before promoting anything.

3. Read what it held, test agents only

Held intents can be narrowed to one agent mode, so a live queue is not polluted by a rehearsal:
200 OK
The console does the same thing on the Approvals page, where the queue filters to all agents, live agents, or test agents. agent_mode accepts live or test, and anything else is a 400 rather than a silent full listing, because answering a narrowed question about held money with every intent in the workspace is the wrong way to be wrong. The same filter works on payment_intents.

4. Promote it to the live agent

Write the proven rules against the live agent. Create it turned off, check it reads the way you expect, then flip it:
201 Created
A disabled policy is still validated when you save it, and is left out of evaluation entirely. Turn it on when the diff reads right:
200 OK
Disabling is not a safe rollback for an agent’s only policy. An agent with no active policy denies everything with the rule no_policy, so turning the last one off stops the agent rather than opening it up. Roll back by editing the rule, or by activating the policy you are replacing before disabling this one.
Both agents now carry the same rules twice. A policy module removes the duplication, at a price worth knowing: editing a module changes every policy that imports it, so a module shared by the test and live agents reaches live the moment you save it. Share the module once the rule is settled, not while you are still tuning it.

Next steps

Give an agent a budget for one run

The other half of a safe first run.

Require a person above a threshold

Resolve the holds this rollout produced.

Writing a policy

The rule kinds, modules, and the preview endpoint in full.

How a decision is reached

Evaluation order, and why the first denial wins.