Mandate · Guide
Halt a run
Use this when an agent team works on a task: an orchestrator and the subagents it starts. A run groups them, so one call stops the whole team on its next request. The run guard counts what the team does and can flag or halt it for you.
Before you begin: your orchestrator works under a person's grant and delegates to subagents. Runs, halts and the guard are free.
1. Start a run
POST / returns a run_… id. Name the person's grant as root_grant_id, so the guard can watch its budget:
export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s $PROVENANCE_API/v1/mandate/grants \
-H "Authorization: Bearer $PROVENANCE_KEY" -H "Content-Type: application/json" \
-d '{ "device_id": "dev_00000000000000000000000000000001", "purpose": "Restock printer paper for the office",
"constraints": { "max_amount": 80, "budget_amount": 200, "budget_window": "month",
"allowed_counterparties": ["paper.example", "ink.example"], "expires_at": "2027-12-31T23:59:59Z" } }' | tee parent.json
export PARENT_ID=$(jq -r .id parent.json)
curl -s $PROVENANCE_API/v1/mandate/runs \
-H "Authorization: Bearer $PROVENANCE_KEY" -H "Content-Type: application/json" \
-d "{ \"name\": \"Restock printer paper\", \"root_grant_id\": \"$PARENT_ID\" }" | tee run.json
export RUN_ID=$(jq -r .id run.json)
const run = await prov.mandate.runs.create({ name: "Restock printer paper", rootGrantId: parent.id });
run = prov.mandate.runs.create(name="Restock printer paper", root_grant_id=parent["id"])
{
"object": "run",
"status": "active"
}
2. Join the team to the run
Pass run_id when the orchestrator authorizes and when it delegates. A child grant inherits its parent's run, and every token minted in the run carries a run claim after its usual claims.
curl -s $PROVENANCE_API/v1/mandate/grants/$PARENT_ID/delegate \
-H "Authorization: Bearer $PROVENANCE_KEY" -H "Content-Type: application/json" \
-d "{ \"agent_session_id\": \"sess_paperfinder_9\", \"purpose\": \"Find A4 paper prices\", \"run_id\": \"$RUN_ID\",
\"constraints\": { \"allowed_counterparties\": [\"paper.example\"] } }"
{
"object": "grant",
"depth": 1
}
Read the run with GET /: the team, the guard's counts and, newest first, every purchase that went over a limit (escalations) and every structure the orchestrator proposed (delegation_proposals[]). Each carries how the person decided in approval_context. The console's run page lists them under Approvals.
Every run, on the list and its page, carries title: its name, else the root grant's purpose, or null when it has neither (show the id). It also says what outside agents did in it: outside_proposals (their proposals, not counting withdrawn ones), outside_briefs (briefs the run sent them) and latest_outside_proposal (the one waiting on a person, else the accepted one, else the newest).
GET / takes outside_agent=proposed for the runs with a proposal, took_part for any outside agent and none for neither, alone or with status, q and the created range. The console's runs list has the same as its Outside proposals tab and its Filter menu's Outside agent field.
3. Halt it
POST / stops the team in one call:
curl -s $PROVENANCE_API/v1/mandate/runs/$RUN_ID/pause \
-H "Authorization: Bearer $PROVENANCE_KEY" -H "Content-Type: application/json" \
-d '{ "reason": "Buying from a store it was told to avoid" }'
await prov.mandate.runs.halt(run.id, { reason: "Buying from a store it was told to avoid" });
prov.mandate.runs.halt(run["id"], reason="Buying from a store it was told to avoid")
{
"object": "run",
"status": "halted"
}
A halt revokes every grant in the run and everything delegated below them, and locks every member session. Each member's next verify fails with run_halted, whether or not its token carries the run claim. The halt is on the decision ledger, and the mandate.run.halted webhook fires. A halted run takes no new members (run_halted).
In the console, Mandate → Runs shows each run's team, the guard's counters and Halt run (owners, admins and developers).
4. Resume it
An owner or admin resumes a halted run in the console, after looking at what happened. Resuming unlocks the sessions; revoked grants stay revoked, so the orchestrator delegates again for any work left. An API key can't resume a run.
5. Let the run guard watch the team
Each rule counts per run over a window (10 minutes by default) and acts when it reaches its threshold. Set them in Settings → Agents → Agent teams or with PUT /.
| Rule | Counts | Default |
|---|---|---|
denials | Denied requests in the run | Flag at 5 |
out_ | Attempts outside a grant's counterparties or action types | Halt at 3 |
budget_ | The person's budget spent or asked for, as a percent | Flag at 80 |
fan_ | New subagent sessions | Flag at 20 |
canary | Canary trips in a member's session | Flag at 1 |
off_ | off_ denials, actions outside the purpose, inconsistent checks | Halt at 2 |
A flag records a trip on the run and sends mandate.run.flagged; a halt halts the run as in step 3. To try new thresholds first, set a shadow copy: it counts the same events and reports would-have-tripped counts on the run, and never acts. The guard counts behaviour and never reads content.
Your policy can also use the run's facts (listed in policies), such as run.depth. For example, ask a person for anything below the orchestrator:
{
"rules": [
{ "id": "ask-for-subagents", "when": [{ "fact": "run.depth", "op": "gte", "value": 1 }], "require": { "approval": true } }
]
}
Errors you might see
| Code | What to do |
|---|---|
run_ | The run is halted. An owner or admin resumes it, or start a new run. |
run_ | Read the run's status: an ended run can't be halted, and only a halted run resumes. |
dashboard_ | Resume the run as an owner or admin in the console. |
resource_ | No such run on your account. |