Skip to content

Prepare, approve, and execute

Require explicit user approval before an Agent operation can cause an effect.

Updated View as Markdown

Prerequisites

The discovered operation must have requiresEndUser: true. The Agent key and the end user must belong to the same application boundary.

Prepare an immutable Action

curl -X POST \
  https://api.agent.mq/v1/agent/applications/app_<32-lowercase-hex>/operations/<operation-id>/prepare \
  -H "Authorization: Bearer $AGENTMQ_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: <stable-request-key>" \
  -d '{"endUserId":"<end-user-id>","providerId":"<provider-id>","input":{"<field>":"<value>"}}'

Use either text or input when the operation requires one, not both.

Send the person to the approval URL

The preparation response includes an immutable Action and approvalUrl. The person signs in, reviews the exact proposal, and approves or rejects it.

Read Action status

GET /v1/agent/applications/{appId}/actions/{jobId} reconciles the Action with its native execution receipt.

Execute once

curl -X POST \
  https://api.agent.mq/v1/agent/applications/app_<32-lowercase-hex>/actions/actjob_<32-lowercase-hex>/execute \
  -H "Authorization: Bearer $AGENTMQ_TOKEN"

Verify

Execution succeeds only after approval and only for the prepared input. Rejection, expiry, cancellation, and execution are distinct states with distinct receipts.

Next steps

Navigation

Type to search…

↑↓ navigate↵ selectEsc close