Run grants

Approve one request in a run and let the same action through for the rest of that run only: one agent key, one action, up to the approved amount, a number of uses you pick and at most 8 hours.

A long agent run can ask the same thing again and again: a support chat that refunds three items, a coding session that runs the tests after every change. Approving each one is noise, and an “always” rule is far more than you meant. A run grant sits in between. When you approve one request in a run, you can let the same action through for the rest of that run only, up to a number of times you pick, for at most 8 hours.

A €18.50 refund request from support-bot in the inbox, part of the run support-chat:48213, with “For the rest of this run, up to 10 more times” chosen and the note that it covers only that run from this agent, for 8 hours at most.

What a grant allows

A run grant is an ordinary allow rule, written in the name of the owner who approved. It is narrower than any other rule you can write. It covers a request only when all of these hold:

  • the same action, exactly, as the request you approved;
  • the same agent key;
  • the same run id, so another session of the same agent asks as usual;
  • an amount no larger than the one you approved, when the request stated one, in the same currency;
  • uses left, and less than 8 hours since it was written.

A request without a run id is never covered. Neither is another run, another key, another action or a larger amount: those ask a person, or go to whatever other rule covers them.

From the inbox

Next to Approve on a request that belongs to a run, owners see one more choice besides once, an hour, a day and always: for the rest of this run, with how many more times it may be approved without asking. The default is 10, and anything from 1 to 100 is accepted. Writing a rule is an owner’s right, so members only see Approve and Deny.

To deny the rest of a run there is already a button: Stop this run. A stop denies what waits in the run and refuses whatever it asks next, and any member may press it. So a grant only ever approves, and asking to deny with it is refused.

Over the API

The grant is part of the decision. Send remember: "run" with verdict: "approve", and remember_uses for how many more approvals it may give:

curl -X POST https://api.variantgate.com/v1/workspaces/$WORKSPACE_ID/requests/$REQUEST_ID/decision \
  -H "Authorization: Bearer YOUR_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "verdict": "approve",
    "remember": "run",
    "remember_uses": 10
  }'
remember
run: keep this approval for later requests in the same run. The other values are hour, day and always.
remember_uses
1 to 100, default 10. Only together with remember: run.

The API answers 422 when the request has no run id or no agent key, when the verdict is deny, or when the approval carries changes, since changes apply to one request only. Rules need Pro or above, and the grant counts as one of the workspace’s rules while it lasts.

Under Rules, and in GET /v1/workspaces/{id}/rules, a grant shows its run, how many approvals it may give and how many it has given:

{
  "id": "0196f2b4-1c3d-7e5f-a1b2-c3d4e5f6a7b8",
  "action": "support.refund",
  "agent_key_id": "0196f1a0-0a1b-7c2d-8e3f-4a5b6c7d8e9f",
  "effect": "allow",
  "limit_amount": "25.00",
  "limit_currency": "EUR",
  "ends_at": "2026-11-27T17:04:00Z",
  "run_id": "support-chat:48213",
  "max_uses": 10,
  "uses": 3,
  "created_by": "maya@northwind.example",
  …
}

What ends a grant

Whichever comes first:

  • its uses are spent;
  • 8 hours pass;
  • someone deletes the rule under Rules;
  • someone stops the run: what the run asks next is refused, grant or not;

A pause does not end a grant, it overrides it: while the workspace or the agent’s key is paused nothing is allowed, whatever was approved. After a resume the grant answers again if it still has uses and time left.

What still holds

  • The most cautious rule wins. A deny or ask rule that covers a request beats the grant, as it beats every allow rule.
  • The summary check, consequence preview, Unusual for this agent and untrusted sources still hold a request for a person, exactly as they do when any other rule would approve it.
  • A rule’s cancel window still applies to what the grant approves.
  • Uses are counted inside the transaction that stores each request, with the grant’s row locked, so two requests arriving together cannot both take the last use.
  • Every request a grant approves is kept in the record, as approved by the grant’s rule in the owner’s name.
  • A grant is stored under its own effect name, so an older version of the API running during a deploy refuses it instead of reading it as an allow rule for every run.

Limits

  • The agent decides its own run id. A grant holds the agent to one id, but an agent that picks a new one simply asks again from the start.
  • The rule tester does not take a run id, so it never shows a run grant matching.
  • A grant is meant for one sitting. For something an agent may always do, write a rule with a limit, a budget or both.

A grant starts from a step a person approves. When the agent knows before it starts what the task will need, it can ask for a mandate instead: the same kind of grant, asked for up front, with a time it picks and a total for money.