Early Access Beta: free, no credit card needed. Sign up →

Blog

Shadow first: try a plan before anyone feels it

· The Ordainer team

This is the second how-to on smaller levers in Ordainer Cap. The first, One agent key per integration or AI agent, covered giving each caller its own agent key. This one covers trying a plan in shadow before anyone feels a block.

A plan is safest on real traffic when you can see what it would stop before it stops anything. Ordainer Cap calls that mode shadow.

In shadow, Cap still makes a real allow or deny decision for each call. Your code runs the tool either way. Denies show up as would-denies, so you can check whether the plan is aimed at the right traffic. When those rows look right, you switch the plan to enforce. From then on, a deny means the work does not run.

What stays the same in both modes

The decision does not change when you flip the mode. Cap checks the caller's agent key against the bound plan and answers allow or deny. Allowed calls count toward the plan. Denies do not.

What changes is what your code does with a deny:

  • enforce: do not run the tool.
  • shadow: run the tool anyway, and treat the deny as a would-deny in the console and in exports.

The rule for your handler is the same in every language Cap documents: run the tool if decision is allow or mode is shadow.

Start the plan in shadow

New sign-ups start with two plans in enforce, so add a new plan first. A new plan starts in shadow. The mode menu on Add plan says "Shadow (start here)".

Use the Move button on the Keys page to put one agent key per integration or AI agent on that plan, as in last week's post. A deny still applies only to that key.

Leave mode out of your decide requests so the plan's console setting applies. Sending "mode": "shadow" or "mode": "enforce" pins the call, and the console switch has no effect. Check your code for a pinned mode before you rely on the switch.

Watch the would-denies

While the plan is in shadow:

  • Console → Overview shows how many calls in the last 7 days would have been denied.
  • Console → Decisions has a Would-deny only checkbox. Each row reads would deny (call ran) and shows the customer, agent key, tool and reason.
  • Console → Plans shows how many would-denies each plan had in the last 7 days and in its current period, and on how many keys.
  • Export (CSV or JSON) marks those rows with decision = deny, mode = shadow and would_deny = true. Group them by reason, then by customer and key_label, to see what would break when you switch.

After a stretch of real traffic, ask: are these the calls the plan is meant to stop? If the cap is too low, edit it on Console → Plans. The new number applies from each key's next decision. This month's count carries over. Edits are recorded in the change log.

Switch to enforce

When the would-denies look right, click Enforce in that plan's Mode column on the Plans page. Your server picks up the new mode on its next call, as long as your code does not pin a mode. No deploy is required. The switch is recorded in the change log. To roll back, click Shadow in the same place.

A retry that reuses an idempotency key first seen in shadow, within 24 hours, gets the stored shadow answer back, even after the switch. Only new idempotency keys are decided in enforce.

In enforce, with the Node SDK middleware, a used-up plan answers your caller 429 with plan_limit_reached (or 402 if you set denyStatus that way). A tool the plan does not cover answers 403 with plan_denied. With plain HTTP, Cap still returns HTTP 200 with "decision": "deny", and your handler decides how to refuse the caller. Either way, the work does not run on a deny in enforce.

Shadow is not fail open

Shadow is what you do with a real deny. Fail open or fail closed is what you do when Cap cannot answer, for example on a timeout or a network or server error. That choice lives in your client code. In the Node SDK the default is fail open.

A note for the beta

During the beta everyone is on test keys that share your organization's monthly test limit of 1,000 allowed decisions. Only allows count against it. Shadow does not block a call for hitting a plan or that test limit. Need more than the test limit for a pilot? Tell us through the form on ordainer.ai. Live keys are not available yet.

Next Thursday: what your caller sees when the plan says no.

Try it

Ordainer is free during the beta: sign up for test keys with 1,000 decisions a month, no credit card needed. The docs walk through rolling out with shadow mode and your first deny.

If an integration or AI agent on your API ever ran wild, or if you have run a limit in a watch-only mode before turning it on, tell us how it went through the form on ordainer.ai.

The Ordainer team

← All posts

Follow the blog by RSS