One agent key per integration or AI agent
In When the only lever is the big switch, we wrote about a gap that shows up when one of a customer's callers runs wild: most of the controls you have still act on the whole customer. One reason is where the key lives. When a single key stands for the customer, stopping the runaway traffic means stopping everything that key can reach.
This post is the first how-to in a short series that turns that post's list of smaller levers into Cap steps. The first lever: give each integration or AI agent its own agent key, bound to a plan. A deny can then stop that one caller while the customer's other keys keep working.
What an agent key is for
In Cap, an agent key is the caller's identity. Each key belongs to one customer and one plan. When your handler asks Cap before the work runs (POST /v1/decide, or the SDK's decide / middleware), you send that key. Cap looks up the plan the key is bound to and answers allow or deny.
Counts are per key. Two keys on the same plan each get that plan's full allowance. There is no single total across all of a customer's keys today. That is what makes a narrow stop possible: the key that is over its plan is the one that gets the deny. One beta note: all your test keys also share your organization's monthly test limit, and only allows count against it.
Set it up in the console
You need a customer, a plan, and one key per caller. During the beta everyone is on test keys (ord_test_…). Live keys are not available yet.
Add the customer. In Console → Customers, use Add customer and name the company that points callers at your tool.
Add a plan. In Console → Plans, use Add plan. Pick a name, the tool the plan covers (or * for every tool), the allowance period and the maximum allows for that period. New plans you create start in shadow; the sandbox plans from sign-up stay in enforce for the first-deny demo. Mode can wait for a later post. Binding the key is what matters here.
Create one agent key per caller. In Console → Keys, use Create key. Give the key a label that names the caller (for example the nightly sync, or a specific AI agent), choose the customer, choose the plan and leave the type as test. Cap shows the secret once. Copy it then; the console keeps only a hash, and later screens show the label plus the key's prefix.
Repeat Create key for each integration or AI agent that customer runs. Same customer and same plan is fine when you want the same allowance shape on each caller. Use Move on the Keys page to put one key on another plan of that customer or on a shared plan with the same period (month to month, for example). The secret stays the same; the new plan applies from the key's next decision, and this period's count carries over.
Put the right key in front of each caller
On your side, look up the agent key for the integration or AI agent about to call your tool, and send that key on the decide call.
With plain HTTP, that is the Bearer token:
curl -s -X POST https://api.ordainer.dev/v1/decide \
-H "Authorization: Bearer $ORDAINER_KEY" \
-H "Content-Type: application/json" \
-d '{"tool":"research.run"}'
With the Node SDK, install ordainer and pass the per-caller key into the client or into middleware (for example apiKey: (req) => keyFor(req)), so each route uses the key you issued to that caller. The Ruby gem and the Python package work the same way: one key per caller on each decide.
Do not put an agent key in a browser page. Cap's API is server-to-server and sends no CORS headers on purpose.
Name the key so you can tell callers apart
The label you type at Create key is what the Keys page shows for that key, and each row in a decisions export (CSV or JSON from Console → Decisions) carries it as key_label. A label like acme-nightly-sync or acme-support-agent is enough to see which caller a deny belonged to, without digging through shared traffic.
If a key is lost, make a new one on the Keys page and put the new secret in that caller's config. The old secret cannot be recovered.
What you get once keys are split
After each integration or AI agent has its own agent key, a deny for one key does not stop the customer's other keys. The decisions export shows which labeled key made each call, and you can move one key to another plan without touching the rest. If you need to stop one integration outright, revoke its key on the Keys page; the customer's other keys keep working. Deleting the customer is the step that revokes all of its keys at once, so save that for when the customer leaves.
That is the foundation the rest of this series builds on. Next Thursday we will cover trying a plan in shadow before it blocks anything, so you can watch would-denies on real traffic and then switch to enforce from the console.
Try it
Ordainer is free during the beta: sign up for test keys with 1,000 decisions a month, no credit card needed. Start in the docs with your first deny, then the Node / Express quickstart. The customers, plans, and keys page walks through one customer with three integrations and one runaway.
If you have already split keys per integration or AI agent on your own API, or if you are still on one shared key per customer, tell us how that has gone through the form on ordainer.ai.
The Ordainer team