← Back to Guides
5

Series

Federated AI Agents· Part 5

Companion to the book Federated AI Agents · this part maps to Chapter 13

GuideFor: AI Engineers, ML Engineers, Platform Engineers, AI Systems Architects

A2A Saga Compensation: Your Undo Outlives Its Authority

Across an owner line, an undo is a new task the partner may refuse, sent long after the authority that took the step has expired or been revoked. It needs authority of its own, and only the owner that took the step may send it.

#a2a-protocol#saga-pattern#compensating-transactions#delegation#langgraph#multi-agent-systems

This series grew into a book: Federated AI Agents. Chapter 13 covers this part. Where the chapter goes further is at the end of this article.

Once an A2A task completes, CancelTask cannot touch it, so saga compensation across companies means sending a new task the partner may refuse, under authority that may no longer exist. SHOP-7 ordered a frame for a car whose claim Meridian had already referred to an adjuster. The repair shop belongs to Northgate, a partner company, and the claim, CLM-1002, belonged to Meridian Mutual, a motor insurer. On day one, Meridian's claims graph, running under the session of adjuster adj-117, cleared the claim when the Risk team's fraud agent scored it 68, two points under the referral line. Northgate estimated 8,300 and booked the car into SHOP-7 at 14:00, and the payment waited at Finance for a manager's approval. The next morning an old policy number was merged into the claimant's current one. Three earlier claims appeared, Risk re-scored the claim at 82, and the claims graph referred it to an adjuster, as designed.

Nobody told SHOP-7, so the shop ordered the frame, held the bay, and phoned the claimant to bring the car in. Northgate's agent card had declared an undo for the booking, cancel_booking, good for 72 hours. Nothing on the claims side sent it.

Had Claims tried, the obvious authority would have failed: the delegation chain the booking went out under expired within 15 minutes, hours before the merge. When I replayed the incident with roots that could carry the undo, a fresh exchange of the adjuster's session still worked the next morning. Then I suspended her, as an insurer might over the very claim being unwound, and after that her session could not be exchanged at all. Northgate would still have honoured the undo, and nothing Claims had built could still ask for it.

I call that a stranded undo: an undo the partner would still honour, inside the window it promised, that nobody at the caller still has the authority to send. Which authorities exist is a design choice, so an undo is stranded relative to what the caller built. Meridian's design gave the undo only the authority of the step it reverses: the booking's chain, gone within 15 minutes of the call in this series' setup, and the adjuster's session, gone when she was suspended.

Meridian Mutual is this series' fictional running example, but the mechanism is not fictional: I replayed the incident and every experiment below on a2a-sdk 1.3.1 and langgraph 1.2.24, both current as of 2026-11-20.

This part's claim is about authority. Across an owner line a compensation is a new task, and it is sent after the authority that took the step has expired or been revoked. It needs authority of its own. That authority is a delegation link minted for the undo. It is narrowed to one compensating skill and one task, and the partner accepts it only from the workload that sent the task.

That last rule decides who runs the saga. One strand of the cross-organisational process literature, the W3C's choreography language, starts from companies that will not delegate control of their processes, so no party runs the whole sequence. For undos the reverse holds, at any owner line, between companies or between teams of one company. Among the parties acting for the caller, only the owner that took a step has standing to ask the partner to undo it, so that owner has to decide and send its own undos. A partner can still cancel its own work, and a claimant or a regulator can act on contracts of their own; those are different undos. A partner that undoes on anyone else's signal has handed its undo to whoever can send that signal.

Parts of this are old, and I credit them where they come up: compensation as a new transaction (Garcia-Molina and Salem, 1987), a coordinator that routes compensation to participants (WS-BusinessActivity), and long-running work that outlives a user's token, which identity teams handle with refresh tokens and token exchange. What I have not found written down is what that last problem does to a saga across owners. The undo outlives the authority that took the step, the partner has to check who sends it, and that check settles orchestration against choreography.

A2A has CancelTask, not undo: what the caller can still change

A2A gives a caller one operation that changes a partner's task after it was sent. In the specification, CancelTask "Requests the cancellation of an ongoing task. The server will attempt to cancel the task, but success is not guaranteed" (A2A specification v1.0.1, §3.1.5). A task that has already finished cannot be cancelled. For that case the spec defines TaskNotCancelableError, which covers a task that "has already reached a terminal state like TASK_STATE_COMPLETED, TASK_STATE_FAILED, TASK_STATE_CANCELED, TASK_STATE_REJECTED". In Python, a2a-sdk 1.3.1 does what the spec says: its default request handler checks the stored state and raises that error before the executor ever sees the request.

There is no undo, rollback or compensation operation anywhere in the spec. Someone did propose one. An "A2A-SAGA" extension RFC, with an orchestrator demo, was opened against the A2A samples repository in January 2026 and closed without merging on 2026-11-13 (a2a-samples PR #430). So once a partner's task completes, the protocol offers the caller nothing that changes what it did.

Your own side does not help either. LangGraph's time travel can fork a thread from an earlier checkpoint, but replaying from there re-runs the nodes after it, "including any LLM calls, API requests, and interrupts" (LangGraph docs, time travel). A fork rewinds Claims' state. It sends nothing to SHOP-7. If it re-runs the booking node, it sends the booking again, and only the partner's key index stands between that send and a second booking. Part 2 showed the same replay sending a second A2A task on resume.

The naive fix makes the claims graph louder: when a claim is referred, cancel every partner task it holds. I ran exactly that against the incident, the next morning:

python
# Wrong: "undo" a reversed claim by cancelling every task in the ledger# (an async test in the companion's ch13 tag: nodes, ledger, as_run, thread)with as_run(thread("e1")):    for seam, entry in ledger.items():        outcome = await nodes[seam].cancel(entry["task_id"])        print(seam, entry["state"], "->", outcome)
text
fraud_screening  completed      -> TaskNotCancelableErrorrepair_estimate  completed      -> TaskNotCancelableErrorrepair_booking   completed      -> TaskNotCancelableErrorpayments         input-required -> canceled

Each of the four outcomes appears in the diagram next to what that task had done at its owner.

d2
grid-rows: 2
grid-columns: 2
grid-gap: 24
risk: "Risk: screen_fraud" {
  label.near: top-center
  grid-columns: 1
  grid-gap: 10
  style: {fill: "#F4F6F7"; stroke: "#95A5A6"; font-color: "#2C2C2A"}
  s: "completed\nchanged nothing at Risk" {style: {fill: "#95A5A6"; stroke: "#6C7A7B"; font-color: "#2C2C2A"}}
  c: "cancel -> not cancelable\nnothing to undo" {style: {fill: "#98D8C8"; stroke: "#5FA898"; font-color: "#2C2C2A"}}
}
est: "Northgate: estimate" {
  label.near: top-center
  grid-columns: 1
  grid-gap: 10
  style: {fill: "#F4F6F7"; stroke: "#95A5A6"; font-color: "#2C2C2A"}
  s: "completed\nbilled 3.5" {style: {fill: "#95A5A6"; stroke: "#6C7A7B"; font-color: "#2C2C2A"}}
  c: "cancel -> not cancelable\ncost accepted" {style: {fill: "#98D8C8"; stroke: "#5FA898"; font-color: "#2C2C2A"}}
}
book: "Northgate: book_repair" {
  label.near: top-center
  grid-columns: 1
  grid-gap: 10
  style: {fill: "#F4F6F7"; stroke: "#95A5A6"; font-color: "#2C2C2A"}
  s: "completed\nbay held at SHOP-7" {style: {fill: "#7B68EE"; stroke: "#5A4BC4"; font-color: "#FFFFFF"}}
  c: "cancel -> not cancelable\nthe booking stands" {style: {fill: "#E74C3C"; stroke: "#B03A2E"; font-color: "#FFFFFF"}}
}
pay: "Finance: pay_claim" {
  label.near: top-center
  grid-columns: 1
  grid-gap: 10
  style: {fill: "#F4F6F7"; stroke: "#95A5A6"; font-color: "#2C2C2A"}
  s: "input-required\nwaiting for approval" {style: {fill: "#FFD93D"; stroke: "#C9A800"; font-color: "#2C2C2A"}}
  c: "cancel -> canceled" {style: {fill: "#6BCF7F"; stroke: "#3F9E52"; font-color: "#2C2C2A"}}
}

Cancel reached only the payment, which was still waiting for approval. Northgate's booking was the step with a real effect at another company, and it was the step cancel could not touch, because it had committed the day before. Every call that failed reported only that the task was not cancelable. A2A gives you nothing for a committed step, so the undo has to be something the partner offers.

A2A agent card compensation terms: declare the undo and its window

If the protocol has no undo, the partner has to declare one, and it has to say for how long it will honour it. Part 3 made the agent card's terms into data with effective dates, which Claims' code checks at connect. Part 4 added a key window to those terms. Compensation adds two more fields to each skill: the skill that undoes it, and how long after the forward task commits the partner promises to honour that undo.

Northgate's terms revision that adds book_repair declares both. Its other skill here, estimate_repair, has no undo: each estimate is billed at 3.5, in the claim's currency, and kept.

python
BOOK_REPAIR = SkillTerms(    inputs=(Field("claim_id", "string"), Field("damaged_parts", "string[]")),    outputs=(Field("booking", "string"), Field("shop", "string")),    p95_seconds=2.0, key_seconds=3600,    compensated_by="cancel_booking", compensate_seconds=72 * 3600)

cancel_booking is an ordinary skill. Its input is the claim id plus the id of the booking task to reverse, and it answers with an outcome, an amount owed, and a residue: whatever the undo could not take back. Finance declares void_payment as the undo of pay_claim, honoured for 12 hours. That number comes from how Finance pays. A completed payment waits for the next payment run, and the run sends only payments that are at least 12 hours old, so a void works until the money has left. Risk declares nothing, because a screening changes nothing at Risk.

On Claims' side, each forward step gets a row in a saga plan. A row names the seam, the partner's compensating skill, how long after the step commits Claims may still need the undo, and who settles what the undo cannot. In the diagram, the four rows sit against the windows the partners promise.

d2
grid-rows: 5
grid-columns: 4
grid-gap: 8
h1: "Forward step" {style: {fill: "#95A5A6"; stroke: "#6C7A7B"; font-color: "#2C2C2A"; bold: true}}
h2: "Undo the partner declares" {style: {fill: "#95A5A6"; stroke: "#6C7A7B"; font-color: "#2C2C2A"; bold: true}}
h3: "Claims needs it for" {style: {fill: "#95A5A6"; stroke: "#6C7A7B"; font-color: "#2C2C2A"; bold: true}}
h4: "Who settles a residue" {style: {fill: "#95A5A6"; stroke: "#6C7A7B"; font-color: "#2C2C2A"; bold: true}}
a1: "1. screen_fraud (Risk)" {style: {fill: "#FFA07A"; stroke: "#D9785A"; font-color: "#2C2C2A"}}
a2: "none: nothing to undo" {style: {fill: "#F4F6F7"; stroke: "#95A5A6"; font-color: "#2C2C2A"}}
a3: "-" {style: {fill: "#F4F6F7"; stroke: "#95A5A6"; font-color: "#2C2C2A"}}
a4: "-" {style: {fill: "#F4F6F7"; stroke: "#95A5A6"; font-color: "#2C2C2A"}}
b1: "2. estimate_repair (Northgate)" {style: {fill: "#7B68EE"; stroke: "#5A4BC4"; font-color: "#FFFFFF"}}
b2: "none: billed 3.5, kept" {style: {fill: "#F4F6F7"; stroke: "#95A5A6"; font-color: "#2C2C2A"}}
b3: "cost accepted" {style: {fill: "#F4F6F7"; stroke: "#95A5A6"; font-color: "#2C2C2A"}}
b4: "-" {style: {fill: "#F4F6F7"; stroke: "#95A5A6"; font-color: "#2C2C2A"}}
c1: "3. book_repair (Northgate)" {style: {fill: "#7B68EE"; stroke: "#5A4BC4"; font-color: "#FFFFFF"}}
c2: "cancel_booking, 72 h\n(short by that gap)" {style: {fill: "#FFD93D"; stroke: "#C9A800"; font-color: "#2C2C2A"}}
c3: "72 h plus the gap to\nthe approval request" {style: {fill: "#4A90E2"; stroke: "#2C6FB0"; font-color: "#FFFFFF"}}
c4: "Claims' adjuster with\nNorthgate's network desk" {style: {fill: "#98D8C8"; stroke: "#5FA898"; font-color: "#2C2C2A"}}
d1: "4. pay_claim (Finance)" {style: {fill: "#FFA07A"; stroke: "#D9785A"; font-color: "#2C2C2A"}}
d2: "void_payment, 12 h" {style: {fill: "#6BCF7F"; stroke: "#3F9E52"; font-color: "#2C2C2A"}}
d3: "1 h: the hourly\nreconciliation finds orphans" {style: {fill: "#4A90E2"; stroke: "#2C6FB0"; font-color: "#FFFFFF"}}
d4: "Finance's recovery team,\nfrom the payee" {style: {fill: "#98D8C8"; stroke: "#5FA898"; font-color: "#2C2C2A"}}

The third column is the one people leave out. A partner's window is what the partner promises. Claims' need is what Claims' own design requires, and each number has a cause on Claims' side. Finance's approvers can take up to 72 hours, and that wait starts when the payment is sent, after the booking. A refusal on the last day therefore arrives more than 72 hours after the booking committed. The companion's plan rounds Claims' need to 72 hours, exactly Northgate's window, which leaves no margin at all. With the need set to 72 hours plus ten minutes, the same check refuses Northgate's current terms: "cancel_booking is honoured 259200 s, and the plan needs 259800 s". An honest plan here is a request to Northgate for a longer window, or a reason to count the approval wait from the booking. If you copy the companion's MERIDIAN_PLAN, change the booking row to 72 hours plus your own margin first.

The payment row has a different trigger. Part 4's reconciliation pass finds an orphan payment within an hour of it appearing, so Claims needs the void to work for at least that hour. A re-screen like CLM-1002's can land later than that, and later than Finance's 12-hour void window too. Meridian's plan accepts that case: a reversal after the payment run is a residue by design, owned by Finance's recovery team, which recovers the money from the payee.

Before the booking node sends anything, the plan is checked against the terms on the partner's card, by the same code path as Part 3's checks. When I deployed a Northgate revision whose book_repair declared no undo, the check reported "book_repair is not undone by cancel_booking", the claim stopped before the booking, and Northgate booked nothing. Cut the promised window to one hour in the next revision, and the check reads "cancel_booking is honoured 3600 s, and the plan needs 259200 s". In Part 3's terms that is a dated breach: it is found the day Northgate publishes the revision, not the day a reversal needs it. That check protects new bookings. A booking made yesterday was promised yesterday's window, so the window that binds an undo is the one in force when the forward step committed. Ask the partner to say so on its card, and record the terms revision in the step's ledger entry. The companion's cancel_booking reads the revision Northgate runs now, which is a simplification. A step the plan says needs an undo is never taken unless the partner promises one. Claims' card trust policy also approves book_repair and cancel_booking in the same change, so the forward skill is never allowed while its undo is not.

Card payments already work this way, and the comparison helps. Stripe's documentation on holds says an authorisation "for an online card payment is valid for 7 days", and if it expires before capture, "the funds are released and the payment status changes to canceled" (Stripe). Inside the window, cancelling the hold is the undo, and a hold that expires releases itself. Once the payment is captured, the undo becomes a refund, which is a different conversation. Gabriel Anhaia's piece on irreversible saga steps draws the consequence for a single team: "Your saga timeout has to be shorter than the shortest authorization in the chain" (DEV). Across owners the window is a term the partner states and can change in its next release, so it belongs on the card and in the check.

Saga compensation authority: the stranded undo

Claims' saga plan says what to send but not who may send it, and that is where the incident would have failed even with a compensator in the graph.

Every call in this series goes out under a delegation chain. A Meridian person's session is exchanged for a root link, and that link is narrowed at each hop to the skills and fields the next call needs. Meridian's issuer gives every root 15 minutes. That is a sensible lifetime for an adjuster working a claim. It is a short lifetime for authority that a partner's undo, promised for 72 hours, will need.

I ran it. The companion's adjuster root grants no undo skill at all, so for the people's options I gave Meridian's root a variant grant that adds cancel_booking, as a team choosing option B would have to. Then, at three times after the booking, I sent a real cancel_booking to Northgate under each of four authorities, each in a fresh run of the incident:

  • A. The chain the booking went under, kept from day one.
  • B. A fresh exchange of the adjuster's session, at the time of the undo.
  • B'. A fresh root for whoever holds the claim now: adjuster adj-208, to whom CLM-1002 was reassigned.
  • C. A compensation link: a link minted from a compensation root the issuer holds for Claims itself, for one claim, narrowed to cancel_booking and to the one booking task.
When the undo is sentA. booking's chainB. re-exchanged sessionB'. claim's holder nowC. compensation link
10 minutes after the bookingcancelledcancelledcancelledcancelled
16 hours after (the merge lands)403 chain expiredcancelledcancelledcancelled
16 hours after, adj-117 suspended403 chain expiredcannot mint: unknown or ended sessioncancelledcancelled

Every run uses the companion's issuer and guard, so the table records the reference implementation's rules (15-minute roots, a suspension ends the session), not the behaviour of any particular identity provider.

The timeline shows the case the incident hit: the forward chain and the adjuster's session both gone, the partner's window still open.

d2
direction: down
t0: "Day one, 14:00\nbooking committed at Northgate under the adjuster's chain" {
  style: {fill: "#7B68EE"; stroke: "#5A4BC4"; font-color: "#FFFFFF"}
}
windows: "The next morning (+16 h), adjuster suspended" {
  label.near: top-center
  grid-rows: 1
  grid-gap: 18
  style: {fill: "#F4F6F7"; stroke: "#95A5A6"; font-color: "#2C2C2A"}
  chain: "Adjuster's chain\nexpired at 14:15" {style: {fill: "#E74C3C"; stroke: "#B03A2E"; font-color: "#FFFFFF"}}
  session: "Adjuster's session\nended: suspended" {style: {fill: "#E74C3C"; stroke: "#B03A2E"; font-color: "#FFFFFF"}}
  window: "Northgate's undo window\nopen until day four, 14:00" {style: {fill: "#6BCF7F"; stroke: "#3F9E52"; font-color: "#2C2C2A"}}
}
stranded: "Stranded undo: Northgate would cancel,\nnothing Claims built may still ask" {
  style: {fill: "#FFD93D"; stroke: "#C9A800"; font-color: "#2C2C2A"}
}
t0 -> windows: "16 hours"
windows -> stranded

Under option A alone, the gap opens 15 minutes after every booking and lasts until the partner's window closes. In Meridian's flows a claim is reversed by a re-screen or by a refused approval, and neither arrives inside 15 minutes. CLM-1002's reversal came the next morning, and a refused approval can come more than 72 hours after the booking (up to 72 hours after the payment request). So a design that relies on the booking's own chain needs fresh authority for almost every undo it will ever send.

Option B gives that authority only while the adjuster's session can still be exchanged. I do not expect suspension and reversal to be independent. An adjuster is suspended because of claims like the one being unwound, so option B is most likely to fail on the reversals that matter most.

Option B' is the strongest alternative to C, and it works in the table. Its cost is in what it requires. Every adjuster's root has to carry the undo skills for every claim on their caseload, so any session that can work a claim can also reverse its committed steps at every partner, which is far more authority than working a claim needs. The undo is recorded under a person who neither took the step nor, often, decided the reversal: CLM-1002 was reversed by an automated re-screen, and a referred claim can wait in a queue before anyone holds it. The time to reassignment is a staffing fact, with no bound that a 12-hour void window can rely on. B' is a defensible design for a team that wants every undo signed by a person. C is the one I would choose: authority that exists only for the undo, and is alive whenever the reversing decision is made.

Option D is a service credential for a compensator workload, which is an identity engineer's default for background work that must not depend on a person: an OAuth client-credentials token, scoped to the undo skills and bound to Northgate as its audience. C is that credential, narrowed further to one claim, one task and no onward hop, plus a rule on the partner's side. The degenerate form is the one to avoid: one Claims service token, valid for every skill at every partner. It would send the undo, and every other call Claims can make, and a partner that received it could pass it on. That is the setting for Norm Hardy's confused deputy from 1988, a program holding broad authority of its own that can be steered into using it for someone else. Part 1 of this series counted authority among the five properties a seam has to build, and a token like this one gives it away.

Revocation work for agents has reached the edge of this problem without crossing it. Ruslan Vrublevskyi's 2026 "Authority Cut" design walks an action graph when a human revokes an approval, and calls each executed, reversible action's compensation (AWS Builder Center). It runs inside one control plane and does not say which credential the compensation is sent under. A2A leaves the question to each server: its authorisation section says the server decides "based on the authenticated identity and its own policies", and that the logic "is implementation-specific". Whatever the answer is, the caller has to build it.

Option E comes from the partner side, and it is common in booking APIs: Northgate returns an undo token with the booking, a cancellation reference that cancels it when presented. If the token is a bearer credential, whoever holds it can undo the booking, so Claims now stores a live credential for every booking in its ledger, and anyone who copies the ledger can cancel bookings. If Northgate binds the token to the workload that made the booking, it has rebuilt the sender rule below. Claims still has to present the token under some authority of its own, and if that authority is the adjuster's chain, the undo is stranded again. A partner-issued token helps name the task, and the call that presents it still needs live authority.

Identity engineers will recognise the general shape. Background work that outlives a user's session often runs on a refresh token (the OpenID Connect offline_access scope), which is option B with a longer fuse: it still carries the person, so suspending the person ends it, which is what a suspension is for. OAuth token exchange (RFC 8693) can produce either kind of token, one that acts for the person, which is B again, or one whose subject is a service, which belongs to C's family. What a saga across owners adds is a requirement on both sides: an undo authority that does not depend on the person, and a partner rule that accepts the undo only from the workload that sent the step.

A compensation link carries the least authority that can still send one undo. It is minted from a compensation root, which the issuer holds for Claims itself and for one claim; the root grants the undo skills, and the link narrows them to one skill and one task. Its subject is the service:compensator workload, so suspending the adjuster does not take it with her. It is minted for one claim. It grants the compensating skill and the two fields that skill reads, and nothing else. The link Claims hands to Northgate spends the root's only hop, so Northgate cannot pass it on. And it names the one task it may undo.

Meridian's delegation Grant gains one field for that last part, the task ids a request under it may name:

python
# Grant, mint, KEYS, run_values, issuer: companion modules at the ch13 tagundo = Grant(skills=frozenset({"cancel_booking"}),             fields=frozenset({"claim_id", "task"}),             hops=0,             tasks=frozenset({booking_task_id}))   # this booking, no otherwith as_run(thread(claim_thread)), run_values(compensating="CLM-1002",                                              undoes=booking_task_id):    root = issuer.compensation_chain()   # subject service:compensator, 1 hoplink = mint(   # spends the root's only hop: Northgate cannot pass it on    root, KEYS["claims"], "claims", "northgate", undo, frozenset({"CLM-1002"}))

Narrowing is checked at both ends. Any link derived from a task-narrowed link may name only tasks its parent already names. At Northgate, the guard rejects a compensation that names a different task: in the companion's test, a compensation naming some-other-task gets back "task some-other-task not granted". The adjuster's own revoked chain gets one thing and no more, because the book's revocation chapter, which this series does not cover, leaves a revoked chain exactly one call: a cancel of a task bound to that person. Asking it for a cancel_booking link fails at mint time with "widens the skills".

What stops any code at Claims from asking the issuer for a compensation root? In the companion, compensation_chain() mints only inside a run marked as compensating that claim, and the graph marks a run that way only after a decision reverses the claim. The issuer itself does not re-check the referral. That check lives in Claims' own graph and Claims' own audit log, which is where a decision about Claims' step belongs, and I treat it as an accepted risk in the companion. A production issuer should go one step further and bind the id of the reversing decision into the root, so every undo names the decision that caused it. A wrong call can do only what the root's shape allows: one claim, the two undo skills, one hop, and at Northgate only a task Claims itself sent.

Below, the same cancel_booking runs in three lanes: the adjuster's own authority (options A and B), the degenerate broad token from option D, and the compensation link. The middle lane is by construction; I did not run it.

d2
grid-columns: 1
grid-gap: 16
a: "Under the adjuster's chain, the next morning" {
  label.near: top-left
  grid-rows: 1
  grid-gap: 14
  style: {fill: "#F4F6F7"; stroke: "#95A5A6"; font-color: "#2C2C2A"}
  x: "expired after 15 min,\nor revoked with her" {style: {fill: "#95A5A6"; stroke: "#6C7A7B"; font-color: "#2C2C2A"}}
  y: "refused: the undo is stranded" {style: {fill: "#E74C3C"; stroke: "#B03A2E"; font-color: "#FFFFFF"}}
}
b: "Under a broad Claims service token" {
  label.near: top-left
  grid-rows: 1
  grid-gap: 14
  style: {fill: "#F4F6F7"; stroke: "#95A5A6"; font-color: "#2C2C2A"}
  x: "any skill, any claim,\ncan be passed on" {style: {fill: "#FFA07A"; stroke: "#D9785A"; font-color: "#2C2C2A"}}
  y: "accepted, and so is everything else" {style: {fill: "#E74C3C"; stroke: "#B03A2E"; font-color: "#FFFFFF"}}
}
c: "Under a compensation link" {
  label.near: top-left
  grid-rows: 1
  grid-gap: 14
  style: {fill: "#F4F6F7"; stroke: "#95A5A6"; font-color: "#2C2C2A"}
  x: "service:compensator, CLM-1002,\ncancel_booking, one task, 0 hops" {style: {fill: "#FFD93D"; stroke: "#C9A800"; font-color: "#2C2C2A"}}
  y: "accepted, only from the\nworkload that sent the booking" {style: {fill: "#6BCF7F"; stroke: "#3F9E52"; font-color: "#2C2C2A"}}
}

Read the right-hand column from top to bottom. By the time of the undo, the narrow authority that took the step is dead. A broad authority would still work, but it is too broad to give anyone. The compensation link is in between: alive whenever the undo is needed, and useless beyond the one task it names.

With the adjuster suspended an hour after the booking, the companion's run aborted the payment and compensated the booking under the link:

text
payments          DelegationRevoked (the adjuster's chain)guard log         cancel_booking from service:compensator: acceptedbooking           cancelled, owed 0ledger authority  booking: chain:785dce...   undo: chain:b3b6b0...

Each ledger entry keeps its own authority. The booking's entry still records the adjuster's chain, because she took that step, and the compensation's entry records the compensation root. When a finding goes to people later, it says both: who took the step, and under what the undo was sent.

Orchestration vs choreography for cross-company sagas: who may send the undo

A compensation link settles who may send an undo from Claims' side. On the partner's side there is a matching rule, and that rule decides between orchestration and choreography.

A long-standing view of work that spans companies is that nobody can be in charge. In its choreography language for web services, the W3C gives the reason: "In real-world scenarios, corporate entities are often unwilling to delegate control of their business processes to their integration partners" (W3C WS-CDL 1.0). So each party reacts to the others' events, and no party runs the whole sequence. Saga guides frame the choice on different grounds. Microsoft's pattern page weighs choreography's simplicity and lack of a single point of failure against orchestration's central control (Azure Architecture Center). Neither mentions authority.

To be fair to it, choreographed compensation does not have to mean Risk ordering Northgate about. In textbook choreography Northgate subscribes to an event, say "claim referred", and cancels its own booking when the event arrives. Each participant undoes its own local step.

Look at what that subscription gives away. Whoever can publish "claim referred" in a form Northgate accepts can now undo the booking. Claims took the step, but Risk, or any other subscriber that can publish the event, can undo it. And Claims learns about it, if at all, from its own next read.

I ran a version of that design, and its setup matters. Under the chain Claims really gives Risk, which grants screen_fraud and estimate_history, Risk cannot mint a cancel_booking link at all: the companion refuses it with "widens the skills". So to give Risk the power to ask, I had Claims mint Risk a link from a wider compensation root with one extra hop, and I patched Northgate's guard so it accepts a cancel_booking from any authenticated caller whose chain grants the skill. Risk sends a direct request here, standing in for an event subscription. What the run shows is the partner side: a partner that accepts an undo from any authenticated sender. Then Risk, which had just re-scored the claim at 82 and could reasonably decide the booking should go, sent one:

text
Risk -> Northgate cancel_booking    HTTP 200, booking cancelled, owed 0Claims ledger, repair_booking       completed   (no undo entry)Claims' compensator, later          "compensated"   (Northgate's repeat answer)cancel_booking tasks at Northgate   2

Northgate cancelled the booking, and Claims' ledger still said the booking stood. When Claims' own compensator ran later, its cancel_booking was a new task under a key of its own. Northgate found the booking already cancelled and answered with the existing result, so Claims recorded a compensation it had not performed. Two cancel_booking tasks now exist for one booking, and Claims' record credits Claims with an undo that Risk did. Nothing in the run failed, and the audit trail is wrong. It is a cousin of what Part 4 called a clean-ledger duplicate. There, one key opened two tasks and Claims' ledger named one; here two senders opened two tasks under different keys. What they share is a caller record that agrees with the partner's answer and is still wrong about what happened.

With the rule switched back on, the same request from Risk is refused at Northgate's guard with task <booking task id> was not sent by risk for CLM-1002. The rule is short:

python
# peer: the authenticated caller; claim: the claim the request names# safe only because every compensating skill requires `task`; else key it on the skillif undoes := str(data.get("task", "")):  # only its sender undoes it    _, bound = self.tasks.get(undoes, ("", ""))    if self.holders.get(undoes) != peer or bound != claim:        raise DelegationRefused(self.me, f"task {undoes} was not sent by {peer} "                                         f"for {claim}")

Side by side, the two designs differ in who asks Northgate.

d2
grid-columns: 1
grid-gap: 24
chor: "Choreographed: Northgate undoes on any accepted signal" {
  label.near: top-center
  grid-columns: 1
  grid-gap: 14
  style: {fill: "#FDEDEC"; stroke: "#B03A2E"; font-color: "#2C2C2A"}
  r: "Risk re-scores at 82\nsends cancel_booking itself" {style: {fill: "#FFA07A"; stroke: "#D9785A"; font-color: "#2C2C2A"}}
  n: "Northgate cancels\nClaims' booking" {style: {fill: "#E74C3C"; stroke: "#B03A2E"; font-color: "#FFFFFF"}}
  c: "Claims' ledger: booking stands\nlater records an undo it did not do" {style: {fill: "#95A5A6"; stroke: "#6C7A7B"; font-color: "#2C2C2A"}}
}
orch: "Orchestrated: the owner that took the step asks" {
  label.near: top-center
  grid-columns: 1
  grid-gap: 14
  style: {fill: "#EAF7EE"; stroke: "#3F9E52"; font-color: "#2C2C2A"}
  r: "Risk's news reaches Claims\nas a prompt to look, not an order" {style: {fill: "#FFA07A"; stroke: "#D9785A"; font-color: "#2C2C2A"}}
  n: "Claims re-screens, refers,\nsends cancel_booking under its link" {style: {fill: "#4A90E2"; stroke: "#2C6FB0"; font-color: "#FFFFFF"}}
  c: "Northgate accepts it only from\nthe sender of the booking" {style: {fill: "#6BCF7F"; stroke: "#3F9E52"; font-color: "#2C2C2A"}}
}

On the left, the power to undo Claims' booking belongs to whoever can produce the signal, and the record of the undo is wrong at the owner who took the step. On the right, Risk's news still matters. It reaches Claims as a prompt to look again, Claims decides, and the undo goes out under Claims' own authority. Companies will not hand control to a partner: that is the cross-organisational argument for choreography. Under choreography, Northgate lets a third party, here Risk, decide to undo a step Claims took. Risk is another team inside Meridian, not another company, and the argument holds at any owner line. A choreography that undoes on another party's signal gives away the very control that argument was protecting.

The strongest reply is a choreography that keeps the rule: Northgate cancels on "claim referred" only when Claims signs the event, and only for bookings Claims made. That design passes the sender check, and I accept it is safe in the sense that matters here. It is also no longer choreography in the sense the argument for choreography needs. Claims decides the undo, under Claims' authority, about Claims' step; only the transport is an event. And the event loses something the request keeps. A published event has no answer, so the residue, the refusal and the amount owed have nowhere to come back to, and Claims' ledger has no entry for the undo it triggered. Nor does the authority problem go away, because the signature on the event has to come from authority that is still alive the next morning, which is the compensation link again. What I am arguing against is narrower than every event-driven design: an owner's step undone on a signal the owner did not send.

This rule is not new in commerce, and its failure mode is well documented. When flights were cancelled in 2020, British Airways told customers who had booked through an online agent: "As standard industry practice, customers who have booked through a travel agent should contact them directly for help with their booking" (Which?, 2020-05-07). Which? also quotes Malaysia Airlines: "For travel agent bookings, all customers must refer to their travel agents to process their ticket changes". The airline would undo the booking, but only for the party that made it, and customers whose agents would not ask were stuck in between. Strictly that is not a stranded undo: the agents still had standing and chose not to use it. It is the same shape, though, an undo only one party may ask for and that party not asking, and the fix there, as here, is to make sure the party that took the step can still ask, and will.

Web services standards already put a coordinator in charge of compensation. In WS-BusinessActivity the Compensate message goes from the coordinator to a participant that has completed its work (OASIS WS-BusinessActivity 1.1). Participants register with their coordinator, so Compensate is already bound to the coordinator that registered the work. What I did not find in it is anything about authority that expires before the undo is sent, which is the point this part adds.

When a compensating transaction is refused or leaves a residue

An undo across owners is a request, so it can come back four ways. The partner can compensate fully. It can compensate with a residue, the part it could not undo. It can refuse. Or the answer can be lost on the way back. The companion's tests drive each case through cancel_booking, and the diagram follows each one to where it ends.

d2
direction: down
ask: "Claims sends cancel_booking under the compensation link" {
  style: {fill: "#4A90E2"; stroke: "#2C6FB0"; font-color: "#FFFFFF"}
}
answers: "What comes back" {
  label.near: top-center
  grid-rows: 1
  grid-gap: 12
  style: {fill: "#F4F6F7"; stroke: "#95A5A6"; font-color: "#2C2C2A"}
  ok: "compensated\nowed 0" {style: {fill: "#6BCF7F"; stroke: "#3F9E52"; font-color: "#2C2C2A"}}
  res: "compensated with a residue\nframe ordered, owed 6,500" {style: {fill: "#E74C3C"; stroke: "#B03A2E"; font-color: "#FFFFFF"}}
  ref: "refused\nrepair started, or past 72 h" {style: {fill: "#95A5A6"; stroke: "#6C7A7B"; font-color: "#2C2C2A"}}
  lost: "no answer\nthe reply was lost" {style: {fill: "#FFD93D"; stroke: "#C9A800"; font-color: "#2C2C2A"}}
}
people: "One finding to the named desk at each company:\nforward task, compensation task, forward chain, partner release, residue" {
  style: {fill: "#98D8C8"; stroke: "#5FA898"; font-color: "#2C2C2A"}
}
resend: "Resend under the same derived key\n(Part 4's rule), then reconciliation" {
  style: {fill: "#FFA07A"; stroke: "#D9785A"; font-color: "#2C2C2A"}
}
ask -> answers
answers -> people: "residue, refused"
answers -> resend: "no answer"

Mainstream advice treats a failed compensation as something to retry. Temporal's saga guide says "Design compensations with generous retry policies", and, for persistent failures, "alert for manual intervention" (Temporal). Restate advertises "Guaranteed compensation" (Restate). Inside one owner, where the compensation is your own code against your own database, that is right. Retries get you through transient failure, and the compensation eventually runs.

Across owners it is right for a lost answer and wrong for a refusal and a residue. A lost answer is Part 4's case. The partner may well have done the undo, and the safe move is to resend under the same key and let its key index return the first task. A refusal is the partner's answer, decided on the partner's state, and sending it again costs the partner a second task and returns the same answer. I ran both against the companion, once dropping the first answer to cancel_booking and once letting SHOP-7 start the repair before the re-screen:

text
lost answer   compensated   sends 2, keys 1, cancel_booking tasks run 1refusal       refused       sends 1, keys 1, cancel_booking tasks run 1              finding "refused": the repair of CLM-1002 has started at SHOP-7;              settled by Claims' adjuster with Northgate's network desk

The lost answer was resent once under the same derived key, and Northgate's key index returned the first task. For the refusal, Claims asked once and the case went straight to a person. A second refusal case in the companion, 73 hours after the booking, behaves the same way. A refusal decided on the partner's state gets zero retries. A refusal of the authority is different: a 403 for an expired link means Claims should mint a fresh compensation link once and resend under the same key, and the companion's compensation_chain() already re-mints a root near expiry.

A residue is the case no retry can help. SHOP-7 can cancel the booking, but the frame it already ordered stays ordered. In a separate run, with the frame already ordered when the re-screen landed, the companion's compensator returned:

text
repair_booking   residuefinding          residue: owed 6,500; frame ordered by SHOP-7 for CLM-1002;                 settled by Claims' adjuster with Northgate's network desk

The finding also carries both task ids, the booking's chain and Northgate's release, so the desks at both companies start from the same record. Microsoft's pattern page concedes the general point: "Compensating transactions might not always succeed, which can leave the system in an inconsistent state." Across owners, the inconsistency is expected, and the plan's last column says in advance which person at each company deals with it.

One case sends nothing at all. If Finance restores from a backup taken before the payment, it has no record of the payment task, and the compensator's fresh read of that task comes back as not found. The money may have left anyway. In the companion, the compensator files that as lost and sends no void. Not found is ambiguous, though. Northgate's guard answers a task the caller may not see with the same "Task not found" as a task that was never there, so a read under a mis-narrowed link looks exactly like a loss. So lost always goes to a person as a finding, because it is a case where money may have left, and the compensator first checks that the read went out under the link that names the task.

Saga compensation order and timing: shortest window first, starting at the decision

Claims' compensator walks the plan newest first, the order sagas have used since the 1987 paper. Across owners the order has a second reason, and it is really shortest window first: steps at independent partners have no data dependency between them, so if a booking's window were shorter than the payment's void, the booking would go first. Usually the newest step is the payment, which has the shortest undo window and moves money. On CLM-1002 the payment was still waiting for approval, so its undo was a plain cancel. Once a payment has completed, its undo is void_payment, and the 12-hour window applies. Either way, undo it first. Then, if Northgate refuses to cancel the booking, the people settling SHOP-7's costs do it with the 8,300 still inside Finance, not after it has gone to the payee.

This walk also closes the thread Part 4 left open. Part 4's reconciliation pass finds an orphan, a payment task that no ledger entry names, and sends the finding to a person. In the companion, the claim's own thread then adopts the orphan as an entry of its own and undoes it like any other step: the test's orphan was cancelled while it waited for its first approver, the claim's real payment was untouched, and the next reconciliation pass found nothing. Reconciliation never writes the ledger; the thread that owns the claim does.

For each step, the compensator reads the partner's task again before it decides. The step's thread link, Part 2's record of the partner's task, says which task to read, and the ledger's state is only the last thing Claims saw. An open task is cancelled and then read again, since cancel is attempted, not guaranteed. A task that completed in between goes back for compensation on the next pass. A completed task with a compensating skill gets an intent entry, checkpointed before the send, with a key derived from the forward key and the forward task. The checkpointed intent is Part 4's rule, applied to an undo.

The windows all count from the step's commit, so when the compensator starts is part of the design.

d2
direction: down
commit: "Payment completes: void_payment is honoured for 12 h" {
  style: {fill: "#FFA07A"; stroke: "#D9785A"; font-color: "#2C2C2A"}
}
choice: "When the reversal is handled" {
  label.near: top-center
  grid-rows: 1
  grid-gap: 20
  style: {fill: "#F4F6F7"; stroke: "#95A5A6"; font-color: "#2C2C2A"}
  now: "In the same run as the decision:\nthe void goes out within seconds" {style: {fill: "#6BCF7F"; stroke: "#3F9E52"; font-color: "#2C2C2A"}}
  batch: "In a nightly batch:\nthe 12 h window can close first" {style: {fill: "#E74C3C"; stroke: "#B03A2E"; font-color: "#FFFFFF"}}
}
result: "Void accepted, or refused as\n\"PAY-CLM-1002-8300 left in the payment run\"" {
  style: {fill: "#95A5A6"; stroke: "#6C7A7B"; font-color: "#2C2C2A"}
}
commit -> choice
choice -> result

Claims' compensator in the companion is a node in the claim's own thread. It starts as soon as the re-screen refers the claim, so only seconds of each window are used before the first undo goes out. A batch that collects reversals overnight can wait longer than the 12-hour void window, and every void it misses becomes a recovery from the payee. In the companion's test, a void sent before the payment run voided the 8,300 and the run found nothing to send. Sent twelve hours later, the same void came back refused with "PAY-CLM-1002-8300 left in the payment run". Measure one interval: from the decision that reverses a claim to the first undo request leaving Claims. The budget for that gap is what is left of each window when the decision is made, the window minus the time from the step's commit to the decision. On CLM-1002 the re-screen came about 16 hours after the booking, so 56 of Northgate's 72 hours were left, and a payment that had completed alongside the booking would have lost its 12-hour void about four hours before the decision.

Checklist: compensation across an A2A owner seam

Across owners the undo is a request, and it is sent long after the step it reverses. The work is mostly in two places: authority that is still alive when the undo is needed, and a partner rule that accepts the undo only from the owner that took the step. Without the first, every undo is stranded. Without the second, whoever can send a signal holds your undo. So across owners the saga is orchestrated by whoever took each step: that owner decides and sends the undo, under authority built for it, and partners refuse an undo from anyone else.

  • Every step that commits at another owner has a row in your saga plan: the partner's compensating skill, how long you may need it, and who settles a residue. A step with nothing to undo says so in the row.
  • Partners declare the undo and its window on their cards, and your connect-time check refuses the forward step when either is missing or too short. A shortened window is a dated breach.
  • A step and its undo are approved in the same change, never one without the other.
  • No undo is sent under the authority that took the step. Mint a compensation link per claim: a workload subject, one compensating skill, one task, zero hops.
  • Set each undo's need from the latest trigger that can reverse the step (an approval wait, a re-screen), and require the partner's window to exceed it by a stated margin. Where a late reversal is accepted as a residue instead, as Meridian's payment row does after the payment run, write that down in the row.
  • Test the undo with the person who took the step suspended. If it fails, any undo needed after that person's suspension is a stranded undo.
  • Each partner checks an undo's sender: it must be the workload that sent the original task, acting for that task's claim. If they accept undos from anyone, ask which other party can trigger them.
  • Treat the sending workload's identity as a long-lived term of the seam. Before you rename, split or move the Claims workload, register its successor with every partner, or keep the old identity, until the oldest open undo window has closed.
  • Other owners' news about your step reaches you as a prompt to look. You decide, and you send the undo.
  • A lost answer is resent under the same derived key, and an expired link is re-minted once and resent. A refusal decided on the partner's state and a residue go to the named desk at each company, never to a retry loop.
  • No undo is sent against a task the partner reports as not found, and every lost finding goes to a person.
  • Compensation starts in the same run as the reversing decision. Measure decision-to-first-undo and keep it well under what is left of each window at the decision (the window minus commit-to-decision time).

Testing a partner that refuses a compensation: Part 6 and the book

This part assumes the partner's compensating skill behaves as its terms say. A partner that answers late, answers in part, or refuses an undo it promised is tested in Part 6, against a stub partner you can run in CI. Who carries the cost of a residue, such as SHOP-7's frame or a payment that reached the payee first, is a commercial question the book takes up in a later chapter. So is the receipt a partner signs for a compensation, so that both companies can show an auditor the same record.

Going deeper: Chapter 13 of the book

This is Part 5 of the Federated AI Agents guide, a series that follows my book Federated AI Agents one chapter at a time. Chapter 13, "Compensation Across Owners: Sagas When You Can't Roll Back the Partner," is where this part comes from. This post adds the cancel-everything experiment, the three authorities measured at three reversal times, and the choreographed partner that cancels on Risk's word, and you can build the compensation link and the sender rule without the book. Code for the chapter is the ch13-compensation-across-owners tag of the companion repository. Its tests run with no network and no model key. I ran them at the book's pins, a2a-sdk 1.2.2 and langgraph 1.2.15, and again on a2a-sdk 1.3.1 and langgraph 1.2.24, and they pass on both.

Federated AI Agents: LangGraph and A2A for Agents You Don't Own, by Ranjan Kumar

References


Agentic AI

Follow for more technical deep dives on AI/ML systems, production engineering, and building real-world applications:


Books by Ranjan Kumar

Federated AI Agents cover

Federated AI Agents

Right-Sized AI cover

Right-Sized AI

Harness Engineering for Production AI Systems cover

Harness Engineering

The 7 GenAI Architectures cover

The 7 GenAI Architectures

Building Real-World Agentic AI Systems with LangGraph cover

Building Real-World Agentic AI Systems

The ChatML Handbook cover

The ChatML Handbook

The Chat Templates Handbook cover

The Chat Templates Handbook

Comments