Ranjan Kumar Agentic AI Series · Book 4 · First edition
Federated AI Agents: LangGraph and A2A, by Ranjan Kumar. The cover shows the Meridian claims federation: three teams on one company's plate and Northgate on its own, with three seams out of claims_intake.

verdict = federation_test(policy)

Federated AI Agents LangGraph and A2A

For Agents You Don’t Own: Build, Secure, and Operate the Seams Between Teams and Companies.

Every call that crosses from one owner to another is a seam.

A seam has five properties: contract, authority, state, failure, and accountability. Each one is free inside one deployment and has to be built at a seam.

Kindle UK · DE · FR · ES · IT · NL · JP · BR · CA · MX · AU · IN

Paperback UK · DE · FR · ES · IT · NL · PL · SE · BE · IE · JP · CA · AU

A companion repository builds the whole federation chapter by chapter in Python, and its test suite runs with no network and no accounts.

19Chapters
5Seam properties
4Owners
20Artifacts

Why federation is a different problem

Multi-agent frameworks assume you own every agent. Most real systems don’t work that way.

This book is for engineers who already build agents with LangGraph and now have to call an agent somebody else owns: another team’s service, released on that team’s schedule, or another company’s agent behind its own server. Inside one deployment you get a great deal for free. One checkpointer sees every write, one credential covers every call, and one stack trace shows where something broke. None of that comes with you across an owner line.

Your partner releases on its own schedule, keeps its own state, answers to its own auditors, and sends you its own invoice. Nothing in the protocol makes its answers trustworthy, its prices fair, or its failures yours to contain. This book shows what to build on your side so that you can call it anyway. It hardens the seam’s properties one at a time, with A2A, the open Agent2Agent protocol, as the wire between owners and LangGraph on the side you own.

The running example

Every mechanism is shown on one fictional company, Meridian Mutual, a regional motor insurer whose claims agents are split across several owners. The Claims team runs the claims graph in LangGraph, and it is your side of every seam. Risk screens claims for fraud. Finance makes the payments. Northgate is a repair-estimate agent at another company. It is not built on LangGraph, and Meridian cannot install anything on its side of the seam.

The spine of the book

The seam checklist. One line per chapter.

Each chapter ends the same way: with its artifact, a piece of the companion code you can copy; with its line of the seam checklist, the short list of what every seam must have; and with a “Cost of skipping this” paragraph. Open a chapter for all three: the artifact as Appendix D describes it, the checklist line as the closer prints it, and the cost, shortened from the chapter.

  • Contract
  • Authority
  • State
  • Failure
  • Accountability
  • Part I: the seam
Grouped by Part, coloured by the property each chapter hardens
Part I

The Seam

Ch 1–3
Ch 1 Multi-Agent Is Not Federated: The Ownership Boundary The seam

What it builds

The seam inventory decides which of your calls are seams.

The seam inventory · seamkit/inventory.py

Its line of the seam checklist

1.Every cross-owner call is listed, with the owner on each side and who is paged for it.

Cost of skipping this

Meridian's Tuesday is the cost: nobody had written that the score was on 0-100, and for three days suspect claims were paid at the repair estimate.

Ch 2 The Federation Test: When an A2A Boundary Earns Its Cost The seam

What it builds

The federation decision record decides whether a call should be a seam at all.

The federation decision record · seamkit/federation.py, docs/decisions/

Its line of the seam checklist

2.Every seam has a decision record that names the owner line it crosses, and every call without one runs in-process.

Cost of skipping this

A seam the Claims team paid for on both sides, with a second pager for the same fault, and an owner line nobody had marked, running in-process until its owner shipped. Both were decisions nobody wrote down.

Ch 3 A2A as a LangGraph Runtime Sees It The seam

What it builds

The A2A-LangGraph mapping decides what A2A carries and what it drops, row by row, and RemoteAgentNode is the one place a seam is sent from.

The A2A-LangGraph mapping and RemoteAgentNode · seamkit/remote.py

Its line of the seam checklist

3.Every seam is sent by one node that links the partner's task to your thread and turns every answer into a state update or a typed error.

Cost of skipping this

A second screening task in a second context, a first task waiting for an answer that never comes, and a referral neither team could attribute to either task. The next one is a payment.

Part II

Contract and Authority

Ch 4–8
Ch 4 The Agent Card Is a Contract, Not a Brochure Contract

What it builds

The seam contract decides whether a partner's terms still give you what you depend on.

The seam contract · seamkit/contract.py, meridian/expectations/

Its line of the seam checklist

4.Every seam has a contract in two halves, the partner's dated terms and your expectations, and the two are checked against each other before the first task is sent.

Cost of skipping this

A breaking change announced to a person, found by the production error rate, and every claim on the seam waiting for someone to read a description.

Ch 5 Which Cards to Trust: A Signature Proves the Publisher, Not the Behaviour Authority

What it builds

The card trust policy decides whether a card you fetched belongs to the owner you expected: pinned origin, pinned key or digest, approved skills.

The card trust policy · seamkit/trust.py, seamkit/cards.py, meridian/trust.py

Its line of the seam checklist

5.Every seam's card is trusted by your policy before anything crosses: from a pinned origin, signed by a pinned key or matching a pinned digest, with every skill you call approved, and the decision recorded with the card's digest.

Cost of skipping this

On the day someone adds a registry, every motor claim's fields go to a company Meridian never signed with. Without one, every card Northgate ships is trusted on its next fetch.

Ch 6 On Whose Authority: Delegation Chains Across Owners Authority

What it builds

The delegation chain decides on whose behalf a call is made.

The delegation chain and its token-minting middleware · seamkit/delegation.py, meridian/identity.py

Its line of the seam checklist

6.Every seam carries a chain that names the person and the purpose, narrows at every hop, and is checked whole by the receiver.

Cost of skipping this

A partner's log that blames you for a call your deputy made, eight estimates on seven claims served outside an agreement, and no record on your side that it happened.

Ch 7 Revoking Mid-Task: Zombie Delegations Authority

What it builds

The delegation revocation drill decides whether revocation works.

The delegation revocation drill · meridian/drill.py, seamkit/drill.py, seamkit/revocation.py

Its line of the seam checklist

7.Every seam states how long a revoked chain may still act, every owner re-checks authority at every act point, and the drill proves the bound.

Cost of skipping this

A payment and a billed estimate that happened after the authority behind them was withdrawn, at four owners, in logs that are each consistent with themselves.

Ch 8 Remote Output Is Untrusted Input Authority

What it builds

The seam ingress filter decides what of a partner's answer reaches your state.

The seam ingress filter · seamkit/ingress.py

Its line of the seam checklist

8.Every field a partner returns reaches state through the ingress filter, closed or quarantined and tagged with its source, and nothing written from a partner's text leaves through another seam.

Cost of skipping this

Meridian's fraud view and a stranger's instructions reach a second owner inside a field every check approved, and nothing in any log says the memo was written by someone outside Meridian.

Part III

State Across the Seam

Ch 9–13
Ch 9 The Task Is the Only Shared State State

What it builds

The task ledger decides what you believe about the work you sent.

The task ledger · seamkit/ledger.py

Its line of the seam checklist

9.Every task you send is in your ledger before it is sent, and every answer you see is recorded with when you saw it.

Cost of skipping this

Three tasks at Risk, three answers nobody at Claims could read, and a claim held up for a morning. Skip the ledger on the payments seam and the same three re-runs are three payments.

Ch 10 Interrupt, Resume, and the Human on the Other Side State

What it builds

The cross-owner resume state machine decides what to do with a paused task: for each state the partner reports and each party the pause waits on, the step to take, after the ledger, the authority, and the card are checked again.

The cross-owner resume state machine · seamkit/resume.py, seamkit/approval.py

Its line of the seam checklist

10.Every question a partner raises names who must answer it, reaches only that person, and is resumed only after the ledger, the authority, the card, and the question are checked again.

Cost of skipping this

A 3,000 payment approved by two Claims people under a control that required one of them to be at Finance, and Finance unaware until its approver came back.

Ch 11 Long-Running Tasks: Streaming, Push, and Polling State

What it builds

The delivery-mode matrix decides how you hear about a long-running task, and what covers the loss each mode allows.

The delivery-mode matrix and a verified push receiver · seamkit/delivery.py, seamkit/push.py

Its line of the seam checklist

11.Every long-running task has a delivery mode chosen for how it loses updates, every push is only a signal to read the task, and a backstop poll bounds how long a lost push can go unnoticed.

Cost of skipping this

A forged push with a real token closed CLM-1002's estimate as failed. Skip the backstop, and the 503 from one Claims deploy leaves a claim waiting until the customer calls.

Ch 12 Retries, Idempotency, and Reconciliation State

What it builds

The seam retry policy and reconciliation job decide what may be sent again and who notices what went wrong anyway.

The seam retry policy and reconciliation job · seamkit/retry.py, seamkit/reconcile.py

Its line of the seam checklist

12.Every send is retried only under a key the partner has promised to honour and inside the window it promised, and a reconciliation job compares your ledger with the partner's tasks in both directions.

Cost of skipping this

Two payments of 3,000 for one claim, a ledger that showed one, and a bank statement eleven days later.

Ch 13 Compensation Across Owners: Sagas When You Can't Roll Back the Partner State

What it builds

The saga plan decides how a workflow across owners is undone.

The saga plan · seamkit/saga.py, meridian/saga.py

Its line of the seam checklist

13.Every step that commits at a partner names the compensating skill the partner promised and its window, and every compensation the partner refuses or only partly honours reaches a person, not a retry.

Cost of skipping this

A booking the shop acted on for a claim Claims had already referred, found by the claimant's phone call. Skip the plan and nobody can say in advance which partner will undo what, for how long, or who pays for what it cannot.

Part IV

Operating What You Don't Own

Ch 14–19
Ch 14 Failure Containment: Breakers, Fallbacks, and the Partner Stop Failure

What it builds

The seam breaker config and the partner stop decide what happens when a partner is slow, wrong, or gone.

The seam breaker config and the partner stop drill · seamkit/breaker.py, seamkit/stop.py, meridian/containment.py

Its line of the seam checklist

14.Every seam has a breaker that counts only the partner's failures to answer and a degraded mode chosen for what the seam decides, and every partner has a stop the team has drilled, which ends new work there and leaves every compensation reachable.

Cost of skipping this

One company's slow deploy held up every screening that asked for history, put timeouts on the dashboard of a seam whose partner had changed nothing, and paged the wrong team.

Ch 15 Contract Version, Behaviour Version Contract

What it builds

The compatibility matrix and the canary suite decide whether a partner changed.

The compatibility matrix and the canary suite · seamkit/compat.py, seamkit/canary.py, meridian/canaries.py

Its line of the seam checklist

15.Every seam states the protocol, terms, and notice it accepts, and every skill that commits nothing is sent golden tasks on a schedule, so a change in what the partner answers is found within one cadence and accepted only by a person.

Cost of skipping this

A partner's model swap lowered every door estimate while every check passed, and policyholders did the monitoring.

Ch 16 Testing Agents You Can't Deploy Failure

What it builds

The partner stub and the seam contract test suite decide whether your code still works against a partner you cannot deploy, and whether the partner's next release still works for you.

The partner stub and the seam contract test suite · stub/, seamkit/contracttest.py

Its line of the seam checklist

16.Every seam has a stub built only from the partner's card, terms, and recorded tasks, that fails on demand in every way the earlier lines guard against, and a contract test suite the partner runs against each release before it ships.

Cost of skipping this

A partner's release moved an answer from one outcome class to another, and Claims' adjusters found it, one claim at a time, not a red build at Northgate.

Ch 17 Trace What You Own, Receipt What You Don't Accountability

What it builds

The seam receipt and the ownership map decide what can be proven about a crossing and who hears about it.

The seam receipt and the ownership map · seamkit/receipt.py, seamkit/ownership.py

Its line of the seam checklist

17.Every answer that crosses a seam leaves a receipt both owners sign over the same hashes of what was sent and answered, kept outside the checkpoint, and every signal the seam raises reaches the owner your ownership map names, on your side or the partner's.

Cost of skipping this

Every question about a crossing is answered with your log against theirs. The day the partner's retention runs out, the crossing is something only you claim happened.

Ch 18 Who Pays: Budgets as Contract Terms Accountability

What it builds

The seam cost ledger decides what a seam cost and who pays.

The seam cost ledger · seamkit/costs.py, meridian/rates.toml

Its line of the seam checklist

18.Every seam sends a budget ceiling with each task and gets a price or a signed usage report back, every charge is checked against a receipt before it is paid, and every cost the seam causes has a payer named before the invoice arrives.

Cost of skipping this

A partner's release triples what your claims cost and passes every check you run, because none of them reads money.

Ch 19 Audit Evidence Across Organisations Accountability

What it builds

The seam evidence pack decides what an owner can show an auditor about one claim.

The seam evidence pack · seamkit/evidence.py

Its line of the seam checklist

19.Every seam's agreement says what each owner keeps about a task, for how long, where, and how fast it is produced, and every decision a partner makes for you can be shown from records the owners signed, joined by the chain, with every gap named.

Cost of skipping this

A regulator asks about a decision made one owner away. You can show what you sent and what came back, but not what the decision rested on, where the data went, or that your own record is whole.

The closer adds no property, so it adds no line. Ten of the lines are the federation gateway’s required controls, checked at start. The rest are decision records, scheduled jobs, drills, or agreements, and no gateway can write or schedule them for you.

Chapter 2 · The named test

The Federation Test. When an A2A boundary earns its cost.

The Federation Test asks four questions of every proposed agent-to-agent call. The owner question decides whether the call is a seam. The other three decide which of the seam’s properties it must harden first.

An owner is whoever can deploy, version, and revoke the agent without asking you. If the answer is no, the call is not a seam, whatever else is true of it, and the remaining choice is between a subgraph and a tool.

The closer puts every control into one gateway per owner and reruns the Federation Test on Meridian with measured numbers.

verdict = federation_test(policy)

  1. Does another owner control the other side?

    Decides whether the call is a seam. No: a subgraph or a tool.

  2. Does that side release on its own cadence?

    A yes puts contract first.

  3. Does it sit in a different trust domain?

    A yes puts authority first.

  4. Does it sit behind a different data boundary?

    A yes puts contract and authority first.

The three options are a subgraph, an MCP tool, and an A2A agent, in that order. A2A is the only one that assumes another owner.

Chapter 1 · Definition: the seam

Five properties. Free inside one deployment, missing across an owner until someone builds it.

Ch 4 and 15

Contract

What is promised, in what shape, with what meaning.

Ch 5–8

Authority

On whose behalf the call is made, and whom each side trusts.

Ch 9–13

State

What both sides can know about the work in flight.

Ch 14 and 16

Failure

What happens when the other side is slow, wrong, or gone.

Ch 17–19

Accountability

Who answers for the outcome, who pays for it, and what can be proven.

How it is built

Nineteen chapters and a closer, twenty artifacts you can copy.

Each chapter’s artifact is a piece of the seam you can copy into your own federation. Everything under seamkit/ holds no Meridian code: copy it as it is, and give it your own owner map, terms, expectations, and policies. Everything under meridian/ is Meridian’s configuration and wiring. Read those as worked examples, and write your own.

The closer’s artifact is the federation gateway. It puts every control on every seam from one configuration per owner, and refuses to start a seam missing one its policy requires.

Appendix D lists all twenty. One row:
ChArtifactFiles
9The task ledgerseamkit/ledger.py

The protocol and the libraries this book builds on change between releases. Appendix B records the releases the code was run against.

Who this book is for

You build agents with LangGraph, and now you have to call agents you do not own.

  • Engineers who build agents with LangGraph and now have to call agents they do not own
  • Platform and security teams who own the gateway, the credentials, and the controls between agents
  • Architects who decide where agent boundaries go between teams and between companies
  • Technical leads who must answer for cost, failure, and audit evidence in a multi-owner agent system

What you need

Python and a working knowledge of LangGraph: graphs and their state, checkpointers, and interrupt(). This book does not teach them. When a chapter leans on them, it points to the chapter of Building Real-World Agentic AI Systems with LangGraph, the second book in the same series.

You do not need to know A2A in advance. Chapter 3 explains it as far as a LangGraph caller meets it.

Contents

Four parts, nineteen chapters, a closer, five appendices.

Part I

The Seam

  • 1 Multi-Agent Is Not Federated: The Ownership Boundary
  • 2 The Federation Test: When an A2A Boundary Earns Its Cost
  • 3 A2A as a LangGraph Runtime Sees It

Part II

Contract and Authority

  • 4 The Agent Card Is a Contract, Not a Brochure
  • 5 Which Cards to Trust: A Signature Proves the Publisher, Not the Behaviour
  • 6 On Whose Authority: Delegation Chains Across Owners
  • 7 Revoking Mid-Task: Zombie Delegations
  • 8 Remote Output Is Untrusted Input

Part III

State Across the Seam

  • 9 The Task Is the Only Shared State
  • 10 Interrupt, Resume, and the Human on the Other Side
  • 11 Long-Running Tasks: Streaming, Push, and Polling
  • 12 Retries, Idempotency, and Reconciliation
  • 13 Compensation Across Owners: Sagas When You Can’t Roll Back the Partner

Part IV

Operating What You Don’t Own

  • 14 Failure Containment: Breakers, Fallbacks, and the Partner Stop
  • 15 Contract Version, Behaviour Version
  • 16 Testing Agents You Can’t Deploy
  • 17 Trace What You Own, Receipt What You Don’t
  • 18 Who Pays: Budgets as Contract Terms
  • 19 Audit Evidence Across Organisations
Closer · Assembling the Federation: The Gateway and the Federation Test, Rerun A · Vocabulary B · The A2A Reference C · Regulation and Standards D · The Artifacts E · The Companion Repository

The companion repository

One tag per chapter. No network, no accounts, no model key.

The code in this book is one Python project that grows chapter by chapter. It builds Meridian, with the reusable pieces in a package called seamkit. Every chapter has a git tag named after the chapter, and checking it out gives you the code as it stood at the end of that chapter, with the tests that passed then. The release tag is code-v1.0. MIT License.

git clone https://github.com/ranjankumar-gh/federated-langgraph-a2a-companion
cd federated-langgraph-a2a-companion
git checkout ch09-the-task-is-the-only-shared-state

uv sync
uv run pytest

Risk, Finance, and Northgate run in the same process as Claims, over an in-process wire, so the suite needs no network, no accounts, and no model key. The wire is still real A2A: from Chapter 3 on, a test that crosses a seam sends through the A2A SDK’s own client to the SDK’s own server.

github.com/ranjankumar-gh/federated-langgraph-a2a-companion at code-v1.0

The author

Ranjan Kumar

Ranjan Kumar builds and writes about production AI systems. He holds an M.Tech in Artificial Intelligence from IIT Jodhpur and has 20 years of experience in the field. He writes continuing series on harness engineering, agent security architecture, RAG engineering, and the operational side of running agents at scale.

This book is the fourth in his Agentic AI Series:

Errata and feedback

If a listing and the repository disagree, the repository is the one that runs.

If you find an error in the book or in its code, the fastest route is an issue on the companion repository.