Mandate · Guide
Prevent agent takeover
A stolen API key or agent signing key lets someone act as your agent, inside its grants, at every store that accepts it. Provenance sees each authorization, each verify and each signed request at stores that run Identify, so it notices when an agent starts to behave like someone else. The verdict is deterministic: the same activity always gives the same verdict, and the reasons say why.
Availability: every plan, at no charge.
Before you begin: register your agents and call authorize with agent_id; verdicts attach to registered agents. Export the account key.
export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
- Baseline14 days per agent and API key
- Signalsnamed, with thresholds
- Verdictnone, elevated or high
- Actionflag, step-up, suspend or lockdown
1. Read an agent's verdict
Each agent has a takeover_risk on its object and a fuller view at GET /. A new agent is learning for its first 7 days.
curl -s -X POST $PROVENANCE_API/v1/mandate/agents \
-H "Authorization: Bearer $PROVENANCE_KEY" -H "Content-Type: application/json" \
-d '{ "name": "buyer-bot" }' > agent.json
export AGENT_ID=$(jq -r '.id' agent.json)
curl -s $PROVENANCE_API/v1/mandate/agents/$AGENT_ID/takeover -H "Authorization: Bearer $PROVENANCE_KEY"
const agent = await provenance.mandate.agents.create({ name: "buyer-bot" });
const view = await provenance.mandate.takeover.agent(agent.id);
console.log(view.takeoverRisk); // "learning" for the first 7 days
view = client.mandate.takeover.agent(agent_id)
print(view["takeover_risk"]) # "learning" for the first 7 days
{
"object": "agent_takeover",
"agent_id": "agt_01M5XPDJXQR46KYMS99XT98SBT",
"takeover_risk": "learning",
"takeover_reasons": [],
"active_event": null,
"compromised_key_ids": [],
"history": []
}
The baseline holds the last 14 days, one row per agent (and per API key and signing key) per hour: the network families it acts from, its action types and counterparties, its hourly rate and spend, and its client (agent_integration and SDK version).
A network family is a named cloud provider from the published lists (cloud:aws), or a salted hash of the /24 (IPv4) or /48 (IPv6) whose key rotates every 28 days. Provenance never stores an address, and none enters a token.
2. Know the signals
| Signal | Raised when |
|---|---|
new_ | The agent acts from a network family it hasn't used in 14 days. |
split_ | One API key or signing key is used from two network families within 5 minutes. |
rate_ | The hour's authorizations reach 20 and pass 5× the agent's hourly baseline, or the hour's approved spend reaches 1,000 and passes 5× its baseline. |
new_ | More than 3 action types or counterparties the agent has never used, in one hour. |
client_ | The integration or SDK major version changes within one agent session. |
denial_ | 10 denied actions in an hour that are at least half its verifies, or 2 "I don't recognize this" denials. |
network_ | Another company reported fraud or an unrecognized charge about the agent in the last 24 hours. |
key_ | Someone reported the agent's signing private key, with the private part that matches it (see if a key leaks). |
While an agent is learning, only the signals that need no baseline count: one key on two networks, a burst of denials, network reports and a leaked key.
3. Read the verdict
Each signal has a weight: split_use and key_leaked weigh 2, every other signal 1. A total of 1 is elevated; 2 or more is high. So two signals, or split_use alone, is high.
| Verdict | Default action | Other choices |
|---|---|---|
elevated | flag: the owner is told; the agent keeps working | step_ |
high | step_: every action by the agent needs a person until you answer | flag, suspend, lockdown |
lockdown suspends the agent and revokes its sessions and outstanding tokens. Under step_up, verify answers approval_pending with step_up_reason: "agent_takeover_step_up" until a person approves the action:
{
"object": "mandate_assessment",
"valid": false,
"reason": "approval_pending",
"step_up_reason": "agent_takeover_step_up",
"policy": { "id": "pol_3F9A1C7E52B04D8E6A1F27C9B4", "version": null, "rule": { "id": "agent_takeover_step_up", "name": null, "phase": "assess", "action": "challenge", "conditions": [] } },
"takeover": { "takeover_event_id": "tko_01M5XPDJXQR46KYMS99XT98SBT", "risk": "high", "reasons": ["new_network", "rate_spike"] }
}
4. Choose what happens
Owners and admins set the action per verdict in Settings → Agents → Takeover protection, or with PUT / from a console session. An API key can read the settings and can't change them, so a stolen key can't turn protection off.
curl -s $PROVENANCE_API/v1/mandate/settings/takeover_protection -H "Authorization: Bearer $PROVENANCE_KEY"
const settings = await provenance.mandate.takeover.settings();
settings = client.mandate.takeover.settings()
{
"object": "takeover_protection",
"mode": "enforce",
"elevated_action": "flag",
"high_action": "step_up",
"leaked_live_keys": "revoke"
}
Turn on shadow mode (mode: "shadow") to see what would happen first. A shadow event records the verdict and the action it would have taken, and changes nothing: no step-up, suspension or lockdown, no email, task or webhook, and no policy facts.
5. Use the verdict in a policy
Policies read two facts:
| Fact | Value |
|---|---|
agent. | none, learning, elevated or high |
agent. | The reason codes, comma-separated |
The rule below denies outright instead of stepping up:
{
"rules": [
{
"id": "deny-high-takeover-risk",
"when": [{ "fact": "agent.takeover_risk", "op": "eq", "value": "high" }],
"require": { "deny": true }
}
]
}
6. Answer the owner's alert
A verdict tells owners and admins at once: an email, a console task and the mandate.agent.takeover_suspected webhook, each with the reasons, the time and the network families (named or hashed). The event offers two answers, from the console:
- This was us (POST
/): trusts the event's networks, clears its other signals for 2 hours, resumes an agent the event suspended, and records the answer in the decision ledger.v1/ mandate/ takeover_ events/ {id}/ clear - Lock it down (POST
/): suspends the agent, revokes its sessions and outstanding tokens, and lists the API keys and signing keys to rotate. It counts as an owner-confirmed takeover: other companies seev1/ mandate/ takeover_ events/ {id}/ lock_ down takeover_confirmed_30don the agent's network record, whatever the usual minimums.
Both take a console session from an owner or admin, and "This was us" asks for a recent second-factor check when the person has one.
7. Rotate the keys and resume
After a lockdown, rotate each key in compromised_key_ids: POST / for an API key, and a new signing key followed by DELETE / for a signing key. Then resume with POST /.
The agent resumes with a fresh baseline: the hours since the first signal are dropped, and the older ones stay. The compromised keys stay revoked and listed in the agent's history. A plain unsuspend refuses a locked-down agent with agent_locked_down.
Errors you might see
| Code | What to do |
|---|---|
agent_ | Rotate the listed keys, then recover the agent from the console. |
takeover_ | The event was already answered; a new suspicion opens a new event. |
takeover_ | A key in compromised_ is still active. Rotate or revoke it first. |
authentication_ | Answers and settings changes take a console session, not an API key. |
Limitations
- Each signal covers what its row in the table says, and nothing more: an attacker who acts from the agent's usual networks, at its usual rate and with its usual actions raises no signal.
- Network families are as coarse as a cloud provider or a /24, so two agents in the same cloud share a family.
- Identify traffic feeds the baseline when the store's hosted check passes the request's address.