Skip to main content

Pay the Sub-Agent After the Work Is Accepted, Not When It Says Done

A 30-line fail-closed gate on acceptance.json, with a real accepted handover.

Updated 6 min readMarkdown

Orchestrators are starting to pay other agents for work: a research sub-agent, a code-review agent, a freelancer's agent across the internet. Most of these setups release the money when the worker reports "done". That's the wrong trigger. "Done" is the worker grading its own work.

A better trigger is a decision by someone other than the worker, recorded somewhere both sides can read, plus proof that the steps behind it weren't changed afterwards. This post shows a small payer-side gate built on that idea. It doesn't hold anyone's money and it works with any payment rail: x402, a card, an invoice.

Three states, one rule

The gate only needs to tell three things apart:

State Meaning Payer action
accepted The client, not the worker, recorded acceptance release
pending Nobody has decided yet hold
flagged The client wants changes hold

The rule: only a recorded client acceptance releases money. Anything else, including a timeout, a missing record or a network error, means hold. Escrow products sometimes do the opposite and pay the worker by default after a deadline. That's a real choice, but make it on purpose. For a gate you write yourself, fail closed.

What the record needs to contain

For the gate to mean anything, the acceptance record has to answer five questions without trusting the worker:

  1. Who decided? The client, or the worker on the client's behalf?
  2. When? And does a later change of mind show up as a new decision instead of rewriting the old one?
  3. What steps does it cover? A list of the individual tool calls or outputs, not a summary.
  4. Were those steps checked? How many of them pass an integrity check right now?
  5. What does the check not cover? "The bytes haven't changed" is not the same as "the work is correct."

Here's a real record that answers all five. It's the public example handover on Zambo, fetched with a plain GET on December 1, 2026:

curl -s https://zambo.dev/handover/cfdb6dd8-5b2c-468c-9c72-4dbd1b47317c/acceptance.json
{
  "handover_id": "cfdb6dd8-5b2c-468c-9c72-4dbd1b47317c",
  "status": "accepted",
  "status_semantics": "client_decision",
  "decided_at": "2026-10-17T10:15:06.485Z",
  "decided_by": "client",
  "release_hint": "ok_to_release",
  "steps_total": 7,
  "steps_checked": 7,
  "steps_unchecked": 0,
  "check_scope": "Receipt bytes only; not accuracy or human review of every step.",
  "receipt_urls": ["https://zambo.dev/run/5d58a8fc-229b-4b81-bf9d-396f466a6705", "..."],
  "aer1_version": "draft-zambo-aer1-26"
}

Mapping it to the five questions:

  • decided_by: "client" and status_semantics: "client_decision" answer who. Only the person holding the private client link can accept or flag. The worker's own link can't.
  • decided_at answers when. A later, different decision is recorded separately; the original keeps its time.
  • receipt_urls lists what: seven step receipts, each its own page.
  • steps_checked: 7 of steps_total: 7 answers checked.
  • check_scope answers what it doesn't cover, in one plain sentence. Show that sentence to whoever approves the payment.

release_hint is the summary: ok_to_release only for a recorded client acceptance, and hold for pending or flagged.

The gate

Here's the whole thing in Python. It pays nothing itself; it returns a decision your payment code acts on.

import requests

def release_decision(handover_id: str, timeout: float = 10.0) -> dict:
    url = f"https://zambo.dev/handover/{handover_id}/acceptance.json"
    try:
        r = requests.get(url, timeout=timeout)
        r.raise_for_status()
        rec = r.json()
    except Exception as e:
        return {"release": False, "reason": f"no record: {e}"}   # fail closed

    if rec.get("release_hint") != "ok_to_release":
        return {"release": False, "reason": f"status={rec.get('status')}"}
    if rec.get("decided_by") != "client":
        return {"release": False, "reason": "not a client decision"}
    if rec.get("steps_unchecked", 1) != 0 or rec.get("steps_checked") != rec.get("steps_total"):
        return {"release": False, "reason": "some steps did not pass the receipt check"}

    return {
        "release": True,
        "decided_at": rec["decided_at"],
        "steps": rec["steps_total"],
        "scope": rec["check_scope"],          # log this next to the payment
        "evidence": rec["receipt_urls"],
    }

Then in your orchestrator:

d = release_decision(job.handover_id)
if d["release"]:
    pay(job.worker, job.amount, memo=f"accepted {d['decided_at']}")
    ledger.append({"job": job.id, **d})
else:
    job.status = "held"
    notify_owner(job, d["reason"])

Notes:

  • Don't take release_hint alone. The gate re-checks decided_by and the step counts itself. Belt and braces cost three lines.
  • Store the evidence with the payment. When someone asks in March why a sub-agent got paid in October, the ledger row has the decision time and seven receipt links anyone can open.
  • Poll, don't push. The gate is a GET with no auth, so a cron job or the orchestrator's own loop can run it. Reading and checking records is free on Zambo; the client decision itself is free too.

Checking a step yourself

If you don't want to trust the summary counts, check a step directly. Each receipt URL has a verify endpoint:

curl -s https://zambo.dev/api/v2/receipt/5d58a8fc-229b-4b81-bf9d-396f466a6705/verify

Or paste a receipt link into zambo.dev/verify in a browser. The receipts follow AER-1, an open receipt format for AI agent tool calls (draft-zambo-aer1, revision 26), so the check doesn't depend on running anyone's SDK.

How the worker side produces this

The worker connects its agent to https://zambo.dev/mcp, does the job, and opens a handover. The handover bundles that job's step receipts and gives the worker two links: a public read-only one and a private client link. The worker sends the client link to whoever commissioned the work. The client opens it, looks at the steps, and clicks Accept or Flag a problem. No AI account or wallet needed on the client side.

For agent-to-agent work, the commissioning agent can hold the client capability and record the decision itself, which works fine when that agent is the one actually reviewing the output. If a human should sign off, give the client link to the human, not the agent.

Private handovers need a Day Pass ($0.99 for 24 hours, one payment by card, PayPal or x402 USDC on Base) or a Zambo Pass ($29 for 30 days). See pricing.

What this does and doesn't prove

It proves the client recorded acceptance at a specific time and that the step receipts haven't changed since they were saved. It does not prove the work is correct, that the client read every step, or who the client really is; client links can be forwarded. That's why the gate logs check_scope next to every payment. It isn't a substitute for reviewing the work. It's a way to make sure money only moves after someone other than the worker said yes, with a record anyone can check later.

A real accepted handover to poke at: zambo.dev/handover/cfdb6dd8-…. More examples are on zambodotdev.github.io and rambozambodotdev.gitlab.io.

About the author

  • Trust layer for AI work. Verifiable receipts for every AI tool call. MCP at https://zambo.dev/mcp

No comments yet. Be the first to comment.