Skip to content

Operation approval ​

Primary workflow ​

An authenticated team member asks for a price change. MCP records a proposal; an owner or admin approves its exact version in the app. The API worker executes the saved change independently of further agent calls. API/App is implemented and tested against fake drivers; acceptance against the new OpenCart module is pending.

1. The agent prepares a change ​

Call price_change_propose. Identity, team and store come from verified context, never tool arguments. Alternative selection + adjustment is described in decision 007: the API scans product.list, filters, and re-reads every selected product live.

json
{
  "items": [
    {
      "product_id": "42",
      "new_price": "18.0000"
    }
  ]
}

2. The API reads live shop data ​

The signed request below reads the product. Its live base price becomes expected. Prices include no tax and use the store default currency. A product list is never the source of an approved expected value.

json
{
  "protocol": "1.0",
  "id": "req-101",
  "op": "product.get",
  "params": {
    "ids": [
      "42"
    ]
  }
}

3. The API records a version ​

The app renders exact prices from the saved API version, not agent prose. The proposal expires after 24 hours. Changing it creates a new version and invalidates approval of the old version. A chat message saying “yes” is not authorization. The following is an excerpt of the tool result.

json
{
  "proposal_id": "change-calm-rivers-k8m4p2d7n9x3",
  "version": 1,
  "status": "proposed",
  "currency": "USD",
  "items": [
    {
      "product_id": "42",
      "name": "Ceramic Mug",
      "code": "MUG-42",
      "old_price": "20.0000",
      "new_price": "18.0000"
    }
  ],
  "applied": false,
  "execution": null
}

4. The owner approves in the app ​

The browser sends the authenticated request below, including the displayed version. The API returns HTTP 200 with the proposal and its job in approved state. This means queued, not applied. Repeated approval returns the same job. Only an owner or admin of this store’s team may approve; a member cannot. The access token stays outside agent arguments.

http
POST /teams/{teamId}/stores/{storeId}/changes/change-calm-rivers-k8m4p2d7n9x3/approve
Authorization: Bearer <user-access-token>
Content-Type: application/json

{"version":1}

5. The worker sends the approved change ​

The worker claims the job with a lease, checks approval, current membership, team, store, agent pause and expiry. It sends only saved expected/set values. The module receives no approval token, user session or chat text. The module must enforce the conditional comparison and trigger the native product update event. Request id is not an idempotency key.

json
{
  "protocol": "1.0",
  "id": "req-102",
  "op": "product.apply",
  "params": {
    "items": [
      {
        "id": "42",
        "expected": {
          "price": "20.0000"
        },
        "set": {
          "price": "18.0000"
        }
      }
    ]
  }
}

6. The result appears in the app ​

After the module answers, the API performs product.get read-back and stores a per-item receipt. The approval panel polls every five seconds. The agent can call price_change_status with proposal_id to explain the result; there is no automatic new agent message implemented. Approval alone never proves success. Below is an execution receipt excerpt.

json
{
  "status": "applied",
  "receipt": {
    "finishedAt": "2026-10-12T12:00:00Z",
    "reason": null,
    "items": [
      {
        "id": "42",
        "resource": "product",
        "field": "price",
        "outcome": "applied",
        "after": "18.0000",
        "event": "fired",
        "verifiedBy": "read_back"
      }
    ]
  }
}

If the price changed meanwhile ​

A mismatching live expected value or module conflict stops that item. The API never replaces expected and retries without new approval. applied means all items were confirmed applied, emitted their event and matched read-back; partially_applied means only some succeeded. A module envelope with ok: true does not imply every item succeeded.

If a response is lost or access is revoked ​

Before sending, the worker persists a dispatch marker. After a timeout or restart it reads the product but does not resend the write. A matching new price without execution/event evidence is unknown, and the job remains unknown. Unavailable read-back is also uncertain. Revoked approval authority, a blocked team, a paused store or expiry stops further dispatch. Reject is available only before approval; there is no user-facing cancellation of an approved job and no rollback promise.

Why there is no agent execution tool ​

There is no price_change_apply or execute_operation. The API worker owns execution. This avoids letting the model supply approval evidence or depend on an additional chat turn.

Responsibilities ​

API operations/change: versions, authorization, jobs, receipts and reconciliation. MCP: typed transport adapter. App: approve/reject the displayed version and show receipt. Module: signed reads, conditional writes and native events. Agentfy: agent runtime and tool calls. Existing agents must refresh their cached tools after migration.