This series grew into a book: Federated AI Agents. Chapter 3 covers this part. Where the chapter goes further is at the end of this article.
If a LangGraph node sends a task to an A2A agent and then calls interrupt(), the task is sent twice when the human answers, because LangGraph re-runs the node from its first line. The fix is to checkpoint the partner's contextId and taskId before anyone is asked anything.
Risk now holds two fraud-screening tasks for one claim, in two different contexts, and the claims team cannot say which one scored it. No exception was raised anywhere, and the wire worked perfectly.
Risk is the team that owns fraud screening at the insurer, and it runs its own agent behind its own server. That agent pauses any claim with an amount over 10,000 and asks for a police report. It asks the way an Agent2Agent (A2A) agent asks: the task comes back in input-required, with the question in its status message. On the claims side, the node that sent the screening task reads the question and calls interrupt(), as a LangGraph team does with any question for a human. An adjuster types PR-5521 the next morning.
The claims thread resumes, and the node sends Risk the screening task again, in a new context. One task now waits for an answer nobody is going to send. The other got the police report and scored the claim. Claims has a score in its state and no task id.
Meridian Mutual, the insurer, and its claim CLM-1002 are the fictional running example from my book. Nothing about the behaviour is fictional. A single test in the companion repository, test_the_incident_a_send_before_interrupt_sends_twice, reproduces it with the real A2A SDK by counting the tasks Risk received: two new ones, with two different contextId values.
Why LangGraph's interrupt() fixes do not fit an A2A send
LangGraph resumes an interrupted node by running it again from its first line. Its docs say so directly: "the runtime restarts the entire node from the beginning", and "it does not resume from the exact line where interrupt was called." So the send above the interrupt() runs a second time. This is documented, intended, and well written about: Raed Chammam reproduced it as "two tickets for the same issue", and LangGraph issue #6208 asks for the behaviour to change. I am not claiming the re-run as a finding.
My claim is about the fixes. LangGraph's interrupts page lists three: "Use idempotent operations before interrupt", "Place side effects after interrupt calls", and "Separate side effects into separate nodes when possible". A fourth comes from the Functional API page: wrap the side effect in a @task, because a resume "restores the result". Every one of them was written for a side effect you own, gated on an answer a human gives. An approval comes first, and then the refund.
At an A2A seam the order is reversed, and I call this case the inverted interrupt: the side effect does not wait for the human's answer, it produces the question the human is asked. What comes back from your send is the partner's question. You cannot move the send below the interrupt(), because without the send there is no question to interrupt on. Making the send idempotent is not yours to do either, since the A2A 1.0 specification says "Send Message operations MAY be idempotent. Agents may utilize the messageId to detect duplicate messages." That is a MAY, on the partner's side of an owner seam, where a team you do not manage decides whether it holds.
In the diagram, each documented fix sits next to what it assumes, and next to what is left of it when the side effect is a task in somebody else's runtime.
grid-rows: 5
grid-columns: 3
grid-gap: 12
classes: {
head: {style: {fill: "#95A5A6"; stroke: "#6E7B7C"; font-color: "#2C2C2A"; bold: true}}
fix: {style: {fill: "#4A90E2"; stroke: "#2C6FB0"; font-color: "#FFFFFF"}}
bad: {style: {fill: "#E74C3C"; stroke: "#B03A2E"; font-color: "#FFFFFF"}}
part: {style: {fill: "#FFD93D"; stroke: "#C9A400"; font-color: "#2C2C2A"}}
ok: {style: {fill: "#6BCF7F"; stroke: "#3F9E52"; font-color: "#2C2C2A"}}
}
h1: "Documented fix" {class: head}
h2: "What it assumes" {class: head}
h3: "At an A2A seam" {class: head}
f1: "Side effect after interrupt()" {class: fix}
a1: "The human answers first,\nthen the effect runs" {class: fix}
s1: "Impossible: the send\nproduces the question" {class: bad}
f2: "Make it idempotent" {class: fix}
a2: "You control the\nsystem that dedupes" {class: fix}
s2: "The partner's MAY:\nnot yours to promise" {class: bad}
f3: "Wrap it in @task" {class: fix}
a3: "The runtime may keep\nthe result for you" {class: fix}
s3: "Sends once; the record is\nhidden from graph state" {class: part}
f4: "Its own node or superstep" {class: fix}
a4: "The next node can find\nwhat the first one did" {class: fix}
s4: "Works, if the partner's\nids cross in state" {class: ok}
Two rows are dead, and the two that still work have something in common: both keep a record of the send. @task keeps it in the runtime's pending writes, and the separate-superstep fix keeps it in graph state. So this is the claim this article argues: under an inverted interrupt, every fix that works is a record of the partner's task. What separates the fixes is where the record lives, who can read it, and whether it is written before or after the send. Kept in graph state, under the seam's name, the record is what I call the thread link (a link between your thread and the partner's task, not a LangSmith trace thread). It is the partner-minted contextId and taskId, checkpointed in its own superstep before anyone is asked anything. Every later entry reads the linked task.
The obvious objection is that idempotency is also a record, so the claim is true by definition. It is a record, but it is one the partner keeps, on the partner's side of the seam, if the partner keeps it at all. The thread link is the record on your side, and a caller-side record is the only one you can rely on without the partner's cooperation. A2A does let you ask: ListTasks filters a partner's tasks by contextId, and a later chapter of my book uses that lookup to recover a task the caller lost. It still needs an id you kept, and a partner that serves the method. Deduplication by messageId would not have saved the incident either, because the SDK's message helper mints a fresh messageId for every send, so the re-run looks like a new message. Part 4 comes back to that. This is Part 1's ownership gate applied to a single call.
From that follows the second half of the claim. Once the node is reading a task, it has to decide what each of the task's states means for the graph, and only completed is an answer.
What the LangGraph checkpointer stops seeing at an A2A seam
Inside one deployment, LangGraph's checkpointer sees every write, which is the state property from Part 1's five seam properties. Across a seam it sees only what your node writes. Your partner's graph, if it even runs LangGraph, has its own checkpointer, and the A2A specification makes that a design principle it calls "Opaque Execution": agents collaborate "without needing to share their internal thoughts, plans, or tool implementations." Across a real owner line that opacity is a feature. It also means that most of the LangGraph runtime model arrives on the other side with something missing.
My book calls this the A2A-LangGraph mapping. It pairs each runtime concept with the protocol concept that carries it, and marks each pair exact, lossy or absent. Here are the rows this article depends on:
| In one LangGraph deployment | Across an A2A seam | Fidelity |
|---|---|---|
thread_id | contextId, minted by the partner | lossy |
| One run of the graph | One task | exact |
interrupt() | Task state input-required | lossy |
Command(resume=...) | A message on the same taskId | exact |
| An exception | A failed or rejected task | lossy |
| The checkpoint | nothing | absent |
The fidelity column grades identity and the shape of the call, not payloads. The run row is exact in one direction only: one run of yours is one task, but one partner task can span several of the partner's own runs, one per resume. The resume row, likewise, is exact only about the call, and it says nothing about the payload. Every A2A partner resumes with a follow-up message on the same taskId, but what goes inside it is the partner's choice. One LangGraph-served partner expects the answer under a resume key, as the limits section below shows. That is a contract question, and the next parts of this guide treat the agent card as that contract.
Below, the same table is drawn with fidelity as colour, so you can see where the problem rows sit.
grid-rows: 6
grid-columns: 3
grid-gap: 10
classes: {
lg: {style: {fill: "#4A90E2"; stroke: "#2C6FB0"; font-color: "#FFFFFF"}}
exact: {style: {fill: "#6BCF7F"; stroke: "#3F9E52"; font-color: "#2C2C2A"}}
lossy: {style: {fill: "#FFD93D"; stroke: "#C9A400"; font-color: "#2C2C2A"}}
absent: {style: {fill: "#E74C3C"; stroke: "#B03A2E"; font-color: "#FFFFFF"}}
}
r1: "thread_id" {class: lg}
t1: "contextId (partner mints it)" {class: lossy}
v1: "lossy: two owners, two ids" {class: lossy}
r2: "one graph run" {class: lg}
t2: "one task" {class: exact}
v2: "exact" {class: exact}
r3: "interrupt()" {class: lg}
t3: "input-required" {class: lossy}
v3: "lossy: who answers?" {class: lossy}
r4: "Command(resume=...)" {class: lg}
t4: "message on same taskId" {class: exact}
v4: "exact" {class: exact}
r5: "exception" {class: lg}
t5: "failed / rejected task" {class: lossy}
v5: "lossy: no stack trace" {class: lossy}
r6: "checkpoint" {class: lg}
t6: "nothing" {class: absent}
v6: "absent: you cannot read it" {class: absent}
It is the interrupt() row that misleads, because the shapes match. A paused task carries a question and resumes with an answer, so it feels exact. It is yellow because the person who answers may not be yours. What caused the incident is the first row and the last row together. You did not choose the id that would let you find the paused task again, and the progress behind it sits in a checkpoint you cannot read. If your node does not write that id down, nothing in your graph state ever will.
The wrong way: an A2A send above interrupt() in one LangGraph node
Here is the node from the incident. It is short, and no single line of it is wrong:
async def fraud_screening(state: Mapping[str, Any]) -> dict[str, Any]: task = await _send(partner, {k: state[k] for k in RISK_FIELDS}) # re-runs if task.status.state == TaskState.TASK_STATE_INPUT_REQUIRED: reply = interrupt(question_of(task)) task = await _send(partner, reply, task.context_id, task.id) answer = get_data_parts(task.artifacts[0].parts)[0] return {"fraud_score": answer["fraud_score"], "completed": ["fraud_screening"]}I ran it against the companion's Risk server with the claim's police-report resume. Risk's own log of what it received, with the ids cut to eight characters:
{'resumed': False, 'task_id': 'b5c82410', 'context_id': '147b6388'}{'resumed': False, 'task_id': '752622f2', 'context_id': 'd33476fc'}{'resumed': True, 'task_id': '752622f2', 'context_id': 'd33476fc'}Look at the follow-up: it names the right taskId, but it is the taskId of the second task. On resume, the first _send runs again and gets a new task back, in a new context, and the variable task now points at it. The first task's id did reach the paused checkpoint, but only inside the interrupt payload, because question_of copies the task id into the question it hands to interrupt(). Nothing reads that payload, and the resume consumes it. LangGraph writes a node's state update when the node returns, and this node did not return before it paused, so graph state never held the id.
direction: down
classes: {
ours: {style: {fill: "#4A90E2"; stroke: "#2C6FB0"; font-color: "#FFFFFF"}}
theirs: {style: {fill: "#98D8C8"; stroke: "#5FA898"; font-color: "#2C2C2A"}}
bad: {style: {fill: "#E74C3C"; stroke: "#B03A2E"; font-color: "#FFFFFF"}}
}
e1: "1. Entry: send screening task" {class: ours}
t1: "Risk task A, context A\ninput-required" {class: theirs}
i1: "2. interrupt(): node never returns,\nso task A's id is never checkpointed" {class: ours}
e2: "3. Resume: node re-runs from line 1,\nsend runs again" {class: ours}
t2: "Risk task B, context B\ninput-required" {class: theirs}
f2: "4. Police report sent to task B\nB completes and scores" {class: ours}
lost: "Task A waits forever.\nClaims state: a score, no task id" {class: bad}
e1 -> t1
t1 -> i1
i1 -> e2: "adjuster answers"
e2 -> t2
t2 -> f2
t1 -> lost: "never answered" {style.stroke-dash: 4}
That dashed edge is the part that costs money in production. Risk is still holding task A, maybe with a human queue behind it, and nothing on the claims side points at it. When the next seam is a payment instead of a fraud score, the same shape is two payment tasks, and Finance cannot say which one paid.
This node is not a strawman. The published samples I found read the reply and ignore the task around it. LangChain's own Agent Server A2A docs carry a client sample that pulls text from the artifacts, falls back to status.message when there are none, and never checks status.state, so an input-required question comes back to the caller looking exactly like an answer. In langchain-samples/A2A-google-adk, the test client reads artifacts[0] with no state check, and its broad except Exception turns a paused task into a string that starts with "Exception:". Both are demonstrations rather than production code, and both are what people copy.
contextId is not your thread_id
Most LangGraph engineers reach first for an obvious fix: send their own thread_id as the contextId. Then a resume would land in the same context, and the ids would line up.
It does not work, and the reasons are in the specification and in LangGraph's own server. A2A's specification says "Clients SHOULD NOT provide a client-generated contextId to a server unless they understand how the server will process that contextId", and that "Task IDs are server-generated". Servers differ on what they do with one. In the Python SDK, RequestContext._check_or_generate_context_id accepts a client-supplied context unchecked, and generates one only when the message carries none. LangSmith's Agent Server, which serves a deployed LangGraph graph over A2A when its state has a messages key, takes the incoming contextId and uses it "directly as the LangGraph thread_id, so it must be a UUID". It rejects a value such as session-42 with error -32602, and it rejects "a taskId minted by another agent" with -32001. Whether it accepts a well-formed UUID it never issued is not documented, so a caller that relies on it is relying on behaviour nobody promised. Even where your id is accepted, a fixed id does nothing for the incident: the resumed node still calls _send without a taskId, so it still starts a second task. There is a plainer reason as well. Your thread_id is unique in your deployment, not in the partner's. Two callers that derive their thread ids the same way, from a claim number for example, would land in one partner context, and whatever the partner keys by context would be shared between strangers.
grid-rows: 1
grid-gap: 50
classes: {
ours: {style: {fill: "#4A90E2"; stroke: "#2C6FB0"; font-color: "#FFFFFF"}}
theirs: {style: {fill: "#98D8C8"; stroke: "#5FA898"; font-color: "#2C2C2A"}}
link: {style: {fill: "#FFD93D"; stroke: "#C9A400"; font-color: "#2C2C2A"}}
}
claims: "Claims (Meridian)" {
label.near: top-center
grid-columns: 1
grid-gap: 14
tid: "thread_id: clm-1002" {class: ours}
rec: "thread link: records\nRisk's contextId + taskId" {class: link}
}
risk: "Risk (another owner)" {
label.near: top-center
grid-columns: 1
grid-gap: 14
cid: "contextId: ac282a01... (minted by Risk)" {class: theirs}
tsk: "taskId: a6e0f43d... (minted by Risk)" {class: theirs}
}
No identifier is minted by both sides. The ids in the claims box are copies of the ones Risk minted, taken from the measured run below. Risk keys its own LangGraph thread by the context it minted, and the companion's test reads Risk's checkpoint at that id to prove it. Claims cannot make Risk's thread line up with its own. All it can do is keep the ids Risk handed back, which is the record this article is about.
LangChain's Agent Server docs give the opposite advice for one case: "Let the first agent mint the contextId, then pass that same value to every agent for the rest of the conversation." That is advice about grouping traces, and it is coherent when one owner runs every agent on one Agent Server deployment with one LangSmith workspace. Across owners it hands partner B an id that partner A minted, which is the client-chosen context the specification says not to send. Elsewhere, the same page tells you to "Echo back the one the server returned rather than minting your own identifier". To partner B, partner A's id is not one B returned.
Three places to keep the record: @task, a state marker, or the thread link
Once the fix is a record, there are three places to put it, and I tested the one I expected to lose. The @task, two-question and Store runs below are my own scripts against the companion's Risk server, not tests in the companion repository.
@task inside the node. LangGraph's Functional API docs allow tasks to be called from a Graph API node, and say a resume "restores the result". So I wrapped the first send in a @task and kept the interrupt() in the same node body. Because a task's output has to be JSON-serializable, this one returns a dict built from the protobuf Task:
@taskasync def first_send(fields: dict[str, Any]) -> dict[str, Any]: t = await _send(partner, fields) data = [get_data_parts(a.parts)[0] for a in t.artifacts] return {"context_id": t.context_id, "task_id": t.id, "state": TaskState.Name(t.status.state), "question": question_of(t), "answer": data[0] if data else {}}async def fraud_screening(state: Mapping[str, Any]) -> dict[str, Any]: sent = await first_send({k: state[k] for k in RISK_FIELDS}) answer = sent["answer"] if sent["state"] == "TASK_STATE_INPUT_REQUIRED": reply = interrupt(sent["question"]) t = await _send(partner, reply, sent["context_id"], sent["task_id"]) answer = get_data_parts(t.artifacts[0].parts)[0] return {"fraud_score": answer["fraud_score"], "completed": ["fraud_screening"]}This variant handles only the two states the run produces and skips the total state mapping on purpose; a working task with no artifact would fail it with a KeyError, and one carrying a partial artifact would be read as an answer. It works. On a2a-sdk 1.3.1 and langgraph 1.2.22, a clean claim completes on the first send and scores 40, while the suspect claim pauses, resumes, and scores 82. This is what the run printed for the suspect claim:
paused values keys: ['amount', 'claim_id', 'completed', 'damaged_parts', 'days_to_report', 'prior_claims']risk received, resumed flags: [False, True] distinct task ids: 1fraud_score: 82.0Risk received one new task and one resume on the same taskId. In the paused thread, the state values hold the claim's fields and no task id. The id appears in the paused checkpoint only inside the interrupt payload, which the resume consumes. That @task held up is no surprise: when an issue claimed it breaks under the API server's injected checkpointer, a maintainer closed it with "@task() is still durable." The send's own record exists, but it sits in the checkpoint's task writes, matched to the call by its position in the node. The variant could also return the ids in its final update, and after the claim completes its attribution would match the thread link's. The difference is what you can see and route on while the run is paused, and the trap the next experiment shows. Routing cannot branch on it, aget_state().values does not show it, and an operator would have to dig through the checkpointer's pending writes to find which of Risk's tasks made the decision, which is exactly the question the incident left without an answer.
A second experiment made the difference concrete. I gave Risk a second question: after the police report it asks for a witness statement. Then I ran three callers against it, and printed what Risk received on its one task each time:
@task on the first send only new task {amount, claim_id, days_to_report, prior_claims} resumed {'police_report': 'PR-5521'} resumed {'police_report': 'PR-5521'} <- replayed into the witness question Risk fails the task: wrong answer to witness question@task on every send new task {amount, claim_id, days_to_report, prior_claims} resumed {'police_report': 'PR-5521'} resumed {'witness_statement': 'WS-77'} fraud_score 82.0thread link (RemoteAgentNode) new task {amount, claim_id, days_to_report, prior_claims} resumed {'police_report': 'PR-5521'} resumed {'witness_statement': 'WS-77'} decision refer, fraud_score 82.0Here is the first of those runs as a sequence. Resume values are matched to interrupt() calls by their position in the node, so every re-run gets the police report back from the first one:
sequenceDiagram
participant N as Claims node (@task on first send)
participant R as Risk (A2A server)
N->>R: first_send (new task)
R-->>N: input-required: police report?
Note over N: interrupt 1 pauses
Note over N: resume PR-5521, node re-runs, first_send restored
N->>R: follow-up send: PR-5521
R-->>N: input-required: witness statement?
Note over N: interrupt 2 pauses
Note over N: resume WS-77, node re-runs, first_send restored
Note over N: interrupt 1 returns PR-5521 again
N->>R: follow-up send: PR-5521 (replayed)
R-->>N: failed: wrong answer to witness question
With @task on the first send only, the follow-up send for the police report sits in the same node body as the second interrupt(). On the second resume it runs again, and Risk gets the police report as the answer to its witness question. The adjuster's WS-77 never leaves the claims side. @task is safe only when every send in the node is a task, and nothing in the node tells you when you missed one. The thread link does not have this gap. Each question comes back to the node in a new superstep, and that entry starts by reading the task. That makes the thread link safe by construction against the replay, not only visible. A record kept inside the node pass is lost when the node re-runs, so it has to be returned in its own superstep. If every partner call sits under one owner inside a recorded deployment exception, a fully wrapped @task node is a reasonable choice. Across an owner line, keep the record in state, where you can put it in front of the partner's owner when the two of you have to agree on which task decided a claim.
A marker in state, written in the same node. A forum answer on LangGraph's re-run behaviour suggests this: "Persist idempotency in state: If you must stay in one node, write a marker to state ... and no-op on the second pass." It is the right instinct, and the closest prior art to the thread link I found. In the same node as the interrupt(), though, a marker in graph state never lands. A node's state update reaches the checkpoint only when the node returns; only a @task result, or a write to something outside graph state, persists in the middle of a node. Mutating the input state dict does nothing: I checked, and it leaves thread_links empty in the paused checkpoint while Risk receives two new tasks, exactly as in the incident.
The working one-node version of the marker is a write outside graph state. A store.put(...) to LangGraph's Store, or a row in your own table, made before interrupt(), survives the pause, and the re-run can find it and read instead of sending. I checked this one too: with the ids in an InMemoryStore, Risk received one new task and one resume, and the claim scored 82. It is still a record of the partner's task, so the thesis holds. I keep the record in graph state for this seam anyway: the router can branch on it, it is versioned with the thread's checkpoint and rolls back with it, and there is no second store to keep consistent with the first. An external record does have one advantage, which the limits section comes back to: it can be written before the send.
A thread link, written by a node that returns. Here the record goes in graph state, and the node that writes it returns before anybody is asked anything. Google's Agent Development Kit (ADK) keeps a similar caller-side record: its RemoteA2aAgent stamps the partner's a2a:task_id and a2a:context_id onto session events and resumes only when the last recorded state was input-required or auth-required. What LangGraph adds is the re-run, and that changes where the record can be written. Port ADK's pattern directly, recording the ids in the same node pass that pauses, and the record is lost with the pass: the resume sends again, exactly as in the incident.
grid-rows: 1
grid-gap: 30
classes: {
where: {style: {fill: "#7B68EE"; stroke: "#5A4BC4"; font-color: "#FFFFFF"}}
good: {style: {fill: "#6BCF7F"; stroke: "#3F9E52"; font-color: "#2C2C2A"}}
bad: {style: {fill: "#E74C3C"; stroke: "#B03A2E"; font-color: "#FFFFFF"}}
meh: {style: {fill: "#FFD93D"; stroke: "#C9A400"; font-color: "#2C2C2A"}}
}
task: "@task in the node" {
label.near: top-center
grid-columns: 1
grid-gap: 10
w: "lives in: pending writes,\nmatched by call position" {class: where}
s: "sends once: only if\nevery send is a task" {class: meh}
v: "in aget_state().values: no" {class: bad}
}
marker: "State marker, same node" {
label.near: top-center
grid-columns: 1
grid-gap: 10
w: "lives in: the node's\nunreturned update" {class: where}
s: "sends once: no\n(it is the incident)" {class: bad}
v: "in state: never lands" {class: bad}
}
tl: "Thread link" {
label.near: top-center
grid-columns: 1
grid-gap: 10
w: "lives in: graph state,\nunder the seam's name" {class: where}
s: "sends once: yes" {class: good}
v: "in state: yes, for routing\nand for audit" {class: good}
}
Read the bottom two rows across. Two of the three columns stop the duplicate task (the Store version above does too), and only the thread link leaves the id in graph state, where the graph and an operator can both read it.
The thread link: checkpoint the partner's ids, return, then ask
Here is the definition I use. A thread link is the caller's record, in its own graph state under one seam's name, of the partner-issued contextId and taskId for the work in flight on that seam. Every entry to the seam's node after the first reads the task the link names and starts no new one.
RemoteAgentNode, from the companion repository's Chapter 3 tag, is the node that keeps it:
async def __call__(self, state: Mapping[str, Any]) -> dict[str, Any]: links = dict(state.get("thread_links", {})) link = links.get(self.seam.name) if link is None: # first entry: one new task, in a context the partner mints task = await self._send({k: state[k] for k in self.seam.sends}) else: # re-entry: read the task already sent, never send a second one task = await self._get(link["task_id"]) if self._waits_for_us(task): reply = interrupt(question_of(task)) # Claims' own human answers task = await self._send(reply, link) # same task, same context links[self.seam.name] = {"context_id": task.context_id, "task_id": task.id} if self._waits_for_us(task): return {"thread_links": links} # checkpoint the link before interrupt() return {**self._outcome(task), "thread_links": links, "completed": [self.seam.name]}This node still sends, and it still calls interrupt(). What changed is the order across supersteps. On the first entry there is no link, so the node sends, sees input-required, and returns only the link, with no completed entry. That return is what puts the ids in the checkpoint. Because the seam is not yet in completed, the graph's router sends control back to the same node. On that second entry the link exists, so the node reads the task and pauses on the question it finds there. When the adjuster answers, the node runs from its first line again, as LangGraph always does. This time the first line finds the link, and the re-run is a read.
Below is the measured run of CLM-1002 through that node. Every arrow that crosses to Risk is a crossing record in the companion's log.
sequenceDiagram
participant G as Claims graph
participant N as RemoteAgentNode
participant R as Risk (A2A server)
G->>N: entry 1, no link
N->>R: send (new task)
R-->>N: input-required, contextId + taskId
N-->>G: return thread_links only (checkpointed)
G->>N: entry 2, link present
N->>R: get task
R-->>N: input-required + question
N-->>G: interrupt(question)
Note over G: adjuster answers PR-5521
G->>N: resume: node re-runs from line 1
N->>R: get task again
R-->>N: input-required
N->>R: send answer on same taskId
R-->>N: completed, fraud_score 82
N-->>G: fraud_score, thread_links, completed
Count the arrows to Risk: a send, two reads and a follow-up send. Four crossings, one task. Of the two reads, the second is the re-run, and it costs one round trip. Here is what the same run printed, with ids cut to eight characters:
paused thread_links.fraud_screening: {'context_id': 'ac282a01', 'task_id': 'a6e0f43d'}risk received: {'resumed': False, 'task_id': 'a6e0f43d', 'context_id': 'ac282a01'}risk received: {'resumed': True, 'task_id': 'a6e0f43d', 'context_id': 'ac282a01'}crossings: send INPUT_REQUIRED, get INPUT_REQUIRED, get INPUT_REQUIRED, send COMPLETEDdecision: refer fraud_score: 82.0Compare it with the incident's log. One taskId appears in all three places: the paused claims state, Risk's new task, and Risk's resume. CLM-1002 was referred, and this time the claims side can say which task referred it.
The excerpt leans on code defined elsewhere. get_data_parts comes from the A2A SDK's a2a.helpers. The incident node's module-level _send(partner, ...), partner and RISK_FIELDS are in the companion's meridian/incident.py. RemoteAgentNode's own methods _send, _get, _outcome and _waits_for_us, and the shared question_of, are in seamkit/remote.py, and the router that sends control back to a seam missing from completed is build_graph in meridian/inprocess.py. The incident node hard-codes its fields, RISK_FIELDS going out and fraud_score coming back. RemoteAgentNode declares both per seam instead, in SeamSpec.sends and an explicit field map, so a partner that returns an extra key called decision cannot write your graph's decision on any seam. One gap remains on the way out. The first send carries only sends, but the answer to a partner's question goes out as given: self._send(reply, link) forwards whatever the adjuster's resume carried. Check the reply's keys against what the question asked for before it crosses. Part 3 turns these lists into a contract.
Only completed is an answer: map every A2A task state
A node that reads a task has to decide what every state of that task means for the graph. Nine TaskState values are defined in the A2A 1.0 protocol buffer (proto): submitted, working, input-required, auth-required, completed, failed, canceled, rejected, and the zero value TASK_STATE_UNSPECIFIED, which the proto describes as "an unknown or indeterminate state". A caller that handles completed and input-required and lets the rest fall through has rebuilt a silent default: an unmapped state becomes whatever the next line of code assumes.
So the mapping is a table, and the table is total:
OUTCOMES: dict[int, type[SeamError] | None] = { TaskState.TASK_STATE_COMPLETED: None, TaskState.TASK_STATE_SUBMITTED: TaskUnfinished, TaskState.TASK_STATE_WORKING: TaskUnfinished, TaskState.TASK_STATE_INPUT_REQUIRED: PartnerNeedsInput, TaskState.TASK_STATE_AUTH_REQUIRED: PartnerNeedsAuth, TaskState.TASK_STATE_FAILED: PartnerFailed, TaskState.TASK_STATE_CANCELED: PartnerFailed, TaskState.TASK_STATE_REJECTED: PartnerRejected, TaskState.TASK_STATE_UNSPECIFIED: MalformedAnswer,}def test_every_state_the_spec_defines_has_exactly_one_outcome() -> None: # A state a later SDK adds fails this test instead of falling through. assert set(OUTCOMES) == set(TaskState.values())None means "read the artifact", and only completed has it. Every other state raises a typed SeamError that carries the seam's name and the partner's task id. Its assertion is one line, and it is the most useful line in the file: when an SDK release adds a state, the build fails on the day you upgrade instead of on the day a partner first returns the new state. It protects your own upgrade, not a partner who moves to a newer proto first. The companion's _outcome indexes the table directly, so a state number your SDK does not know raises a bare KeyError. Look it up with OUTCOMES.get(state, MalformedAnswer) and an unknown state becomes a typed error like the rest.
direction: down
classes: {
st: {style: {fill: "#98D8C8"; stroke: "#5FA898"; font-color: "#2C2C2A"}}
ok: {style: {fill: "#6BCF7F"; stroke: "#3F9E52"; font-color: "#2C2C2A"}}
stop: {style: {fill: "#95A5A6"; stroke: "#6E7B7C"; font-color: "#2C2C2A"}}
err: {style: {fill: "#E74C3C"; stroke: "#B03A2E"; font-color: "#FFFFFF"}}
}
c: "Partner task:\ncompleted" {class: st}
ir: "Partner task:\ninput-required" {class: st}
other: "Partner task: submitted, working,\nauth-required, failed, canceled,\nrejected, unspecified" {class: st}
upd: "State update\n(through the field map)" {class: ok}
intr: "Claims interrupt()\n(seam asks the caller)" {class: stop}
err: "Typed SeamError:\nthe run stops" {class: err}
c -> upd
ir -> intr: "asks caller"
ir -> err: "does not ask"
other -> err
Every state has one outcome except input-required, which has two, depending on whether the seam's spec says the caller answers. Even completed is not a guaranteed answer: in the companion, an artifact missing a field the field map names raises MalformedAnswer. Risk's police-report question goes to a Claims adjuster. Northgate, the repair-estimate partner at another company, asks for a photo of frame damage, and no Claims human was ever going to photograph a car, so that seam raises PartnerNeedsInput and the run stops.
If I had to defend one row hardest, it would be working. A2A 1.0 says a blocking send "MUST wait until the task reaches a terminal ... or interrupted ... state before returning", so a conformant blocking send should never hand you a working task. You will see one anyway. A non-blocking send returns early by design: Agent Server documents returnImmediately as returning "a task in TASK_STATE_SUBMITTED or TASK_STATE_WORKING, with no artifacts". On re-entry, a read can catch a task mid-run, and so can a stream. Adapters also get the states wrong: an issue opened on hybroai/a2a-adapter on 2026-11-18 reports a LangGraph graph paused in interrupt() being reported over A2A as COMPLETED (fixed the next day). A node that reads the latest artifact of a working task writes a partial answer into state. In the companion, test_working_is_never_read_as_an_answer gives a working task a perfectly plausible fraud_score of 12 and asserts that the node raises.
Limits: when the A2A task id never reaches the LangGraph checkpoint
A thread link fixes the resume. It does not fix everything that can happen between your send and your node's return.
A link only lands when the node returns. On the first entry, links is built in memory and returned on two paths only: the task waits for the caller, or it completed. Every other state goes to _outcome, which raises. A working task, an auth-required task, a question on a seam that does not ask the caller, and every failure all raise before the return, so LangGraph writes no update and the link never reaches the checkpoint. Its ids survive in the crossing record the node logged and in the SeamError it raised, but not in state. A crash between the partner receiving the send and the node returning loses them the same way.
How safe the link-only step is also depends on LangGraph's durability mode. With durability="sync", a step's changes are persisted before the next step starts, so the link is on disk before the second entry asks anybody anything. With "async" they are persisted while the next step executes, and with "exit" only when the graph exits, so a process that dies in that window can lose a step that already returned. Run a graph with seams under "sync".
grid-rows: 2
grid-columns: 2
grid-gap: 16
classes: {
ok: {style: {fill: "#6BCF7F"; stroke: "#3F9E52"; font-color: "#2C2C2A"}}
bad: {style: {fill: "#E74C3C"; stroke: "#B03A2E"; font-color: "#FFFFFF"}}
}
a: "input-required, seam asks caller:\nnode returns, link checkpointed" {class: ok}
b: "completed:\nnode returns, link checkpointed" {class: ok}
c: "first entry, any other state:\nworking, auth-required, failure,\na question not for the caller:\nnode raises, link lost" {class: bad}
d: "crash after the partner got the send:\nlink lost, task exists" {class: bad}
Every path this article's incident takes is in the green row. In the red row, the record has to be written before the send rather than after it. That is the same rule my checkpointers article in the LangGraph guide argues for spend records: anything that must survive a replay has to be recorded outside the step that can be rolled back. My book replaces the thread link with a task ledger that checkpoints the intent before the send. Retries that may have done the work twice belong to Part 4, which is where idempotency keys come in, and where it matters whether the partner honours one.
A LangGraph partner speaks a slightly different dialect. Agent Server puts an interrupted graph's question in "an artifact named Interrupt", and it expects the answer "in a DataPart under a resume key". In the companion, question_of() reads the task's status message, and it sends the adjuster's reply as a plain data part. Against a partner served by Agent Server, RemoteAgentNode as printed would not find the question and would not resume the graph. None of that removes the need for the thread link, because the caller still has to record both ids. Parsing the question belongs in a per-partner adapter, which is one more reason the agent card has to be treated as a contract.
Record both ids, not just the task. Under the specification, a client can continue a task with the taskId alone, and agents are required to "infer contextId from the task if only taskId is provided". That inference was only fixed in a2a-sdk 1.3.1, released 2026-11-17; issue #1411 reports the taskId-only path still failing in 1.3.0. A link that keeps both ids does not depend on which SDK your partner runs.
A retried resume can answer the wrong question. Suppose the follow-up send reaches Risk but the reply is lost, the node raises PartnerUnavailable, and the run retries that step. The node reads the task first. If Risk has finished, or failed, or is still working, the retry returns the answer or raises a typed error, and nothing is sent twice. The dangerous case is a second question. LangGraph keeps the adjuster's resume value with the interrupted step, so when the retried node reaches interrupt() again, it gets the old answer back instead of pausing. The node would then send PR-5521 to Risk's new question. I have not measured this path. Until you have, treat a retry after a failed follow-up as a human decision, not an automatic one.
Node or tool: who decides the A2A call happens
RemoteAgentNode is one of two shapes a partner skill can take inside a LangGraph runtime. A partner skill can also become a tool, built from the skill on the partner's agent card, that a model may decide to call. My book calls this second shape a remote skill tool. What separates them is who decides that the call happens, and who answers for it afterwards.
grid-rows: 4
grid-columns: 3
grid-gap: 10
classes: {
head: {style: {fill: "#95A5A6"; stroke: "#6E7B7C"; font-color: "#2C2C2A"; bold: true}}
node: {style: {fill: "#4A90E2"; stroke: "#2C6FB0"; font-color: "#FFFFFF"}}
tool: {style: {fill: "#FFA07A"; stroke: "#D9785A"; font-color: "#2C2C2A"}}
}
h0: "" {style: {opacity: 0}}
h1: "Node (RemoteAgentNode)" {class: head}
h2: "Remote skill tool" {class: head}
q1: "Who decides the call?" {class: head}
n1: "the graph's router" {class: node}
t1: "a model" {class: tool}
q2: "Thread link?" {class: head}
n2: "yes, in state" {class: node}
t2: "no: one task per call" {class: tool}
q3: "Who answers for it?" {class: head}
n3: "the team that owns the graph" {class: node}
t3: "whoever owns the model's decision" {class: tool}
A tool call has no node of its own in your graph and no seam field in its state, so by default it keeps no thread link. An inverted interrupt inside a tool call also has the incident's shape one level down: a tool that sends and then calls interrupt() runs again when the tool node re-runs on resume, and sends again. In the companion, the remote skill tool raises into its caller when the partner answers with input-required. That is the companion's design choice, not protocol behaviour, and it is the one that keeps a question from pausing a model's turn. My default is a node. In the Meridian example, every claim is routed to fraud screening, then the estimate, then payment, and the claims team is accountable for every one of those calls. Only one Meridian seam suits the tool shape: Risk's optional lookup of Northgate's repair history, where a model's judgement about whether to call is the point.
Summary: calling a remote A2A agent before interrupt() in LangGraph
Call an agent somebody else owns from a LangGraph node, and the partner may answer with a question your human has to answer. That is an inverted interrupt: your side effect produces the question the human is asked. Under that inversion LangGraph's documented fixes split cleanly. Moving the send below interrupt() is impossible, and idempotency is the partner's MAY. Those that still work are records of the partner's task, and they differ in where the record lives, who can read it, and whether it is written before or after the send. @task keeps it where aget_state().values cannot show it and protects only the sends you remembered to wrap. A marker in graph state written in the same node never lands, and one in the Store works but lives outside the thread. The thread link puts the partner's contextId and taskId in graph state before anyone is asked anything. Keep the record where your graph and your operators can read it. Do not hand a partner your thread id, or another partner's context, as its contextId; record the ids each partner gives you. And because a node that reads a task has to interpret its state, map every state, and treat only completed as an answer.
Checklist: an A2A call inside a LangGraph node
- No node can both send to a partner and reach
interrupt()in one pass without returning in between. - To find such nodes, look for any node body where a remote call, or any other side effect, and an
interrupt()can both run. - Graph state holds the partner's
contextIdandtaskIdunder the seam's name, written by a node that returns before anyone is asked anything. - Every entry after the first reads the linked task, including the re-run LangGraph does on resume.
- A graph with seams runs with
durability="sync", so the link-only step is persisted before anyone is asked. - Your own
thread_idis not sent as the partner'scontextIdunless the partner's contract says how it processes one. You record the ids the partner returns. - Task states map through a table, with a test asserting its keys equal the SDK's
TaskStatevalues. Onlycompletedreaches the field map. -
workingraises. So doesinput-requiredon any seam whose spec does not name a human on your side to answer. - Each seam's node sends only the fields its seam names on the first send, checks every answer's keys against the question it answers, and writes back only the fields its field map names.
- An automatic retry after a failed follow-up send is untested until you test it. It can replay the stored answer into a new partner question, so route it to a person.
- If you chose
@taskinstead, you have decided who will need the partner's task id after the run, and how they will get it. - You know which of your partners run LangGraph's Agent Server, because their interrupt question and resume value use a different shape.
Going deeper: Chapter 3 of the book
This is Part 2 of a series that follows my book Federated AI Agents one chapter at a time. Chapter 3, "A2A as a LangGraph Runtime Sees It," is where this part comes from. This post adds the @task, Store and two-question experiments, and you can build the thread link without the book. Code for the chapter is the ch03-a2a-as-langgraph-sees-it 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.22, and they pass on both.
References
- LangChain. (2026). Interrupts. LangGraph Docs. https://docs.langchain.com/oss/python/langgraph/interrupts
- LangChain. (2026). Functional API overview. LangGraph Docs. https://docs.langchain.com/oss/python/langgraph/functional-api
- LangChain. (2026). A2A endpoint in Agent Server. LangSmith Docs. https://docs.langchain.com/langsmith/server-a2a
- A2A Project. (2026). Agent2Agent (A2A) Protocol Specification, v1.0.1. https://github.com/a2aproject/A2A/blob/v1.0.1/docs/specification.md Proto: https://github.com/a2aproject/A2A/blob/v1.0.1/specification/a2a.proto
- A2A Project. (2026). a2a-python v1.3.1 release notes. https://github.com/a2aproject/a2a-python/releases/tag/v1.3.1
- A2A Project. (2026). a2a-python:
RequestContextcontext id handling,src/a2a/server/agent_execution/context.py. https://github.com/a2aproject/a2a-python/blob/main/src/a2a/server/agent_execution/context.py - Chammam, R. (2026). LangGraph's HITL Has a Double Execution Problem. https://raed.dev/blog/posts/langgraph-hitl
- LangChain Forum. (2026). Pre-interrupt() code re-runs on resume: anti-pattern, or is there a sanctioned way to detect resume? https://forum.langchain.com/t/pre-interrupt-code-re-runs-on-resume-anti-pattern-or-is-there-a-sanctioned-way-to-detect-resume/3809
- LangGraph issue #6208 (opened 2025-09-26). Do not re-execute a node that interrupted unless all of its interrupts have been resumed. https://github.com/langchain-ai/langgraph/issues/6208
- LangGraph issue #6559 (closed 2026-02-06). @task checkpointing does not work with API server runtime-injected checkpointer. https://github.com/langchain-ai/langgraph/issues/6559
- a2a-python issue #1411 (opened 2026-11-01). [Bug]: taskId-only continuation still fails required contextId inference in SDK 1.3.0 (follow-up to #1206). https://github.com/a2aproject/a2a-python/issues/1411
- Google. (2026). adk-python:
RemoteA2aAgentsource. https://github.com/google/adk-python/blob/main/src/google/adk/a2a/agent/_remote_a2a_agent.py - langchain-samples. (2026). A2A-google-adk,
test_agent_conversation.py. https://github.com/langchain-samples/A2A-google-adk - hybroai/a2a-adapter issue #99 (opened 2026-11-18). Should LangGraphAdapter support resuming interrupted A2A tasks? https://github.com/hybroai/a2a-adapter/issues/99
- Kumar, R. (2026). Federated AI Agents. Chapter 3, "A2A as a LangGraph Runtime Sees It." https://federatedagents.ranjankumar.in/?utm_source=ranjankumar.in&utm_medium=blog&utm_campaign=federated-ai-agents&utm_content=federated-ai-agents-a2a-langgraph-node-interrupt-thread-link (book page on this site: /federated-ai-agents)
- Companion code: federated-langgraph-a2a-companion at ch03-a2a-as-langgraph-sees-it
Related Articles
- A2A, MCP, or Subgraph? 'Deployed Separately' Is the Wrong Reason
- A2A Agent Card Versioning: a Version Bump Is Not a Contract
- A2A Idempotency: Your Retry Key Lives in Partner Memory
- A2A Saga Compensation: Your Undo Outlives Its Authority







