SDK reference · Python SDK
prov.mandate.assessments.create
prov.mandate.assessments.create in Python SDK.
Signature
prov.mandate.assessments.create(intent_token: str, action_description: str, action_payload: Any = …, context: Optional[dict] = …, context_evidence: Optional[dict] = …, display: Optional[dict] = …, approver: Optional[dict] = …, trace_id: Optional[str] = …, inference_input: Optional[dict] = …, explain: Optional[str] = …, approver_link_id: Optional[str] = …, approval_expires_in: Optional[int] = …, link_expires_in: Optional[int] = …, channels: Optional[list] = …, delivery: Optional[str] = …, reminders: Optional[dict] = …, approver_link_ids: Optional[list] = …, approvals_needed: Optional[int] = …, deny_rule: Optional[str] = …, account_approvers: Optional[bool] = …, policy_version: Optional[int] = …, draft_group: Optional[str] = …, user_agent_suffix: Optional[str] = …) -> AnyParameters
intent_tokenstrRequiredaction_descriptionstrRequiredaction_payloadAnycontextOptional[dict]context_evidenceOptional[dict]displayOptional[dict]approverOptional[dict]trace_idOptional[str]inference_inputOptional[dict]explainOptional[str]approver_link_idOptional[str]approval_expires_inOptional[int]link_expires_inOptional[int]channelsOptional[list]deliveryOptional[str]remindersOptional[dict]approver_link_idsOptional[list]approvals_neededOptional[int]deny_ruleOptional[str]account_approversOptional[bool]policy_versionOptional[int]draft_groupOptional[str]user_agent_suffixOptional[str]
Request fields
Idempotency-Keystringheader- Retry a create safely: the same key + request returns the stored response (24 h, per caller).
intent_tokenstringRequired- The intent token from authorize.
action_descriptionstringRequired- The human-readable action, exactly as authorized.
action_payloadany- Must match what was authorized when the token carries payload_hash.
displayobject- Display only, for the approval page when this check asks a person:
kindnames what is asked about, so the page reads "Scout is asking you to approve a stay." Kept in the approval'sdisplay; never a token claim or a rule fact. Left out, the page says a payment.Show child attributes
kindenum- What the person is asked to approve. One of
stay,flight,order,payment,booking.
approverobject- Display only: the name of the person you expect to answer ("Maya Chen"), kept with the approval this check opens. A run waiting on it reads
waiting_on: "Maya Chen". Shown only to your account, never on the approval page; never a token claim or a rule fact.Show child attributes
namestring- One line of 1 to 100 characters.
requestobject- The agent's request as your tool or service received it. Its signature is checked before the token and returned as
signature: Web Bot Auth through itsSignature-Agentdirectory, or an HTTP message signature with noSignature-Agentagainst a key the agent registered with Provenance. A signature that doesn't verify makes the resultvalid: falsewithagent_signature_invalid(oragent_signature_unverifiedwhen its directory can't be checked). Read, never stored.Show child attributes
methodstringRequired- The HTTP method.
urlstringRequired- The full URL the agent called.
headersobjectRequired- The request headers as sent, including
Signature,Signature-InputandContent-Digest. bodystring- The request body as sent, at most 64 KB. Checked against
Content-Digestwhen the signature covers it.
contextobject- Facts for your policy. One list is allowed:
alternatives, up to 10 payees the person can pick from in "Ask for a change". It is shown on the approval and is never a policy fact. Under a grant,counterparty,currency,mcc(the merchant's declared MCC, four digits),merchant_country(alpha-2 or ISO 3166-1 numeric),service_startandservice_end(the dates of what is bought: a date or a date-time with an offset) are checked against the grant's lists and service window and every grant above it. approver_link_idsarray of strings- Group sign-off: when a step-up rule fires, route the approval to these approver links (yours, accepted) instead of one. Each approver gets their own link and approves with their own passkey; each decision is its own ledger row. Pro and up. Not with
approver_link_id. approvals_neededinteger- With
approver_link_ids: how many must approve, 1 to the group's size (default: all). deny_ruleenum- With
approver_link_ids:any(default) ends the request at the first deny;unreachableends it once too few approvers are left to reachapprovals_needed. One ofany,unreachable. account_approversboolean- With
approver_link_ids: your own people count towardapprovals_neededtoo (they decide in the console or the approval embed). trace_idstring- The traced inference whose canary readings the policy's
fact: canaryconditions read. It takes precedence over the token's own trace. A stale or missing reading, or another account's, counts as unavailable. policy_versioninteger- Sandbox only. Decide with this version of your agent rules (a draft, typically) instead of the live one. A draft saved in a draft group needs that
draft_group. In live,400 parameter_invalid; a version that doesn't exist,404. draft_groupstring- Sandbox only, with
policy_version: the draft group the draft was saved in (the rules embed session'srules.draft_group). Another group's draft is400 parameter_invalid. explainenum- Explain tripped canary families (default), or also those at 0.8 of their threshold or more. One of
tripped,near. inference_inputobject- Or re-read the canaries NOW over this prompt (metered
trace_canary_read, after the plan allowance). ≤ 32 KB.Show child attributes
modelstring- The model to run, as a registry model ID or its short name.
messagesarray of objects- The chat messages, in order.
approval_expires_ininteger- The expiry of an approval this call opens, in seconds: 60 to 7 days, and never past the intent token's expiry. Defaults to the account default, then the server's.
link_expires_ininteger- How long each single-use link to the approver works, in seconds: at least 60, capped at the approval. Defaults to the whole approval window; a resend issues a new link for the same time.
remindersobject- For a routed approval: its automatic reminders (the
approvalschedule's shape). Left out, your account's schedule.Show child attributes
enabledbooleantruetracks this request on the schedule (Pro and above on a live deployment:402 plan_requiredonreminders.enabledbelow Pro, nothing created; every plan in the sandbox);falsesends it no automatic reminder (one by hand or by API is still allowed).afterarray of strings- Up to three offsets from the request's creation (
10m,24h,3d), increasing, each at least the minimum gap after the one before, at most 7 days. Errors use the Settings messages onreminders.after.
channelsobject- For a routed approval: which messages may go (
app_notification,email,text). They narrow the approver's own order (their Provenance app, then their channels, then a text when they have a phone, then email), and one message goes. Left out, your account's default. deliveryenumsend, orself: send nothing; the response carriesapprove_urlfor you to show in your own app. The approver still approves with their own passkey.selfneeds an approver link. Left out, your account's default. One ofsend,self.approver_link_idstring- When a step-up rule fires, route the approval to this approver link (someone outside your account) instead of your own team. The link must be yours and accepted. The approver is texted a single-use link and approves with their passkey; the same verify call then returns
valid. The link's ceiling and the approver's own limits apply (approver_ceiling_exceeded). An approval that already exists for this token and action keeps its routing.
Returns
Any The verification result. valid says whether the action may run; when it's false, reason says why. Canary, step-up and mandate outcomes add their own fields.
HTTP operation
POST /v1/mandate/assessments: Assess an agent action
Errors
- authentication_required
- insufficient_scope
- invalid_json
- link_revoked
- parameter_invalid
- parameter_missing
- rate_limit_exceeded
- resource_missing
- spend_limit_exceeded
- usage_limit_reached
Example
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/intents`, {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
"action_description": "Pay invoice INV-2041: $1,850.00 to Brindlecote Supplies",
"action_payload": {
"type": "payment",
"amount": 1850,
"currency": "USD",
"payee": "acct_brindlecote_supplies"
},
"agent_session_id": "sess_reference_1",
"device_id": "dev_00000000000000000000000000000001"
}),
})).json();
const intentToken = step1.intent_token;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/assessments`, {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
"intent_token": intentToken,
"action_description": "Pay invoice INV-2041: $1,850.00 to Brindlecote Supplies",
"action_payload": {
"type": "payment",
"amount": 1850,
"currency": "USD",
"payee": "acct_brindlecote_supplies"
},
"display": {
"kind": "payment"
}
}),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/mandate/intents", headers={"Authorization": f"Bearer {os.environ['PROVENANCE_KEY']}"}, json={
"action_description": "Pay invoice INV-2041: $1,850.00 to Brindlecote Supplies",
"action_payload": {
"type": "payment",
"amount": 1850,
"currency": "USD",
"payee": "acct_brindlecote_supplies"
},
"agent_session_id": "sess_reference_1",
"device_id": "dev_00000000000000000000000000000001"
}).json()
intent_token = step1["intent_token"]
data = httpx.post(f"{api}/v1/mandate/assessments", headers={"Authorization": f"Bearer {os.environ['PROVENANCE_KEY']}"}, json={
"intent_token": intent_token,
"action_description": "Pay invoice INV-2041: $1,850.00 to Brindlecote Supplies",
"action_payload": {
"type": "payment",
"amount": 1850,
"currency": "USD",
"payee": "acct_brindlecote_supplies"
},
"display": {
"kind": "payment"
}
}).json()