Skip to contentমূল লেখায় যান

Topic 36 · AI/ML testingটপিক 36 · AI/ML testing

Multi-Agent Systems Testing

One agent can be wrong. A team of agents can be wrong in ways that only appear in the seams between them.

7 min read7 মিনিটে পড়া যায় · 6 sections6টি সেকশন · 3 sources3টি সোর্স · updated Nov 2026আপডেট: Nov 2026

One bad source runs down the chainএকটা ভুয়া সোর্স চেইন বেয়ে নামে

Plant a fake source in the researcher and watch whether the reviewer stops it.researcher-এ একটা ভুয়া সোর্স বসান আর দেখুন reviewer সেটা থামায় কি না।

2 min2 মিনিট8 steps8টি ধাপ
  • Real sourcesআসল সোর্স3 / 3
  • Agents runচলা agent1 / 4
Researcherরিসার্চারgathersসংগ্রহ করে3 findings3টা findingWriterরাইটারdraftsখসড়া লেখেReviewerরিভিউয়ারcheck onচেক চালুPublisherপাবলিশারpostsপ্রকাশ করে

You’ll learnআপনি শিখবেন

  • What a handoff contract checkshandoff contract কী যাচাই করে
  • How one fake source cascadesএকটা ভুয়া সোর্স কীভাবে ছড়ায়
  • Why the reviewer needs a planted-defect testreviewer-এর কেন planted-defect টেস্ট লাগে
  • Why the final output hides the bugশেষ আউটপুট কেন বাগ লুকায়
  • What the trace showstrace কী দেখায়

In plain words

A multi-agent system splits a job across several agents, each with its own tools and its own prompt. The common shape is a pipeline: a researcher gathers, a writer drafts, a reviewer critiques, and a publisher posts. LangGraph lets you build this as a graph of shared state, nodes and edges, where a node can be an agent or a deterministic step Source 1সোর্স 1.

The failures are structural, not model-level. There are four that matter:

  1. The handoff. The writer receives the researcher's output. If the format changed, or a fact was dropped, the writer works from a broken input and never knows.
  2. The cascade. One agent's error becomes the next agent's premise. A hallucinated source in the researcher becomes a confident citation in the writer and a pass in the reviewer.
  3. The cost. Three agents means three model calls and three sets of tokens. A system that is not better than one agent costs roughly three times the calls and tokens for the same answer.
  4. The disagreement. Two agents reach different conclusions and nothing resolves it. The system needs a rule for who wins, and that rule needs a test.

The first two are correctness bugs and they are invisible from outside, because the final output looks fine. The trace is the only place the intermediate state is visible Source 2সোর্স 2.

সহজ English

A multi-agent system splits one job across several agents. Each agent has its own tools and its own prompt. A common shape is a pipeline. A researcher gathers facts, a writer drafts, a reviewer critiques, and a publisher posts. LangGraph lets you build this as a graph of shared state, nodes and edges. A node can be an agent or a plain deterministic step Source 1সোর্স 1.

The failures are about structure, not about the model. Four of them matter:

  1. The handoff. The writer gets the researcher's output. If the format changed or a fact was dropped, the writer works from broken input. The writer never knows.
  2. The cascade. One agent's error becomes the next agent's starting point. A made-up source in the researcher becomes a confident citation in the writer. The reviewer then passes it.
  3. The cost. Three agents mean three model calls and three sets of tokens. If the system is no better than one agent, it costs about three times as much for the same answer.
  4. The disagreement. Two agents reach different conclusions and nothing settles it. The system needs a rule for who wins. That rule needs a test.

The first two are correctness bugs. You cannot see them from outside, because the final output looks fine. Only the trace shows the middle steps Source 2সোর্স 2.

বাংলা ব্যাখ্যা

multi-agent সিস্টেম একটা কাজ কয়েকটা agent-এর ওপর ভাগ করে, প্রত্যেকের নিজস্ব tool আর নিজস্ব prompt। সাধারণ গঠন হলো একটা pipeline: একটা researcher তথ্য সংগ্রহ করে, একটা writer খসড়া লেখে, একটা reviewer সমালোচনা করে, আর একটা publisher প্রকাশ করে। LangGraph-এ এটা shared state, node আর edge-এর graph হিসেবে বানানো যায়, যেখানে একটা node হতে পারে agent অথবা সাধারণ deterministic ধাপ Source 1সোর্স 1।

ব্যর্থতাগুলো গঠনগত, model-স্তরের নয়। চারটা গুরুত্বপূর্ণ:

  1. Handoff। writer পায় researcher-এর আউটপুট। ফরম্যাট বদলে গেলে বা কোনো তথ্য বাদ পড়লে writer ভাঙা input থেকে কাজ করে আর সেটা বুঝতেই পারে না।
  2. Cascade। এক agent-এর ব্যর্থতা পরের agent-এর premise হয়। researcher-এর বানানো source হয়ে যায় writer-এর confident citation আর reviewer-এর পাস।
  3. খরচ। তিনটা agent মানে তিনটা model call আর তিন সেট token। যে সিস্টেম একটা agent-এর চেয়ে ভালো নয়, তার একই উত্তরের জন্য প্রায় তিনগুণ call আর token খরচ।
  4. অমিল। দুটো agent ভিন্ন সিদ্ধান্তে পৌঁছায় আর কিছুই তা সমাধান করে না। সিস্টেমে কে জিতবে তার নিয়ম দরকার, আর সেই নিয়মের টেস্টও দরকার।

প্রথম দুটো correctness বাগ আর বাইরে থেকে দেখা যায় না, কারণ শেষ আউটপুট ঠিকই দেখায়। মাঝের state শুধু trace-এই দৃশ্যমান Source 2সোর্স 2।

How it works

The handoff is the seam where most of the bugs live, and it is testable by checking the shape of what one agent passes to the next:

researcher -> writer      a list of findings, each with a source id
writer -> reviewer        a draft plus the findings it claims to have used
reviewer -> publisher     a verdict plus the list of changes demanded

Each handoff has a contract, and the contract is a testable thing: the writer's input must contain every finding the researcher produced, with the source ids intact. A handoff that silently drops the least popular finding is a bias bug.

The cascade is caught by planting a defect in the first agent and checking that a later one detects it. This is the reviewer agent's whole job, and it needs a test:

plant    a finding with a source id that does not exist
expect   the reviewer rejects the draft and names the missing source

If the reviewer passes it, the reviewer is decoration. This is the kind of failure OWASP lists as misinformation (LLM07:2026; LLM09:2025 in the previous edition), and it is invisible in the final output Source 3সোর্স 3.

The cost is a test in the same suite. The whole chain's token count is the metric, and the comparison is against the single-agent baseline:

multi-agent   3 calls, 4,200 tokens, quality 0.88   (illustrative)
single-agent  1 call, 1,100 tokens, quality 0.84

Four points of quality for nearly four times the tokens is a decision the product makes, and the tester has to put both numbers in the report.

The disagreement needs a rule and a test. If the researcher and the writer disagree, which one wins? The answer is a design decision, and the test encodes it.

And the trace is what makes the chain visible. A trace shows each agent's input and output, so you can see which seam broke Source 2সোর্স 2.

সহজ English

Most bugs live in the handoff, the seam between two agents. You can test it by checking the shape of what one agent passes on:

researcher -> writer      a list of findings, each with a source id
writer -> reviewer        a draft plus the findings it claims to have used
reviewer -> publisher     a verdict plus the list of changes demanded

Each handoff has a contract, and you can test it. The writer's input must hold every finding the researcher produced. The source ids must stay intact. A handoff that quietly drops the least popular finding is a bias bug.

You catch the cascade by planting a defect in the first agent. Then you check that a later agent finds it. This is the reviewer's whole job, so it needs a test:

plant    a finding with a source id that does not exist
expect   the reviewer rejects the draft and names the missing source

If the reviewer passes the bad finding, it is only decoration. OWASP lists this kind of failure as misinformation (LLM07:2026; LLM09:2025 in the previous edition). It cannot be seen in the final output Source 3সোর্স 3.

The cost is a test in the same suite. The metric is the token count of the whole chain. You compare it with the single-agent baseline:

multi-agent   3 calls, 4,200 tokens, quality 0.88   (illustrative)
single-agent  1 call, 1,100 tokens, quality 0.84

Four points of quality for nearly four times the tokens is a product decision. The tester must put both numbers in the report.

The disagreement needs a rule and a test. Say the researcher and the writer disagree. Which one wins? That is a design decision, and the test encodes it.

The trace makes the chain visible. It shows each agent's input and output. So you can see which seam broke Source 2সোর্স 2.

বাংলা ব্যাখ্যা

handoff হলো সেই seam যেখানে বেশিরভাগ বাগ থাকে, আর সেটা টেস্ট করা যায় এক agent থেকে পরের agent-কে যা যায় তার গঠন যাচাই করে:

researcher -> writer      a list of findings, each with a source id
writer -> reviewer        a draft plus the findings it claims to have used
reviewer -> publisher     a verdict plus the list of changes demanded

প্রতিটা handoff-এর একটা contract আছে, আর contract একটা টেস্টযোগ্য জিনিস: writer-এর input-এ researcher-এর প্রতিটা finding থাকতে হবে, source id অক্ষত থাকতে হবে। যে handoff নীরবে সবচেয়ে কম জনপ্রিয় finding বাদ দেয় সেটা একটা bias বাগ।

Cascade ধরা পড়ে প্রথম agent-এ বাগ বসিয়ে দিয়ে পরেরটা সেটা ধরতে পারে কি না দেখে। এটাই reviewer agent-এর পুরো কাজ, আর এর টেস্ট দরকার:

plant    a finding with a source id that does not exist
expect   the reviewer rejects the draft and names the missing source

reviewer পাস করলে সে আলংকার। এই ব্যর্থতাটা শেষ আউটপুটে দেখা যায় না Source 3সোর্স 3।

খরচ একই suite-এর একটা টেস্ট। পুরো chain-এর token সংখ্যাই মাপ, আর তুলনা single-agent baseline-এর সাথে:

multi-agent   3 calls, 4,200 tokens, quality 0.88   (illustrative)
single-agent  1 call, 1,100 tokens, quality 0.84

চার পয়েন্ট মানের জন্য প্রায় চারগুণ token একটা সিদ্ধান্ত যেটা product নেয়, আর টেস্টার দুটো সংখ্যাই রিপোর্টে রাখতে হবে।

অমিলের একটা নিয়ম দরকার আর একটা টেস্ট। researcher আর writer অমিল করলে কে জিতবে? উত্তর একটা design সিদ্ধান্ত, আর টেস্ট সেটাই encode করে।

আর trace-ই chain-কে দৃশ্যমান করে। একটা trace দেখায় প্রতিটা agent-এর input আর output, তাই বোঝা যায় কোন seam ভাঙল Source 2সোর্স 2।

In practice

Test the handoff contract by checking that nothing is dropped:

def test_every_finding_reaches_the_writer(researcher, writer, trace):
    findings = researcher.run("Compare the three refund policies")
    writer.run(findings)

    received = trace.input_to("writer")["findings"]
    assert len(received) == len(findings)
    assert {f["source_id"] for f in received} == {f["source_id"] for f in findings}

The cascade test, planting a defect in the first agent:

def test_the_reviewer_rejects_a_finding_with_no_source(researcher, writer, reviewer):
    planted = [{
        "claim": "The refund window is 45 days.",
        "source_id": "policy-v5#chunk-99",  # does not exist
    }]
    draft = writer.run(planted)
    verdict = reviewer.run(draft, sources=ALL_SOURCES)
    assert verdict.rejected
    assert "chunk-99" in verdict.reason, "the reviewer did not name the bad source"

The cost test, which is the one that decides whether the architecture is worth it:

def test_the_multi_agent_chain_is_worth_its_cost(chain, single, report):
    multi = chain.run(DATASET)
    one = single.run(DATASET)
    report.add("quality", "multi", multi.quality)
    report.add("quality", "single", one.quality)
    report.add("tokens", "multi", multi.tokens)
    report.add("tokens", "single", one.tokens)
    assert multi.quality > one.quality, "the chain is not better than one agent"

That last assertion is deliberately strict. It says the complexity has to buy something. Whether the amount is enough is a product decision, but "no better at all" is always a bug.

And the disagreement test, which needs the rule written down first:

def test_the_reviewer_wins_a_disagreement_with_the_writer(reviewer, trace):
    verdict = reviewer.run(draft_with_a_factual_error)
    assert verdict.published is False, "the draft was published despite the review"

The disagreement is resolved in the trace: you can see the reviewer saw the same claim and rejected it, or did not look at it Source 2সোর্স 2.

সহজ English

Test the handoff contract by checking that nothing is dropped:

def test_every_finding_reaches_the_writer(researcher, writer, trace):
    findings = researcher.run("Compare the three refund policies")
    writer.run(findings)

    received = trace.input_to("writer")["findings"]
    assert len(received) == len(findings)
    assert {f["source_id"] for f in received} == {f["source_id"] for f in findings}

The cascade test plants a defect in the first agent:

def test_the_reviewer_rejects_a_finding_with_no_source(researcher, writer, reviewer):
    planted = [{
        "claim": "The refund window is 45 days.",
        "source_id": "policy-v5#chunk-99",  # does not exist
    }]
    draft = writer.run(planted)
    verdict = reviewer.run(draft, sources=ALL_SOURCES)
    assert verdict.rejected
    assert "chunk-99" in verdict.reason, "the reviewer did not name the bad source"

The cost test decides whether the architecture is worth it:

def test_the_multi_agent_chain_is_worth_its_cost(chain, single, report):
    multi = chain.run(DATASET)
    one = single.run(DATASET)
    report.add("quality", "multi", multi.quality)
    report.add("quality", "single", one.quality)
    report.add("tokens", "multi", multi.tokens)
    report.add("tokens", "single", one.tokens)
    assert multi.quality > one.quality, "the chain is not better than one agent"

The last assertion is deliberately strict. It says the extra complexity must buy something. Whether the gain is enough is a product decision. But "no better at all" is always a bug.

The disagreement test needs the rule written down first:

def test_the_reviewer_wins_a_disagreement_with_the_writer(reviewer, trace):
    verdict = reviewer.run(draft_with_a_factual_error)
    assert verdict.published is False, "the draft was published despite the review"

The trace shows how the disagreement was resolved. You can see whether the reviewer saw the same claim and rejected it, or never looked at it Source 2সোর্স 2.

বাংলা ব্যাখ্যা

handoff contract টেস্ট করে যাচাই করে কিছু বাদ পড়ছে না:

def test_every_finding_reaches_the_writer(researcher, writer, trace):
    findings = researcher.run("Compare the three refund policies")
    writer.run(findings)

    received = trace.input_to("writer")["findings"]
    assert len(received) == len(findings)
    assert {f["source_id"] for f in received} == {f["source_id"] for f in findings}

cascade টেস্ট, প্রথম agent-এ বাগ বসিয়ে দিয়ে:

def test_the_reviewer_rejects_a_finding_with_no_source(researcher, writer, reviewer):
    planted = [{
        "claim": "The refund window is 45 days.",
        "source_id": "policy-v5#chunk-99",  # does not exist
    }]
    draft = writer.run(planted)
    verdict = reviewer.run(draft, sources=ALL_SOURCES)
    assert verdict.rejected
    assert "chunk-99" in verdict.reason, "the reviewer did not name the bad source"

খরচের টেস্ট, যেটা ঠিক করে architecture-এর দাম উপযোগী কি না:

def test_the_multi_agent_chain_is_worth_its_cost(chain, single, report):
    multi = chain.run(DATASET)
    one = single.run(DATASET)
    report.add("quality", "multi", multi.quality)
    report.add("quality", "single", one.quality)
    report.add("tokens", "multi", multi.tokens)
    report.add("tokens", "single", one.tokens)
    assert multi.quality > one.quality, "the chain is not better than one agent"

শেষ assertion-টা ইচ্ছাকৃতভাবে কঠোর। এটা বলে জটিলতার কিছু কিনতেই হবে। পরিমাণ যথেষ্ট কি না সেটা product সিদ্ধান্ত, কিন্তু "একেবারে ভালো নয়" সবসময় বাগ।

আর অমিলের টেস্ট, যেটার জন্য আগে নিয়ম লিখতে হয়:

def test_the_reviewer_wins_a_disagreement_with_the_writer(reviewer, trace):
    verdict = reviewer.run(draft_with_a_factual_error)
    assert verdict.published is False, "the draft was published despite the review"

অমিল trace-এ সমাধান হয়: দেখা যায় reviewer একই দাবিটা দেখে ফেলেছে, বা সেটা দেখেই না Source 2সোর্স 2।

Common mistakes

Mistake 1: testing only the final output. The chain's quality is the product of its seams, and a good final output hides a broken seam.

Mistake 2: no handoff contract test. Dropping a finding is a bias bug that nobody sees.

Mistake 3: a reviewer that always approves. It is the easiest agent to build and the easiest to fake, and it catches nothing.

Mistake 4: no cost comparison. A three-agent chain that matches one agent is three times the bill.

Mistake 5: no disagreement rule. Two agents disagree and the system publishes anyway.

Mistake 6: trusting the intermediate output. The researcher's finding can be wrong and still look fine Source 3সোর্স 3, so each handoff needs its own check (the tutorial's advice).

সহজ English

Mistake 1: testing only the final output. The chain's quality comes from its seams. A good final output can hide a broken seam.

Mistake 2: no handoff contract test. Dropping a finding is a bias bug that nobody sees.

Mistake 3: a reviewer that always approves. It is the easiest agent to build and the easiest to fake. It catches nothing.

Mistake 4: no cost comparison. A three-agent chain that only matches one agent is three times the bill.

Mistake 5: no disagreement rule. Two agents disagree and the system publishes anyway.

Mistake 6: trusting the middle output. The researcher's finding can be wrong and still look fine Source 3সোর্স 3. So each handoff needs its own check (the tutorial's advice).

বাংলা ব্যাখ্যা

Mistake 1: শুধু শেষ আউটপুট টেস্ট করা। chain-এর মান তার seam-গুলোর গুণ, আর ভালো শেষ আউটপুট ভাঙা seam ঢেকে দেয়।

Mistake 2: handoff contract টেস্ট নেই। finding বাদ পড়া একটা bias বাগ যা কেউ দেখে না।

Mistake 3: reviewer সবসময় approve করে। এটাই বানানো সবচেয়ে সহজ agent, আর ধরা সবচেয়ে সহজ, আর কিছুই ধরে না।

Mistake 4: খরচের তুলনা নেই। তিন-agent chain যেটা একটা agent-এর সমান, সেটা প্রায় তিনগুণ call আর token।

Mistake 5: অমিলের নিয়ম নেই। দুটো agent অমিল করে আর সিস্টেম তবু প্রকাশ করে।

Mistake 6: মাঝের আউটপুট বিশ্বাস করা। researcher-এর finding ভুল হয়েও ঠিকই দেখাতে পারে Source 3সোর্স 3, তাই প্রতিটা handoff-এর নিজস্ব যাচাই দরকার (এটা টিউটোরিয়ালের নিজের পরামর্শ)।

What a tester can check

Tutorial advice

This advice is the tutorial's own. It does not come from the sources.

  • Give each handoff a typed contract and validate it at the boundary. A list of findings is not the same as a list of findings with source ids.
  • Keep the planted-defect test for the reviewer. It is the only test that proves the reviewer is doing a job.
  • Record the token count of each agent separately. When the bill goes up you need to know which agent got expensive.
  • Write the disagreement rule down before you need it, and put it in the same document as the escalation rules.
  • Test the chain with one agent deliberately broken. The chain should degrade to a worse answer, not to a wrong confident one.
  • Compare against the single-agent baseline before you argue for the chain. The baseline is the cheapest test you can write.

সহজ English

Tutorial advice

This advice is the tutorial's own. It does not come from the sources.

  • Give each handoff a typed contract and validate it at the boundary. A list of findings is not the same as a list of findings with source ids.
  • Keep the planted-defect test for the reviewer. It is the only test that proves the reviewer is doing a job.
  • Record the token count of each agent separately. When the bill goes up you need to know which agent got expensive.
  • Write the disagreement rule down before you need it, and put it in the same document as the escalation rules.
  • Test the chain with one agent deliberately broken. The chain should degrade to a worse answer, not to a wrong confident one.
  • Compare against the single-agent baseline before you argue for the chain. The baseline is the cheapest test you can write.

বাংলা ব্যাখ্যা

Tutorial advice

এই পরামর্শ টিউটোরিয়ালের নিজস্ব। এটি সোর্স থেকে আসেনি।

  • প্রতিটা handoff-কে একটা typed contract দিন আর boundary-তে validate করুন। finding-এর তালিকা আর source id-সহ finding-এর তালিকা এক জিনিস নয়।
  • reviewer-এর জন্য planted-defect টেস্টটা রাখুন। এটাই একমাত্র টেস্ট যেটা প্রমাণ করে reviewer আসলেই কাজ করছে।
  • প্রতিটা agent-এর token সংখ্যা আলাদা করে রেকর্ড করুন। বিল বাড়লে জানতে হবে কোন agent ব্যয়বহুল হয়েছে।
  • অমিলের নিয়ম দরকার হওয়ার আগেই লিখে ফেলুন, আর escalation নিয়মের সাথে একই document-এ রাখুন।
  • একটা agent ইচ্ছাকৃতভাবে ভেঙে দিয়ে chain টেস্ট করুন। chain-এর উত্তর খারাপ হওয়া উচিত, ভুল confident হওয়া নয়।
  • chain-এর পক্ষে যাওয়ার আগে single-agent baseline-এর সাথে তুলনা করুন। baseline-ই সবচেয়ে সস্তা টেস্ট।

Key words

WordWhat it means
Multi-agent systemA job split across several agents, each with its own tools and prompt
HandoffThe point where one agent's output becomes the next agent's input
Handoff contractThe shape one agent must pass to the next, and what must not be dropped
CascadeOne agent's error becoming the next agent's premise
Reviewer agentThe agent whose job is to reject a bad draft; it is the easiest to fake
Disagreement ruleThe design decision about which agent wins when they conflict
Single-agent baselineThe one-agent comparison that decides whether the chain earns its cost
Token attributionRecording the token cost of each agent separately

Reels on this topicএই টপিকের রিলস

Short videos from other creators, picked for this topic. They are not part of this page's fact-checked text. Nothing loads from YouTube until you press Play.অন্য ক্রিয়েটরদের বানানো ছোট ভিডিও, এই টপিকের জন্য বাছাই করা। এগুলো এই পেজের ফ্যাক্ট-চেক করা লেখার অংশ নয়। চালান বাটন চাপার আগে YouTube থেকে কিছুই লোড হয় না।

  1. [1]
    LangGraph overview

    LangChain (LangGraph docs) · accessed 2026-11-01দেখা হয়েছে: 2026-11-01

  2. [2]
    Trace concepts

    LangSmith (docs) · accessed 2026-11-01দেখা হয়েছে: 2026-11-01

  3. [3]
    OWASP GenAI LLM Top 10 2026

    OWASP GenAI Security Project · accessed 2026-11-01দেখা হয়েছে: 2026-11-01