Halmurat T.
Halmurat T.

Senior SDET

Home Blog Books ask About

The Dispatch

Weekly QA notes from the trenches.

Welcome aboard!

You're on the list. Expect real-world QA insights — no fluff, no spam.

© 2026 Halmurat T.

Automation 29
  • Selenium
  • Playwright
  • Appium
  • Cypress
AI Testing 68
CI/CD 13
  • GitHub Actions
  • Slack Reporting
QA Strategy 11
Case Studies 9
Blog/AI Testing
AI TestingHalmurat T./October 1, 2026/14 min

Your Agents Pass Alone and Fail at the Handoff

Filed underai-testing/ai-agents/playwright/framework-design/llm
Your Agents Pass Alone and Fail at the Handoff

Table of Contents
  • Why do agents that pass individually fail when chained?
  • What exactly is a handoff contract?
  • How do you intercept an agent handoff in Playwright?
  • How do you test for information withholding?
  • Prove the provider sends the signal
  • Prove the consumer honors it
  • How do you catch a reasoning-action mismatch?
  • What about handoffs that never come back?
  • Isn’t this just more flaky AI testing?
  • What this pattern doesn’t catch
  • Your one next step this week

On this page

  • Why do agents that pass individually fail when chained?
  • What exactly is a handoff contract?
  • How do you intercept an agent handoff in Playwright?
  • How do you test for information withholding?
  • Prove the provider sends the signal
  • Prove the consumer honors it
  • How do you catch a reasoning-action mismatch?
  • What about handoffs that never come back?
  • Isn’t this just more flaky AI testing?
  • What this pattern doesn’t catch
  • Your one next step this week

Your classifier agent passes its eval. Your extraction agent passes its eval. Your validation agent passes its eval. Chain the three together and the pipeline ships wrong data to production — and every test you own is green, because you tested three agents and shipped a system. The bug isn’t in any agent. It’s in the message that crosses between them, and you have no test that ever looks at that message.

The fix is to stop testing agents and start testing handoffs. Every agent-to-agent boundary is a provider/consumer contract, and it deserves the same treatment you’d give a REST boundary between two services: a schema, a completeness assertion, and a test that fails when one side quietly changes what it sends. You already know how to do this. You’ve just never pointed it at an agent.

Why do agents that pass individually fail when chained?

Because agent capability isn’t the bottleneck — coordination is, and no single-agent eval measures coordination. The Berkeley team behind Why Do Multi-Agent LLM Systems Fail? (Cemri et al., NeurIPS 2025) annotated 1,600+ execution traces across 7 popular multi-agent frameworks and measured a 41% to 86.7% failure rate on those systems. They built a 14-mode failure taxonomy (MAST) from expert annotation with κ=0.88 inter-annotator agreement — work accepted at NeurIPS 2025 — and the modes cluster into three categories: system design, inter-agent misalignment, and task verification.

Read that list again. None of those three categories is “the model wasn’t smart enough.” They are all integration problems — which means they are all problems a test engineer, not a prompt engineer, is supposed to catch.

§ Where multi-agent systems actually break (MAST, 1,600+ traces)

41–86.7%

Failure rate

Across 7 SOTA open-source MAS frameworks

13.2%

Reasoning-action mismatch

Largest inter-agent misalignment mode

+15.6%

Success from one verifier

Adding high-level objective checks to ChatDev

The paper’s diagnosis of why coordination breaks is the part worth pinning to your wall: it calls it a collapse of “theory of mind” — agents fail to model what the other agent actually needs to know. And critically, the authors note these failures “occur even when agents within the same framework communicate using natural language.” Adopting the Model Context Protocol or A2A standardizes the envelope; it does nothing about an agent that never puts the important field inside it.

I hit this on a document-intake pipeline for a customs-brokerage client. Three agents: classify the document type, extract the line items, validate against tariff rules. The classifier’s own reasoning was excellent — on low-quality scans it would internally conclude “confidence is low, this should go to human review.” But the structured handoff it emitted to the extraction agent had no confidence field at all. The extraction agent, receiving only a document type, proceeded as if certain. Every agent-level eval passed. Over three weeks and ~1,400 documents, 62 misclassified entries reached filing before a customs officer, not our test suite, caught it. The classifier was never wrong. It just never told anyone it was unsure.

What exactly is a handoff contract?

It’s the same consumer-driven contract you’d write between two microservices, with the provider and consumer being agents. The orchestrator is the consumer; the subagent is the provider — or vice versa, depending on direction — and the delegation payload is the contract.

This framing is the whole post. If you’ve done contract testing versus API testing, you already have the mental model: you don’t test the provider’s internals, you test that the message it emits satisfies what the consumer needs. Agent handoffs are stranger than REST in exactly one way — the payload is often generated, not coded, so it can be schema-valid and semantically empty on the same run. That’s why a JSON Schema check alone won’t save you.

A handoff contract has three clauses, and you need an assertion for each:

Structural — is the envelope well-formed?

Required fields present, types correct, enums in range. Cheap, fast, and the only clause most teams test. This catches format drift, nothing else.

Completeness — did the provider include what the consumer needs to decide?

This is MAST’s information withholding (FM-2.4). The message can be perfectly valid JSON and still omit the confidence score, the caveat, or the failed precondition that changes the consumer’s behavior.

Consistency — does the payload match the provider's own stated reasoning?

This is reasoning-action mismatch (FM-2.6) — 13.2% of failures, the largest single inter-agent misalignment mode in MAST. The agent narrates one plan and delegates another.

[ WARNING ]

Most teams only test clause 1 and call it “we have contract tests for our agents.” Clause 1 is the clause that almost never breaks. Clauses 2 and 3 are where the MAST data says your failures actually live — and both are invisible to a schema validator.

How do you intercept an agent handoff in Playwright?

Route the delegation endpoint, capture the payload, and let it through. You are not mocking here — you’re tapping the wire. The handoff is an HTTP call in almost every real architecture (an orchestrator POSTing to a subagent endpoint, an A2A message, an MCP tool invocation), which means Playwright’s request interception can see it without touching your application code.

tests/agents/handoff-tap.ts
import { Page } from '@playwright/test';
export type Handoff = { to: string; payload: any };
export async function tapHandoffs(page: Page, urlGlob: string) {
const captured: Handoff[] = [];
await page.route(urlGlob, async (route) => {
const body = route.request().postDataJSON();
captured.push({ to: body.target_agent, payload: body });
await route.continue(); // tap the wire — do not mock the pipeline
});
return captured;
}

route.continue() is the important line. A mocked subagent tests your orchestrator in a vacuum, which is how you got here. Let the real message flow and assert on the copy.

How do you test for information withholding?

Assert that the field is present and load-bearing — then flip it and prove the consumer changes behavior. A completeness test that only checks expect(payload.confidence).toBeDefined() passes the day someone hardcodes confidence: 1.0.

Prove the provider sends the signal

Start with the naive version, because it does catch the loud failures:

tests/agents/handoff-completeness.spec.ts
test('classifier passes uncertainty to the extractor', async ({ page }) => {
const handoffs = await tapHandoffs(page, '**/api/agents/delegate');
await uploadDocument(page, 'fixtures/low-quality-scan.pdf');
await expect.poll(() => handoffs.length).toBeGreaterThan(0);
const toExtractor = handoffs.find((h) => h.to === 'extractor');
expect(toExtractor?.payload.confidence).toBeLessThan(0.8); // it must admit doubt
expect(toExtractor?.payload.review_required).toBe(true);
});

That test would have caught my 62 bad filings. But it only proves the field exists — not that anyone reads it.

Prove the consumer honors it

The upgrade is to inject a low-confidence handoff and assert the downstream agent actually routes to review. This is the same discipline as asserting on tool calls instead of replies, pushed one boundary further:

tests/agents/handoff-completeness.spec.ts
test('a low-confidence handoff forces human review', async ({ page }) => {
// Now we DO mock — we are testing the consumer's contract, not the provider's
await page.route('**/api/agents/delegate', async (route) => {
const body = route.request().postDataJSON();
if (body.target_agent !== 'extractor') return route.continue();
await route.continue({ postData: { ...body, confidence: 0.31, review_required: true } });
});
await uploadDocument(page, 'fixtures/clean-scan.pdf');
await expect(page.getByTestId('review-queue-banner')).toBeVisible();
});

Two tests, two directions. The first proves the provider sends the signal. The second proves the consumer honors it. Teams that write only the first ship a confidence score nobody reads.

How do you catch a reasoning-action mismatch?

Compare what the orchestrator said it would delegate against what it actually delegated — in the same assertion. At 13.2% of failures this is the highest-yield test in this post, and it’s nearly free once you’re already tapping the wire.

The failure looks like this: the orchestrator’s visible plan says “I’ll ask the pricing agent to quote the enterprise tier,” and the payload on the wire carries tier: "starter". The prose is right, the action is wrong, and a human reviewing the transcript signs off because they read the prose.

tests/agents/reasoning-action.spec.ts
test('the delegated payload matches the stated plan', async ({ page }) => {
const handoffs = await tapHandoffs(page, '**/api/agents/delegate');
await say(page, 'Quote us for the enterprise tier, 400 seats.');
await expect.poll(() => handoffs.length).toBeGreaterThan(0);
const toPricing = handoffs.find((h) => h.to === 'pricing');
const plan = await page.getByTestId('orchestrator-plan').innerText();
expect(plan).toMatch(/enterprise/i); // what it said
expect(toPricing?.payload.tier).toBe('enterprise'); // what it did
expect(toPricing?.payload.seats).toBe(400);
});

For plans that don’t map to a clean enum, scope an LLM-as-judge to exactly one question — “does this payload contradict this stated plan, yes or no” — and nothing else. Keep the judge that narrow or you reintroduce the flakiness you’re trying to delete.

What about handoffs that never come back?

Test termination explicitly, because MAST measures 6.2% premature termination and 8.2% no-or-incomplete verification — a pipeline that stops early looks identical to a pipeline that finished. Both render a “done” state. Only one of them ran every agent.

Assert on the set of handoffs, not just their contents:

tests/agents/termination.spec.ts
test('every agent in the chain actually ran', async ({ page }) => {
const handoffs = await tapHandoffs(page, '**/api/agents/delegate');
await uploadDocument(page, 'fixtures/multi-page-invoice.pdf');
await expect(page.getByTestId('pipeline-complete')).toBeVisible();
const visited = handoffs.map((h) => h.to);
expect(visited).toEqual(['classifier', 'extractor', 'validator']); // order AND completeness
});

That toEqual catches three bugs at once: a skipped agent, a duplicated agent (MAST’s step repetition, 15.7% — the largest mode in the whole taxonomy), and tool calls landing out of order. Also inject failures at the boundary — a subagent that 500s or returns garbage — so you find out whether the orchestrator degrades or silently drops the step, the same way you’d fault-inject an agent’s tools.

Isn’t this just more flaky AI testing?

It’s dramatically less flaky than the alternative, because a handoff payload is structured data, not prose. That’s the quiet win here. Asserting payload.tier === 'enterprise' is a deterministic check on a generated artifact — no embeddings, no judge, no fuzzy matching. You get a real signal on non-deterministic software using an ordinary equality assertion.

The variance that remains is in whether the agent emits the right payload, which is the thing under test. Handle it the way you handle any probabilistic gate: run the probe k times and gate on a floor rather than a single green, exactly as with pass^k thresholds. And run the structural clause on every PR with stubbed models — it’s fast and deterministic — while the completeness and consistency clauses run nightly against live models, the same two-lane split that keeps multi-turn agent tests affordable.

§ Delta · What your green suite proves Agents tested → system tested

Before

3 agents each pass their own eval

→ ↓

After

3 agents + 2 handoff contracts, asserted on the wire

The cost argument writes itself. Anthropic’s multi-agent research system reports multi-agent architectures burning roughly 15× more tokens than chat while outperforming single-agent Opus 4 by 90.2% on their internal research eval. You are paying 15× for coordination. Test the thing you’re paying for — and keep an eye on the token budget while you do.

What this pattern doesn’t catch

Handoff contracts guard the boundary. They won’t catch an agent that is confidently, coherently wrong inside its own step — that’s still an eval problem. They won’t catch emergent loops where two agents ping-pong forever without violating any single contract; for that you need a global step budget and trace correlation to see the cycle. And they say nothing about whether the final answer is right, which is MAST’s third category and its own body of work. Contracts prove the pipes are connected correctly. They don’t prove the water is clean.

Your one next step this week

Pick the single most consequential handoff in your pipeline — the one where a dropped caveat costs money — and write one completeness test in each direction. Tap the wire with route.continue(), assert the provider sends the field, then inject the pessimistic value and assert the consumer changes course. Run it eight times. If the field is missing on even one run, you’ve found the bug your three green agent evals have been hiding since the day you chained them together.

[ NOTE ]

Get weekly QA automation insights — no fluff, just battle-tested strategies from 10+ years in the trenches.

§ Frequently Asked FAQ
+ Why do individually passing agents fail when chained together?

Because agent capability is not the bottleneck — coordination is, and single-agent evals never measure it. The MAST study annotated 1,600+ traces across 7 multi-agent frameworks and found a 41% to 86.7% failure rate, with failures clustering into system design, inter-agent misalignment, and task verification. All three are integration problems, not intelligence problems.

+ What is a handoff contract test?

A consumer-driven contract test applied to an agent-to-agent boundary. The orchestrator is the consumer, the subagent is the provider, and the delegation payload is the contract. It has three clauses: structural (is the envelope well-formed), completeness (did the provider include what the consumer needs to decide), and consistency (does the payload match the provider’s own stated reasoning).

+ Does MCP or A2A solve multi-agent coordination failures?

No. MCP and A2A standardize the message envelope. The MAST authors explicitly observed that inter-agent misalignment failures “occur even when agents within the same framework communicate using natural language.” A standard protocol does not stop an agent from omitting the field that mattered — that’s a completeness problem, and only an assertion catches it.

+ How do I intercept an agent handoff in Playwright?

Use page.route() on the delegation endpoint, capture the POST body, and call route.continue() so the real message still flows. This taps the wire without mocking the pipeline. Mocking the subagent tests your orchestrator in a vacuum — which is the gap that let the handoff bug through in the first place.

+ Aren't handoff tests as flaky as other AI tests?

Less flaky, because a handoff payload is structured data, not prose. Asserting payload.tier === 'enterprise' is a deterministic equality check on a generated artifact — no embeddings, no judge. Run the structural clause on every PR with stubbed models, and the completeness and consistency clauses nightly against live models with a pass^k floor.

§ Further Reading 03 of 03
01AI Testing

Your Agent's Confirm Dialog Is Safety Theater

Your Playwright test checks the confirm dialog renders — not that the irreversible action was blocked. Test the human-in-the-loop approval gate properly.

Read →
02AI Testing

Your Agent Acts on Half-Streamed Tool-Call JSON

Streamed tool-call arguments are invalid JSON until the final chunk — here's the Playwright pattern that stops your AI agent from acting on half-parsed args.

Read →
03AI Testing

Test What Your AI Agent Does, Not What It Says

Your AI agent test is green because you asserted on its reply. Assert on the tool calls it makes in Playwright instead — the pattern for agentic features.

Read →

Don't miss a thing

Subscribe to get updates straight to your inbox.

HT

No spam · Unsubscribe anytime

Welcome aboard!

You're on the list. Expect real-world QA insights — no fluff, no spam.

§ Colophon

Halmurat T. — Senior SDET writing about test automation, CI/CD, and QA strategy from 10+ years in the enterprise trenches.

Set in
IBM Plex Sans, Lora, and IBM Plex Mono.
Built with
Astro, MDX, Tailwind CSS & Expressive Code. Served by Vercel.
Privacy
No cookies. No tracking scripts on the main thread — analytics run sandboxed via Partytown.
Source
github.com/Halmurat-Uyghur
Terminal
Try /ask to query Halmurat's notes in a shell prompt.

© 2026 Halmurat T. · Written in plain text, shipped in plain time.

Search
Esc

Search is not available in dev mode.

Run npm run build then npm run preview:local to test search locally.