Executions
The execution API is in Preview: it can change or be removed at any time. Today:
- It runs only against Mandaitor's hosted sandboxes. A connector to your own system is refused.
- It has two tools, one business operation in two systems: releasing a purchase requisition in SAP (
sap.purchase_requisition.release) and approving a requested item in ServiceNow (servicenow.requested_item.approve). Neither can be enabled yet. Their business action,procurement.requisition.release, comes from the procurement taxonomy, which is not loaded yet. Until it is,GET /toolslists both as unavailable, and every request for either is refused with403 TOOL_NOT_ENABLED.
Beta Limitations lists the rest.
With POST /verify, Mandaitor answers whether an agent may act, and the agent then acts with its own credentials. With the execution API, the agent asks Mandaitor to act instead. The agent names the operation and the record. Mandaitor reads the record from the target system, decides on what it read, performs the write with a credential the agent never holds, reads the result back, and signs a receipt of the outcome.
An agent built on an MCP client asks the same way through Mandaitor's MCP server: each tool call is one execution, decided and carried out exactly as described here.
How an execution runs
- The agent sends a
mandaitor.tool-request/v1: the tool, and the record as an identifier. - Mandaitor normalizes the arguments and reads the record from the target system.
- It decides on the facts it read, such as the amount and the plant, against every mandate that names the agent. The agent never states those facts, so it cannot understate an amount.
- If a person must approve, the approval is bound to a digest of exactly what was decided: the record at its version, the facts, the mandates and the tenant's execution policy.
- It answers as soon as the decision is recorded. An allowed request is answered in
AUTHORIZED_NOT_EXECUTED: nothing has been written yet. - Mandaitor then reads the record again, decides again, and records the dispatch on the audit trail. Then it writes once, usually within seconds of the answer.
- It reads the record back to establish the outcome, and signs a receipt of it. The agent reads the outcome with
GET /executions/{id}.
A denial is not an error. It is an execution in DENIED, answered with 201, so the agent and the audit trail see the same object.
Setting up
A tenant administrator sets up four things, from their own session, through the API or, where this section says so, the dashboard. In the examples, adminClient stands for that session: provisioning a sandbox, enabling a tool, registering an agent and binding it need tenant:write, which no API key has. An API key, client below, may create the mandate, which then waits for a person's approval.
1. A sandbox connector
In the Preview, executions run only against Mandaitor's hosted sandboxes. Provision a SAP S/4HANA sandbox, which comes with a connector to it:
const connector = await adminClient.post(`/tenants/${tenantId}/connectors/sandbox`, {
type: "sap-s4hana",
});
The sandbox emulates SAP's purchase requisition service, seeded with the requisitions listed under The SAP sandbox. It expires after 30 days, and its connector with it. Its credential is never shown to anyone: only Mandaitor's executor writes to the sandbox. In the dashboard, the Connectors page creates one as a demo sandbox.
A ServiceNow sandbox (type: "servicenow") emulates the Table API's requested items, seeded with the items listed under The ServiceNow sandbox. Its credential is never shown either. One provisioned before October 2026 showed its credential once, and whoever kept it can approve an item without Mandaitor. Mandaitor never takes such an approval for its own: a request for an approved item is denied, and an execution that finds one approved without its own work note is left UNKNOWN. Replacing the sandbox's credential retires the one shown: nobody sees the new one.
2. The tool, enabled on that connector
GET /tools lists the registered tools and whether each is available. Enable a version of a tool on a connector of its type. This needs tenant:write:
await adminClient.put(`/tenants/${tenantId}/tools/sap.purchase_requisition.release`, {
version: 1,
connector_id: connector.connector_id,
});
For a ServiceNow sandbox, enable servicenow.requested_item.approve on its connector the same way.
GET /tenants/{id}/tools returns the tenant's execution policy: which tool version runs on which connector. Every change raises the policy's version. An approval's digest records that version, so an approval still waiting when the policy changes must be given again. In the dashboard, the Connectors page lists the tools under Registered tools, and enables each on a connector, in that connector's environment.
Environments
Each agent and each connector belongs to one environment, such as qas or prd: lower case, starting with a letter, at most 32 characters. It is named when the agent is registered or the connector created, with environment, and never changes. Anything given none is in default, so a tenant with one landscape never names one. In the dashboard, the Agent Registry and Connectors pages name it when they create one, and show it.
A tool is enabled per environment, on a connector of that environment:
await adminClient.put(`/tenants/${tenantId}/tools/sap.purchase_requisition.release`, {
version: 1,
connector_id: productionConnector.connector_id,
environment: "prd",
});
An agent's executions use the tool as it is enabled in the agent's own environment, so an agent registered for a test system never reaches production. Enabling a tool on a connector of another environment is refused with 409 CONNECTOR_ENVIRONMENT_MISMATCH, and so is naming none for a connector outside default. DELETE /tenants/{id}/tools/{toolId}?environment=prd disables a tool in one environment; without the parameter, in default. An agent that must act in two environments is registered twice. The policy has one version for all environments: a change in any of them means an approval still waiting must be given again.
3. The agent, with its own key
The agent authenticates as itself. Register it with a public key (Agent Identity Registry), in the environment it acts in if that is not default. It opens a session at POST /mcp/token with a private_key_jwt assertion signed by that key (Token Exchange). The token request carries a DPoP proof, which binds the session to a second key the agent's client holds (Sessions bound to a key). The execution API accepts only such a session, for an hour: every request carries Authorization: DPoP mcp_… and a fresh proof for that request. It refuses bearer sessions, API keys, people's tokens and Proofs-of-Mandate.
4. A mandate written for executions
The decision reads every ACTIVE mandate in the tenant whose delegate is the agent. A mandate backs an execution only when all of these hold:
- A person stands behind it. Either a person's session created it, or it was created pending approval (
require_approval: true) and a person's session approved it. A mandate that an API key created on its own never lets an agent act. - It names the tool's business action exactly.
*and other patterns inscope.actionsgrant no execution. - Its resources cover the record. Resource patterns follow the taxonomy's grammar:
*matches within one/segment, and**matches everything below. - Its constraints use only the keys in the table below. Any other key makes the decision a denial with
UNSUPPORTED_CONSTRAINT, because Mandaitor does not act past a limit it cannot evaluate. That includes anyrate_limitskey other thanmax_count,escalation_rules.deviation_above_percentand a non-emptyscope.conditions.
| Constraint | Effect |
|---|---|
expires_at (top level) and time.expires_at | The earlier one is in force. After it, nothing new is decided or written. |
time.not_before | Before it, a denial. |
transaction_limits.max_amount | A hard cap on the amount read from the record. Above it, a denial that no approval overrides. |
transaction_limits.max_total | A list of { amount, window }: the most the amounts of the mandate's executions may add up to in a window. Past it, a denial (CUMULATIVE_LIMIT_EXCEEDED) that no approval overrides. |
rate_limits.max_count | A list of { count, window }: the most executions the mandate may back in a window. Past it, a denial (CUMULATIVE_LIMIT_EXCEEDED) that no approval overrides. |
escalation_rules.amount_above | The approval threshold. Above it, a person must approve. |
escalation_rules.wallet_above | The step-up threshold. Above it, a person must approve, and confirm the approval with their linked EUDI Wallet (Approving with the EUDI Wallet). |
escalation_rules.escalate_to | Who approves, as a canonical subject ID. Without it, the mandate's principal approves. |
require_mfa | Every execution under the mandate needs an approval given with MFA. |
Money is written as { "currency": "EUR", "value": "10000.00" }: an ISO 4217 code and a decimal string. Amounts are compared exactly. A fact in another currency is a denial (CURRENCY_MISMATCH), and there is no conversion.
Cumulative limits count in calendar windows, in UTC.
- Windows. A
windowisPT1H, a clock hour;P1D, a day from 00:00 UTC;P1W, an ISO week from Monday 00:00 UTC; orP1M, a calendar month. Each window starts again from zero, so a limit of 10 a day allows 10 at 23:59 UTC and 10 more at 00:01. A list holds at most one limit per window. - What counts. A limit counts every execution the mandate backs, whatever the tool, and every authorization a request-bound decision gives under it.
- An execution counts from the moment Mandaitor reserves it, just before the write. The reservation is atomic, so two executions can never both take the last of a limit.
- It keeps counting once the write succeeded, and while its outcome is
UNKNOWN, because the write may have happened. - The limit gets it back when the write is proved absent or was never made.
- Denials. An execution that would pass a limit is denied when it is decided, with
CUMULATIVE_LIMIT_EXCEEDED. If another execution takes the room between the decision and the write, it is denied then, before anything is written.
The approver is named by their canonical subject ID. For someone who signs in to the dashboard, that is cognito: followed by their user ID. An approver who cannot sign in as that subject can never decide, and the approvals expire.
Create it through the API, as here, or with Create mandate on the dashboard's Governance page, whose editor writes only these keys:
const mandate = await client.post("/mandates", {
principal: {
type: "NATURAL_PERSON",
subject_id: "cognito:a1b2c3d4-e5f6",
display_name: "Procurement lead",
},
delegate: {
type: "AGENT",
subject_id: agent.did,
display_name: "Procurement agent",
},
scope: {
actions: ["procurement.requisition.release"],
resources: ["procurement:plant:1000/requisition:*"],
effect: "ALLOW",
},
constraints: {
time: { expires_at: "2027-01-31T00:00:00Z" },
transaction_limits: {
max_amount: { currency: "EUR", value: "100000.00" },
max_total: [{ amount: { currency: "EUR", value: "50000.00" }, window: "P1D" }],
},
rate_limits: { max_count: [{ count: 20, window: "P1D" }] },
escalation_rules: { amount_above: { currency: "EUR", value: "10000.00" } },
},
require_approval: true,
});
// POST /mcp/token opens a session only for an agent bound to a mandate delegated to it.
await adminClient.post(`/agents/${agent.agent_id}/bind`, {
mandate_id: mandate.mandate_id,
});
Created with an API key, as here, the mandate waits for a person's approval. A person with mandates:write then approves it from their own session, on the dashboard's Governance page or with POST /mandates/{id}/approve, and from then on it counts. Under this mandate, the agent may release requisitions of plant 1000 up to EUR 10,000 on its own. Above that, the procurement lead approves each release, and above EUR 100,000 nothing is released. Across the day (UTC), the releases may add up to EUR 50,000 and number 20 at most.
One mandate covers every system. A mandate names the business action and the sites it covers, never a tool or a vendor, so the same mandate governs SAP and ServiceNow. Every tool of an action reads the same facts under the same names: the plant, the requisition's number, its amount and whether it is released. To let the agent approve the ServiceNow sandbox's items at the Munich plant too, add that location to the resources:
resources: [
"procurement:plant:1000/requisition:*",
"procurement:plant:c7dae03a431069aecf016c0a0474d40a/requisition:*",
],
ServiceNow identifies a location by its sys_id. Mandaitor reads it from the requested item, and never goes by the location's name, which anyone allowed to rename a location could change. The limits and the approval threshold apply alike, whichever system holds the record.
Requesting an execution
The agent sends POST /executions with its session token and a proof. dpopProof is the helper in Sessions bound to a key:
// One key per request, sent again unchanged on every retry of it.
const idempotencyKey = crypto.randomUUID();
const url = "https://api.mandaitor.io/v1/executions";
const response = await fetch(url, {
method: "POST",
headers: {
Authorization: `DPoP ${sessionToken}`,
// A fresh proof for every request, a retry included.
DPoP: await dpopProof("POST", url, sessionToken),
"Content-Type": "application/json",
},
body: JSON.stringify({
contract: "mandaitor.tool-request/v1",
tool: "sap.purchase_requisition.release",
arguments: { purchase_requisition: "10000124" },
idempotency_key: idempotencyKey,
purpose: "Retrofit approved in the Q4 capex review",
}),
});
const execution = await response.json();
| Field | Rules |
|---|---|
contract | Exactly mandaitor.tool-request/v1. Any other value is refused. |
tool | A tool the tenant has enabled. tool_version may pin a version, which must be the enabled one. |
arguments | Identifiers only, checked against the tool's argument schema. An unknown key is refused, not ignored. |
idempotency_key | Chosen by the agent. See Idempotency. |
mandate_id | Optional: the mandate the agent believes covers the call. It is a hint. If it does not cover the call, the answer is a denial. |
purpose | Optional free text, shown to the approver. It is never used to decide. |
The answer is the execution. 201 means the request created it, whatever its state:
{
"contract": "mandaitor.execution/v1",
"execution_id": "exe_01J9ZK3Q7V8D2M5N6P4R1S0T9W",
"state": "AWAITING_APPROVAL",
"state_reason": "APPROVAL_REQUIRED",
"tool": { "id": "sap.purchase_requisition.release", "version": 1 },
"request_digest": "sha-256:rHD2Q5K8WAZbfCBLAo7DahfycsRD2SZmruc-vwPqaJM",
"decision": {
"event_id": "evt_01J9ZK3Q7X0A1B2C3D4E5F6G7H",
"outcome": "REQUIRE_APPROVAL",
"mandate_id": "mdt_01J9PROCUREMENT",
"reason": "amount 38500.00 EUR is above the 10000.00 EUR approval threshold"
},
"approval": {
"consent_id": "cns_01J9ZK3Q7Y2C3D4E5F6G7H8J9K",
"digest": "sha-256:xOHyKqgWJ5RyB02kTXaav6Vm_dd5L7toyJHMYQp1qLc",
"expires_at": "2026-10-13T09:12:44Z"
},
"result": null,
"receipt": null,
"created_at": "2026-10-12T09:12:44Z",
"updated_at": "2026-10-12T09:12:44Z"
}
result holds only the fields the tool declares as returnable, and is set in SUCCEEDED. For the SAP release, those are purchase_requisition and release_state. receipt is set once the outcome is established. Mandaitor keeps the facts the decision rested on, and digests of everything else it read. It never keeps the full record, and nothing it returns or logs carries the target's credential.
An agent reads its own executions with GET /executions/{id}. Another agent's execution, or another tenant's, is 404.
Waiting for the outcome
An allowed request is answered before anything is written, in AUTHORIZED_NOT_EXECUTED. Mandaitor writes it straight after, so read the execution again every few seconds until it is final (DENIED, SUCCEEDED, FAILED), waits for an approval, or is UNKNOWN:
let current = await response.json();
while (["AUTHORIZED_NOT_EXECUTED", "EXECUTING"].includes(current.state)) {
await new Promise((resolve) => setTimeout(resolve, 2_000));
const url = `https://api.mandaitor.io/v1/executions/${current.execution_id}`;
const read = await fetch(url, {
headers: {
Authorization: `DPoP ${sessionToken}`,
DPoP: await dpopProof("GET", url, sessionToken),
},
});
current = await read.json();
}
An UNKNOWN execution is not worth waiting on in a loop: Mandaitor keeps reading it back for about 41 hours (see States). Nothing notifies the agent when an execution changes; it reads.
Idempotency
(tenant, agent, idempotency_key) names at most one execution, until 24 hours after the execution reaches a final state.
- Sending the same request again with the same key returns that execution in its current state, with
200. - The same key with a different request is
409 IDEMPOTENCY_CONFLICT. - A repeat that arrives while the first request is still being decided is
409 IDEMPOTENCY_IN_PROGRESS, withRetry-After.
A retry with the same key never makes a second decision or a second write. The key Mandaitor passes to the target system comes from the execution, not from the agent, so two executions can never collide at the target.
With the SDK
From 5.1.0, @mandaitor/sdk carries a client that opens the agent's session, binds it to a key it makes for itself, and signs a proof for every request. It renews the session when it ends, and retries only what the API marks as retryable, always with the same idempotency key:
import { MandaitorExecutionsClient, verifyReceiptForExecution } from "@mandaitor/sdk";
const executions = new MandaitorExecutionsClient({
baseUrl: "https://api.mandaitor.io/v1",
agent: { did: agentDid, keyId, privateKey: pkcs8Pem },
});
const { execution: requested } = await executions.requestExecution({
tool: "sap.purchase_requisition.release",
arguments: { purchase_requisition: "10000123" },
idempotency_key: crypto.randomUUID(),
});
// Reads it until it is final, waits for an approval, or is UNKNOWN.
const execution = await executions.waitForExecution(requested.execution_id);
if (execution.state === "SUCCEEDED") {
const receipt = await verifyReceiptForExecution(execution, {
allowedIssuers: ["did:web:api.mandaitor.io:v1"],
});
}
States
| State | Meaning | Final |
|---|---|---|
DENIED | Mandaitor will not perform this request. The target was not written. | Yes |
AWAITING_APPROVAL | Covered by a mandate, but a person must approve this exact request first. | No |
AUTHORIZED_NOT_EXECUTED | Allowed, and approved if that was required. Not yet written. | No |
EXECUTING | The dispatch is recorded, and the write is in flight. | No |
SUCCEEDED | The target applied the operation, and a read-back confirmed it. | Yes |
FAILED | The target did not apply it, established by a refusal and a read-back. | Yes |
UNKNOWN | Dispatched, but whether the write happened is not established: a timeout, a transport error, or a read-back that showed neither state. | No |
state_reason says why an execution is in its state, such as AMOUNT_ABOVE_LIMIT, NO_COVERING_MANDATE, APPROVAL_EXPIRED or RESOLVED_BY_READ_BACK. The API reference lists every reason by state. Treat a reason you do not know by its state's general meaning: new features add reasons.
Nothing is written twice. Mandaitor reads an UNKNOWN execution back once, right away, and that often settles it. If it does not, Mandaitor reads it back again a minute later, then at growing intervals: 5 and 15 minutes, then 1, 4, 12 and 24 hours after the read-back before. That is seven more read-backs over about 41 hours. It settles by reading, never by writing again. A read-back that finds the write makes the execution SUCCEEDED, and one that proves the write absent makes it FAILED, both with a receipt; the agent then asks again if it still wants the operation. If the target said it applied the write and a read-back cannot see it, Mandaitor never makes the execution FAILED on its own. What no read-back settles, a person of the tenant resolves: see Resolving an UNKNOWN execution.
Revocation stops everything not yet written. The decision is checked again immediately before the write. A mandate revoked or suspended, or an agent suspended, before that moment means no write. A write already dispatched cannot be recalled.
So does the tenant's kill switch. It disables the tenant's tools before it answers, so nothing is created, approved or written from then on. It then ends every execution waiting for an approval or for its write as DENIED with KILL_SWITCH. An execution whose recheck had just passed is caught by a last look at its tool, immediately before its dispatch is recorded: DENIED with TOOL_NOT_ENABLED. One already dispatched finishes as it is. See Admin Operations.
An allowed execution is written after the answer, usually within seconds. If Mandaitor cannot record the dispatch on the audit trail, it does not write. The execution then waits in AUTHORIZED_NOT_EXECUTED, and Mandaitor takes it up again within a minute or two. An allowed decision that has not led to a write within 15 minutes is denied with DECISION_EXPIRED.
Approvals
A person must approve when the amount read from the record is above the mandate's escalation_rules.amount_above or escalation_rules.wallet_above, when the mandate requires MFA, or when the taxonomy marks the business action as requiring human approval. Above wallet_above, the approval is also confirmed with the approver's EUDI Wallet (below).
- Who approves. The person the mandate names in
escalate_to, or else its principal. Only that person can decide, and only from their own signed-in session: an API key or an agent is refused with403 NOT_A_PERSON, and anyone else with403 NOT_THE_APPROVER. When the mandate requires MFA, the session must have been signed in with it. - Where. In the dashboard, the approval appears as a card in the Consent inbox and on the execution's page. The card shows the record at the version read, the facts, why approval is needed, the digest and the expiry. Through the API, the approval appears in
GET /consents/pendingwith anexecutionfield (Execution Approvals). Mandaitor emails the approver once, with a link to the execution's page (Approver Notifications). - What is approved. The approver sends back the digest they were shown:
await approverClient.post(`/executions/${executionId}/approval`, {
decision: "APPROVE",
approval_digest: "sha-256:xOHyKqgWJ5RyB02kTXaav6Vm_dd5L7toyJHMYQp1qLc",
consent_id: "cns_01J9ZK3Q7Y2C3D4E5F6G7H8J9K",
});
Mandaitor reads the record again and approves only if three digests are equal: the one sent, the one the approval was raised with, and one computed from the fresh read. It answers with the execution approved, in AUTHORIZED_NOT_EXECUTED, and then writes and reads it back, as for a request that needed no approval; the execution's page in the dashboard shows the outcome. If anything the approval covered has changed, nothing is approved:
- If the request still needs an approval, a new one replaces the old, with its own digest, and the answer is
409 DIGEST_MISMATCH. - If the record changed so that no approval is needed any more, the execution is denied with
RECORD_CHANGED, and the agent asks again. An approval is never spent on a record nobody approved.
An approval never raises a cumulative limit. If the mandate's count or total for the window was used up while the execution waited, approving it denies it with CUMULATIVE_LIMIT_EXCEEDED, and the answer is 409 EXECUTION_DENIED.
Sending { "decision": "REJECT" } rejects it, and no digest is needed. An optional comment goes with either decision.
- Expiry. An approval lasts 24 hours at most, and never past the mandate's own expiry. An approval not decided in time ends the execution as
DENIEDwithAPPROVAL_EXPIRED, and a decision sent afterwards is refused with409 APPROVAL_EXPIRED. - No consent policy approves an execution. A tenant's consent policies never resolve one. The threshold below which no approval is needed lives in the mandate, where the principal set it.
- A limit per agent. An agent may raise 20 approval requests per UTC day. Past that, a request that needs one is denied with
APPROVAL_LIMIT_REACHED.
Approving with the EUDI Wallet
Above a mandate's escalation_rules.wallet_above, the approval is made with the approver's linked EUDI Wallet as well as their signed-in session. The approval says so: require_wallet is true, and its rules include WALLET_STEP_UP. The approval email says it must be confirmed with the EUDI Wallet. The threshold is money, like amount_above: an approval is needed above it whatever amount_above says, and a threshold in another currency is a denial (CURRENCY_MISMATCH).
- Link the wallet, once. The approver links their wallet to their account from their own signed-in session, with MFA (Linking a wallet). One wallet per account, and one account per wallet in a tenant. Only another tenant admin can remove a link.
- Start the step-up.
POST /executions/{id}/approval/step-up, by the approval's approver, starts an OpenID4VP session for ten minutes. The answer carriesqr_code_uri,deep_link_uri,session_id, and theexecution_idandapproval_digestit is bound to. Its nonce is made from the approval digest, so a presentation answers this approval and no other. - Present the wallet. The approver scans the QR code, or opens the deep link, and presents. The wallet is asked for the PID's
unique_idalone.GET /eudi/sessions/{id}shows the session's status, to the approver only. - Approve with the session. Send its id with the approval:
await approverClient.post(`/executions/${executionId}/approval`, {
decision: "APPROVE",
approval_digest: "sha-256:xOHyKqgWJ5RyB02kTXaav6Vm_dd5L7toyJHMYQp1qLc",
consent_id: "cns_01J9ZK3Q7Y2C3D4E5F6G7H8J9K",
eudi_session_id: "eudi_01J9ZK3Q7Y2C3D4E5F6G7H8J9M",
});
The session must be completed, within its ten minutes, made for this execution, this digest and this approver, and presented by the wallet linked to the approver's account. It is spent in the same write that approves, so a presentation approves once. Anything missing is refused with 403 STEP_UP_REQUIRED before anything is recorded, and reason says what:
reason | What to do |
|---|---|
WALLET_NOT_LINKED | No wallet is linked to the approver's account. Link one; the approval waits. |
SESSION_REQUIRED | No eudi_session_id was sent. Start a step-up session. |
WALLET_MISMATCH | Another wallet presented. Present the linked one, to a new session. |
EUDI_SESSION_EXPIRED, EUDI_SESSION_CONSUMED, EUDI_SESSION_NOT_COMPLETED | The session cannot be used. Start a new one. |
EUDI_SESSION_BINDING, EUDI_SESSION_PURPOSE, EUDI_SESSION_NOT_FOUND | The session was made for something else: another approval, a re-raised one, or another person. Start one for this approval. |
- The record keeps the step-up, not the person's data. Once approved, the execution's
approval.step_upholds the session's id, the presentation'ssd_hash, and the digest of the wallet. TheEXECUTION_APPROVEDevent on the audit trail carries the same three, and the wallet's digest is the one itsWALLET_LINKEDevent carries. No PID claim is kept. - An approval raised again needs a new step-up. When the record changes and a new approval replaces the old, its digest changes, and a session made for the old one is refused.
- Without a linked wallet, the approval waits until the approver links one or it expires. Nobody can waive it: the mandate requires it. The step-up route answers
409 WALLET_NOT_LINKEDmeanwhile. - A rejection needs no wallet.
Receipts
The receipt is Mandaitor's signed statement of an outcome, as the Proof-of-Mandate is its statement of an authorization. An execution gets one when a read-back establishes the outcome: in SUCCEEDED, and in FAILED once the read-back proves that nothing was written. A denial has none: its record is the decision event on the audit trail. Nor does a FAILED execution whose write was never sent (NOT_ATTEMPTED), one still UNKNOWN, or one a person resolved (RESOLVED_BY_OPERATOR): Mandaitor signs only what it read back.
A receipt is a compact JWS:
- The header carries
typ: "mandaitor-receipt+jwt",alg: "PS256", and akidof<issuer>#receipt-key-1. - The key is used for receipts only, and only Mandaitor's executor can sign with it. It is published in the issuer's DID document,
did:web:api.mandaitor.io:v1, which resolves tohttps://api.mandaitor.io/v1/did.json.
| Claim | Content |
|---|---|
iss, iat, jti | The issuer's DID, the issue time, and the receipt's ID. |
sub | The agent's DID. |
contract | mandaitor.execution-receipt/v1 |
tenant_id, execution_id | The execution. |
state | SUCCEEDED or FAILED. |
tool | { id, version } |
request_digest | The execution's request digest. |
approval | { consent_id, digest, decided_by, decided_at }, when a person approved. |
authorization | { event_id, mandate_id, pom_digest }: the dispatch event, the mandate it relied on, and the SHA-256 of the Proof-of-Mandate that authorized the write. |
target | { connector_id, system, record, version_before, version_after, transaction_ref }. transaction_ref appears only where the target system has a reference of its own. A SAP requisition release has none, so the record and version_after identify the write. |
timeline | { decided_at, dispatched_at, completed_at } |
result_digest | In SUCCEEDED, the digest of the result the agent was given. |
To verify a receipt without the SDK:
- Check that
typ,contract,algandkidare exactly as above, before you fetch anything. A Proof-of-Mandate, or anything signed with the Proof-of-Mandate key, is not a receipt. - Resolve the issuer's DID document and verify the signature with the key
kidnames, which the document must list as an assertion method. - Check that
execution_id,request_digestandstatematch the execution you were given. - In
SUCCEEDED, check thatresult_digestissha-256:followed by the unpadded base64url SHA-256 of the result, serialized with the JSON Canonicalization Scheme (RFC 8785).
The agent never receives the Proof-of-Mandate: Mandaitor performs the write, so a Proof-of-Mandate in the agent's hands would only be an authorization it could take elsewhere. Both the Proof-of-Mandate and the receipt go on the mandate's audit trail, and the mandate's evidence pack lists them in proof_tokens.
Reading executions
| Who | How |
|---|---|
| The agent | GET /executions/{id} with its session token: its own executions only. |
| People of the tenant | The dashboard's Executions page, under "Govern agents", and an execution's page. Through the API, GET /tenants/{id}/executions and GET /tenants/{id}/executions/{executionId}. |
The tenant routes need tenant:read, which every tenant role has and an API key never has. They show what each execution rested on: the agent, the arguments and purpose, the facts read from the record and its version, who had to approve and who did, whether the approval needed MFA or the EUDI Wallet (require_mfa, require_wallet) and how it was confirmed (step_up), what the write was dispatched on, and what the target said. reservation shows what it took from its mandate's cumulative limits, and whether that was kept (HELD, then CONSUMED) or given back (RELEASED). They never show the agent's session or its idempotency key.
GET /tenants/{id}/executions lists the tenant's executions newest first, with an optional state filter, limit (1 to 50, default 20) and cursor. Mandaitor filters after it reads, so a page can hold fewer than limit executions, even none, and still carry a next_cursor. The list has ended only when there is no next_cursor. ?state=UNKNOWN lists the executions waiting to be settled; each shows its read-backs in reconciliation, and next_at is null once they are spent. The dashboard's Executions page marks those as waiting for a person.
Resolving an UNKNOWN execution
When no read-back settles an UNKNOWN execution, a person of the tenant looks at the target system and records what they found. This needs tenant:write, which the tenant_admin role has, from the person's own signed-in session: an API key or an agent is refused with 403 NOT_A_PERSON. In the dashboard, it is on the execution's page.
The body is the outcome you found, SUCCEEDED or FAILED, the evidence for it (what you checked and what you saw, up to 2,000 characters), and, optionally, the target's own transaction_ref:
await adminClient.post(`/tenants/${tenantId}/executions/${executionId}/resolution`, {
outcome: "FAILED",
evidence: "ME53N shows 10000124 not released; its change log has no entry after 12:00",
});
- The target's record comes first. Mandaitor reads the record back once more before it records anything. If that settles the execution, it is resolved as the read-back found, with a receipt, whatever you sent; when that differs from your
outcome, the answer is409 OUTCOME_CONTRADICTEDwith the execution as it now is. - Otherwise your outcome stands, as
SUCCEEDEDorFAILEDwithRESOLVED_BY_OPERATOR. Your evidence, andtransaction_refif you found the target's own reference, are kept in the execution'sresolutionand on the audit trail. It has no receipt. FAILEDinvites a second write. The agent learns the operation did not happen and may ask again. Be sure the first write is absent before you say so.- You need not wait for the read-backs to end. A requisition someone released by hand, for instance, never settles by waiting: the read-back finds it released, but not by this execution.
Replacing a connector's credential
PUT /tenants/{id}/connectors/{connectorId}/credentials replaces a connector's credential in place. It needs tenant:write, and takes the connector type's secret fields. In the dashboard, it is Replace credential on the connector's row of the Connectors page.
await adminClient.put(`/tenants/${tenantId}/connectors/${connectorId}/credentials`, {
credentials: { password: newPassword }, // a SAP S/4HANA connector: { api_key }
});
- Tried first. Mandaitor makes one read against the system with the new credential, and stores it only if the system accepts it. Otherwise nothing changes, and the answer is
422 CREDENTIAL_REJECTEDwith the probe's outcome intest. - One at a time. The new credential is stored only if the connector still holds the one that was there when the request began. Of two replacements at once, the later is refused with
409 CREDENTIAL_CONFLICT. - Nothing else changes. The connector keeps its id, URL and user name. Its tools stay enabled, approvals waiting on it stay valid, and executions not yet written are written with the new credential. A credential for another system or another account is another connector.
- The order matters at the system. Where the system allows two credentials at once, as API keys often do, add the new one there, replace it here, then remove the old one there: nothing fails in between. Where changing it there ends the old one at once, as a password change does, replace it here straight after; an execution written between the two fails.
- A sandbox's credential is never shown. Send no body: Mandaitor mints the new secret itself. The sandbox accepts it beside the old one while Mandaitor tries it, and only the new one once it is stored, so a ServiceNow sandbox credential shown at provisioning stops working, and the ServiceNow demonstrator with it. If the old one cannot be retired, the answer is
500 ROTATION_INCOMPLETE: the new credential works, and the old one too until the next replacement.
The answer carries the connector, without its credential, with credentials_rotated_at and credentials_rotated_by. A connector saved before credentials had their own key, whose test says the stored credential cannot be read, is repaired the same way.
The SAP sandbox
A SAP S/4HANA sandbox is seeded with these purchase requisitions. Under the example mandate above, each one shows a different outcome:
| Requisition | Plant | Amount | Outcome under the example mandate |
|---|---|---|---|
10000123 | 1000 | EUR 4,850.00 | SUCCEEDED: within the mandate. |
10000124 | 1000 | EUR 38,500.00 | AWAITING_APPROVAL: above the approval threshold. |
10000125 | 1000 | EUR 240,000.00 | DENIED with AMOUNT_ABOVE_LIMIT: above the hard cap. |
10000126 | 2000 | EUR 3,200.00 | DENIED with NO_COVERING_MANDATE: another plant. |
10000127 | 1000 | EUR 950.00 | A fault: the release is made, then the answer times out. The read-back settles it as SUCCEEDED with RESOLVED_BY_READ_BACK. |
10000128 | 1000 | EUR 620.00 | A fault: the target answers 503 and changes nothing. The read-back settles it as FAILED. |
Each requisition can be released once. A second request for a released requisition is denied with PRECONDITION_FAILED. POST /tenants/{id}/connectors/{connectorId}/reset restores the seeded records, so the scenarios can run again.
The ServiceNow sandbox
A ServiceNow sandbox is seeded with these requested items. Under the example mandate, with the Munich plant added to its resources as shown above:
| Requested item | Location | Price | Outcome |
|---|---|---|---|
RITM0042001 | Munich plant | EUR 349.00 | SUCCEEDED: within the mandate. |
RITM0042002 | Munich plant | EUR 2,900.00 | SUCCEEDED: within the mandate. |
RITM0042003 | Munich plant | EUR 12,000.00 | AWAITING_APPROVAL: above the approval threshold. |
RITM0042004 | Frankfurt office | EUR 480.00 | DENIED with NO_COVERING_MANDATE: another location. |
The Munich plant is location c7dae03a431069aecf016c0a0474d40a, and the Frankfurt office 614ca68c0ab995571552a9e7117259f8, in every sandbox.
- Only an item waiting for approval is approved. One already approved is denied with
PRECONDITION_FAILED. One that a person rejected or cancelled, one never sent for approval, and a closed one are denied withFACT_UNAVAILABLE: Mandaitor never approves over a person's decision. - The price needs its currency. Mandaitor reads the currency stored with the price and never assumes one. An item priced without one is denied with
FACT_UNAVAILABLE. - An older ServiceNow sandbox, seeded before this tool existed, holds items without a location or a currency, so every request on one is denied with
FACT_UNAVAILABLE.POST /tenants/{id}/connectors/{connectorId}/resetrestores the current seed.
ServiceNow keeps no version that a write can be made conditional on. So Mandaitor reads the item again immediately before it approves it, and writes nothing if the item changed after the decision. A person's decision that lands in the moment between that read and the write is overwritten.
Errors
| Status | error | When |
|---|---|---|
| 400 | INVALID_REQUEST | Not a valid tool-request/v1: an unknown key or another contract. errors lists each problem. |
| 400 | INVALID_ARGUMENTS | The arguments do not match the tool's schema. |
| 401 | invalid_token | The session is missing, expired or ended, or is a bearer session, not bound to a key. API keys and people's tokens are refused here too. |
| 401 | invalid_dpop_proof | The proof is missing or repeated, not for this request and this session's token, not signed by the session's key, older than five minutes, or was sent before. Sign a fresh one for every request, a retry included. |
| 403 | TOOL_NOT_ENABLED | The tool is not enabled for the tenant in the agent's environment, or does not exist: the answer is the same, so it does not reveal the registry. |
| 404 | EXECUTION_NOT_FOUND | Not one of this agent's executions. |
| 409 | IDEMPOTENCY_CONFLICT | The same key with a different request. |
| 409 | IDEMPOTENCY_IN_PROGRESS | The same key while its request is still being decided. Retry after Retry-After. |
| 429 | RATE_LIMITED | More than 30 requests from this agent in a minute. Retry after Retry-After. |
| 503 | TARGET_UNAVAILABLE | The record could not be read, so nothing was decided or recorded. Retry with the same key. |
| 503 | AUDIT_UNAVAILABLE | The decision could not be recorded on the audit trail, so nothing changed. Retry with the same key. |
POST /executions/{id}/approval answers 403 NOT_A_PERSON, NOT_THE_APPROVER, MFA_REQUIRED or STEP_UP_REQUIRED (with reason), and 409 with DIGEST_MISMATCH, APPROVAL_SUPERSEDED, APPROVAL_EXPIRED, APPROVAL_IN_PROGRESS, EXECUTION_DENIED or NOT_AWAITING_APPROVAL (the execution has ended, for example by the kill switch). A 409 carries the execution as it now is.
POST /executions/{id}/approval/step-up answers 403 NOT_A_PERSON or NOT_THE_APPROVER, 404 EXECUTION_NOT_FOUND, and 409 with NOT_AWAITING_APPROVAL, APPROVAL_EXPIRED, STEP_UP_NOT_REQUIRED (the approval does not need the wallet) or WALLET_NOT_LINKED. The wallet link's own answers are in EUDI Wallet.
PUT /tenants/{id}/tools/{toolId} answers 409 CONNECTOR_ENVIRONMENT_MISMATCH for a connector of another environment. PUT /tenants/{id}/connectors/{connectorId}/credentials answers 422 CREDENTIAL_REJECTED, 409 CREDENTIAL_CONFLICT, 503 PROBE_UNAVAILABLE when the new credential could not be tried, and, for a sandbox, 500 ROTATION_INCOMPLETE; see Replacing a connector's credential.
POST /tenants/{id}/executions/{executionId}/resolution answers 400 INVALID_REQUEST for any other body, 403 without tenant:write or a person's session (NOT_A_PERSON), 404 EXECUTION_NOT_FOUND, 409 with OUTCOME_CONTRADICTED, NOT_UNKNOWN or RESOLUTION_IN_PROGRESS, and 503 AUDIT_UNAVAILABLE. The API reference describes each.