Agentic Architectures

Catalogue / Multi-agent Coordination

Debate

Independent answers, argued over in rounds, settled by a judge

Shape
loop
Model calls
debaters × rounds + 1 judge (e.g. 3 × 3 + 1 = 10)
Latency
high
Complexity
medium

Also known as Multi-agent debate, Society of minds

1

How do I stop one confident answer from going unchallenged?

Several agents answer the same question on their own. Then each one reads the others' positions and has to defend, correct or abandon its own. After a fixed number of rounds, a judge settles whatever disagreement is left and explains why.

You may need it if

  • The question is a judgement call, such as a pricing change, a vendor choice or a risky diagnosis.
  • A single answer sounds plausible, but you cannot tell what it overlooked.
  • Reasonable experts on your team would disagree, and you want the disagreement on paper.
2

When is an argument between agents a waste of calls?

Use it when

  • The question has several defensible answers and the cost of picking the wrong one is high.
  • Errors hide in reasoning steps that another reader can spot, such as a wrong assumption or a missed risk.
  • You want the final answer to come with the strongest objections already addressed.

Avoid it when

What it costs

Model calls
debaters × rounds + 1 judge (e.g. 3 × 3 + 1 = 10)
Latency
high
Complexity
medium
3

How do positions move from round to round?

A loop around a shared transcript. Debaters answer alone, then read every position and reply. A rule counts the rounds and checks for agreement. When rounds are spent or everyone agrees, the judge reads the whole transcript and writes the final answer.

positionsdiffer, roundsleftagreement orrounds spentQuestion: The question or decision, optionally with candidate answers to argue over.QuestionDebaters: Each states and defends a position. From round two, each must answer the others' strongest points.DebatersTranscript: Every position and rebuttal, by round and by debater.TranscriptSettled?: Counts the rounds and checks whether positions still differ.Settled?Judge: Reads the full transcript, weighs the arguments and decides what is left in dispute.JudgeSettled answer: The final answer, the judge's reasons and the objections that remain open.Settledanswer
  1. Step 1 of 5

    Everyone answers alone

    Each debater gets the question and its own brief, such as "argue for growth" or "look for what breaks". Nobody sees anyone else yet, so the first positions are genuinely independent.

  2. Step 2 of 5

    Positions go on the record

    Every answer is written to the transcript with its reasons. This record is what the next round and the judge work from.

  3. Step 3 of 5

    Read and reply

    In each new round, every debater reads the other positions and must either rebut them, concede a point with the argument that convinced it, or refine its own answer.

  4. Step 4 of 5

    The rule counts rounds

    A plain rule, not a model, checks whether positions still differ and how many rounds are left. The loop cannot run on forever.

  5. Step 5 of 5

    The judge settles

    The judge reads the whole transcript, not just the last round. It picks the answer best supported by arguments, says which objections were answered and lists those that remain open.

What each part does
Question
The question or decision, optionally with candidate answers to argue over.
Debaters
Each states and defends a position. From round two, each must answer the others' strongest points.
Transcript
Every position and rebuttal, by round and by debater.
Settled?
Counts the rounds and checks whether positions still differ.
Judge
Reads the full transcript, weighs the arguments and decides what is left in dispute.
Settled answer
The final answer, the judge's reasons and the objections that remain open.
  • Debaters → Transcript: positions
  • Transcript → Debaters: others' positions
  • Settled? → Debaters: positions differ, rounds left
  • Settled? → Judge: agreement or rounds spent

Where it connects

Entry
question
QuestionTaskOptionsAnswer

A question or decision to settle. May carry candidate options to argue between, or an existing answer to challenge.

Exit
settled
AnswerVerdict

When: The debaters agree, or the round limit is spent and the judge has decided.

The chosen answer, the judge's reasons, the main objections and how each was answered, and any point still in dispute.

Working memory for one run
transcript
Options

Every debater's position and rebuttals, tagged by round and author. Discarded when the run ends.

4

What do I ask my assistant to set up?

The agents to launch

Debater, three, each with a different stance or brief

Answer the question from your assigned stance, with your reasons. In later rounds, read the other positions. Rebut what you think is wrong, concede only when you can name the argument that convinced you, and keep each reply under 200 words.

Sees: The question, its own brief and, from round two, the transcript of all earlier rounds. Not the other debaters' briefs.

Judge

Read the full transcript. Choose the answer best supported by arguments, not by how many debaters hold it or how confident they sound. List the objections that were answered and those that remain open.

Sees: The question and the full transcript. Not the debaters' briefs, so it judges arguments and not assigned roles.

A prompt you can paste

Works with any assistant that can launch sub-agents. It contains the agents, the procedure and the stop rule above.

Framework-agnostic prompt
You are the orchestrator of a multi-agent workflow that follows the "Debate" architecture.
Launch every agent listed below as a separate sub-agent with its own context. Give each agent only the context stated for it. Do not do an agent's work yourself. If you cannot launch sub-agents, play each agent in a clearly separated turn and never let it use what is withheld from it.

# Task
[Describe your task here]

# Debate
Independent answers, argued over in rounds, settled by a judge.
Input: the task above. It must provide: A question or decision to settle. May carry candidate options to argue between, or an existing answer to challenge. If something essential is missing, ask for it before starting.

Agents to launch:
- Debater (three, each with a different stance or brief): Answer the question from your assigned stance, with your reasons. In later rounds, read the other positions. Rebut what you think is wrong, concede only when you can name the argument that convinced you, and keep each reply under 200 words.
  Context for this agent: The question, its own brief and, from round two, the transcript of all earlier rounds. Not the other debaters' briefs.
- Judge: Read the full transcript. Choose the answer best supported by arguments, not by how many debaters hold it or how confident they sound. List the objections that were answered and those that remain open.
  Context for this agent: The question and the full transcript. Not the debaters' briefs, so it judges arguments and not assigned roles.

Procedure:
1. Restate the question. Write three distinct debater briefs, for example one optimistic, one sceptical and one focused on cost or risk.
2. Launch the three debaters as separate agents, in parallel, without showing them each other. Record each position in the transcript.
3. For each further round, give every debater the transcript so far and collect its reply. Add the replies to the transcript.
4. After each round, check two things: do all debaters now hold the same answer, and have 3 rounds been used? If neither, run another round.
5. Launch the judge in a fresh context with the question and the full transcript.

Stop rule: Stop after 3 rounds, or earlier if every debater holds the same answer at the end of a round. The judge then decides in one call.

Exit:
- `settled`, when: The debaters agree, or the round limit is spent and the judge has decided. Deliver: The chosen answer, the judge's reasons, the main objections and how each was answered, and any point still in dispute.

# Final deliverable
The final answer, the judge's reasons, a list of objections with how each was answered, any point still in dispute, and the number of rounds used.

The same thing in code

LangGraph, python, package langgraph
import operator
from typing import Annotated, Literal, TypedDict

from langchain.chat_models import init_chat_model
from langgraph.graph import END, START, StateGraph
from langgraph.types import Send
from pydantic import BaseModel

llm = init_chat_model("anthropic:claude-sonnet-5-5")
MAX_ROUNDS = 3
STANCES = {"A": "Argue for the most ambitious answer.",
           "B": "Be sceptical: look for what breaks.",
           "C": "Focus on cost and risk."}


class Position(BaseModel):
    answer: str  # one line: the answer this debater holds now
    reply: str


class Verdict(BaseModel):
    answer: str
    reasons: str
    answered_objections: list[str]
    open_objections: list[str]


class Entry(TypedDict):
    round: int
    debater: str
    answer: str
    reply: str


class State(TypedDict):
    question: str
    round: int
    transcript: Annotated[list[Entry], operator.add]
    verdict: Verdict | None


class DebaterIn(TypedDict):
    question: str
    round: int
    name: str
    transcript: list[Entry]


def show(entries: list[Entry]) -> str:
    # debaters appear by letter only: nobody sees another's brief
    return "\n\n".join(f"Round {e['round']}, debater {e['debater']}: {e['answer']}\n{e['reply']}" for e in entries)


async def ask[T: BaseModel](schema: type[T], prompt: str) -> T:
    out = await llm.with_structured_output(schema).ainvoke(prompt)
    assert isinstance(out, schema)
    return out


def open_round(state: State) -> dict:
    return {"round": state["round"] + 1}


def fan_out(state: State) -> list[Send]:
    # round 1: no transcript, so first positions are independent
    seen = state["transcript"] if state["round"] > 1 else []
    return [Send("debater", {"question": state["question"], "round": state["round"], "name": n, "transcript": seen})
            for n in STANCES]


async def debater(state: DebaterIn) -> dict:
    p = await ask(Position, f"Your stance: {STANCES[state['name']]}\nAnswer the question from this stance, with "
                  "reasons. If a transcript is shown, rebut what you think is wrong and concede only when you can "
                  "name the argument that convinced you. Under 200 words. Give your answer in one line.\n\n"
                  f"Question: {state['question']}\n\nTranscript:\n{show(state['transcript'])}")
    return {"transcript": [{"round": state["round"], "debater": state["name"], "answer": p.answer, "reply": p.reply}]}


def tally(state: State) -> dict:
    return {}


def settled(state: State) -> Literal["open_round", "judge"]:
    # the gate: everyone agrees, or 3 rounds are spent
    last = {e["answer"].strip().lower() for e in state["transcript"] if e["round"] == state["round"]}
    return "judge" if len(last) == 1 or state["round"] >= MAX_ROUNDS else "open_round"


async def judge(state: State) -> dict:
    # fresh context: the question and the full transcript, not the stances
    v = await ask(Verdict, "Read the full transcript. Choose the answer best supported by arguments, not by how "
                  "many debaters hold it or how confident they sound. List objections answered and still open."
                  f"\n\nQuestion: {state['question']}\n\n{show(state['transcript'])}")
    return {"verdict": v}


g = StateGraph(State)
g.add_node("open_round", open_round)
g.add_node("debater", debater)
g.add_node("tally", tally)
g.add_node("judge", judge)
g.add_edge(START, "open_round")
g.add_conditional_edges("open_round", fan_out, ["debater"])
g.add_edge("debater", "tally")
g.add_conditional_edges("tally", settled)
g.add_edge("judge", END)
app = g.compile()


async def run(task: str):
    state = await app.ainvoke({"question": task, "round": 0, "transcript": [], "verdict": None})
    return {"verdict": state["verdict"], "rounds": state["round"], "transcript": state["transcript"]}

Agreement is an exact match on each one-line answer; give debaters a fixed set of candidate answers, or compare positions semantically, before real use.

Claude Agent SDK, python, package claude-agent-sdk
from typing import Any

from claude_agent_sdk import AgentDefinition, ClaudeAgentOptions, ResultMessage, query

MAX_ROUNDS = 3
DEBATER = ("Answer the question from your assigned stance, with your reasons. If a transcript is given, rebut "
           "what you think is wrong and concede only when you can name the argument that convinced you. Keep "
           "each reply under 200 words. Start with your answer in one line.")
STANCES = {"a": "Argue for the most ambitious answer.",
           "b": "Be sceptical: look for what breaks.",
           "c": "Focus on cost and risk."}
# each stance lives only in its own sub-agent's prompt, so no one else sees it
AGENTS = {f"debater-{k}": AgentDefinition(description=f"Debater {k.upper()}", prompt=f"{DEBATER}\nStance: {s}",
                                          tools=[]) for k, s in STANCES.items()}
AGENTS["judge"] = AgentDefinition(
    description="Settles the debate from the transcript.",
    prompt="Read the full transcript. Choose the answer best supported by arguments, not by how many debaters "
           "hold it or how confident they sound. List the objections answered and those still open.", tools=[])

ROUND = {"type": "object", "required": ["replies"], "properties": {"replies": {"type": "array", "items": {
    "type": "object", "required": ["debater", "answer", "reply"],
    "properties": {"debater": {"type": "string"}, "answer": {"type": "string"}, "reply": {"type": "string"}}}}}}
VERDICT = {"type": "object", "required": ["answer", "reasons", "answered_objections", "open_objections"],
           "properties": {"answer": {"type": "string"}, "reasons": {"type": "string"},
                          "answered_objections": {"type": "array", "items": {"type": "string"}},
                          "open_objections": {"type": "array", "items": {"type": "string"}}}}


async def ask(prompt: str, schema: dict[str, Any]) -> Any:
    options = ClaudeAgentOptions(agents=AGENTS, allowed_tools=["Agent"],
                                 output_format={"type": "json_schema", "schema": schema})
    async for msg in query(prompt=prompt, options=options):
        if isinstance(msg, ResultMessage):
            return msg.structured_output


def show(transcript: list[dict[str, Any]]) -> str:
    return "\n\n".join(f"Round {e['round']}, {e['debater']}: {e['answer']}\n{e['reply']}" for e in transcript)


async def run(task: str):
    transcript: list[dict[str, Any]] = []
    rounds = 0
    for rounds in range(1, MAX_ROUNDS + 1):  # the gate: stop at 3 rounds
        seen = show(transcript) if transcript else "(none: answer alone)"
        out = await ask(
            "Launch debater-a, debater-b and debater-c in parallel. Give each exactly this input and nothing "
            "else, then return each one's one-line answer and reply verbatim.\n\n"
            f"Question: {task}\n\nTranscript so far:\n{seen}", ROUND)
        transcript += [{**r, "round": rounds} for r in out["replies"]]
        if len({r["answer"].strip().lower() for r in out["replies"]}) == 1:  # ...or earlier on agreement
            break
    # the judge runs in a fresh query: question and transcript, no stances
    verdict = await ask("Use the judge agent on the question and transcript below and return its verdict.\n\n"
                        f"Question: {task}\n\n{show(transcript)}", VERDICT)
    return {"verdict": verdict, "rounds": rounds, "transcript": transcript}

Agreement is an exact match on each one-line answer; give debaters a fixed set of candidate answers, and consider a different model per debater sub-agent.

OpenAI Agents SDK, python, package openai-agents
import asyncio

from agents import Agent, Runner
from pydantic import BaseModel

MAX_ROUNDS = 3


class Position(BaseModel):
    answer: str  # one line: the answer this debater holds now
    reply: str


class Verdict(BaseModel):
    answer: str
    reasons: str
    answered_objections: list[str]
    open_objections: list[str]


DEBATER = ("Answer the question from your assigned stance, with your reasons. If a transcript is given, rebut "
           "what you think is wrong and concede only when you can name the argument that convinced you. Keep "
           "each reply under 200 words. Give your answer in one line.")
base = Agent(name="Debater", instructions=DEBATER, output_type=Position)
debaters = {name: base.clone(name=f"Debater {name}", instructions=f"{DEBATER}\nStance: {stance}")
            for name, stance in {"A": "Argue for the most ambitious answer.",
                                 "B": "Be sceptical: look for what breaks.",
                                 "C": "Focus on cost and risk."}.items()}
judge = Agent(
    name="Judge", output_type=Verdict,
    instructions="Read the full transcript. Choose the answer best supported by arguments, not by how many "
                 "debaters hold it or how confident they sound. List the objections answered and still open.")


def show(transcript: list[tuple[int, str, Position]]) -> str:
    # debaters appear by letter only: briefs stay private
    return "\n\n".join(f"Round {r}, debater {n}: {p.answer}\n{p.reply}" for r, n, p in transcript)


async def run(task: str):
    transcript: list[tuple[int, str, Position]] = []
    rounds = 0
    for rounds in range(1, MAX_ROUNDS + 1):  # the gate: stop at 3 rounds
        prompt = f"Question: {task}" + (f"\n\nTranscript:\n{show(transcript)}" if transcript else "")
        results = await asyncio.gather(*(Runner.run(a, prompt) for a in debaters.values()))
        replies = [(rounds, n, r.final_output_as(Position)) for n, r in zip(debaters, results)]
        transcript += replies
        if len({p.answer.strip().lower() for _, _, p in replies}) == 1:  # ...or earlier on agreement
            break
    # the judge sees the question and the transcript, not the stances
    verdict = (await Runner.run(judge, f"Question: {task}\n\n{show(transcript)}")).final_output_as(Verdict)
    return {"verdict": verdict, "rounds": rounds, "transcript": transcript}

Agreement is an exact match on each one-line answer; give debaters a fixed set of candidate answers, or compare positions semantically, before real use.

Vercel AI SDK, typescript, package ai
import { anthropic } from '@ai-sdk/anthropic';
import { generateText, Output } from 'ai';
import { z } from 'zod';

const model = anthropic('claude-sonnet-5-5');
const MAX_ROUNDS = 3;
const DEBATER =
  'Answer the question from your assigned stance, with your reasons. If a transcript is given, rebut what ' +
  'you think is wrong and concede only when you can name the argument that convinced you. Keep each reply ' +
  'under 200 words. Give your answer in one line.';
const STANCES: Record<string, string> = {
  A: 'Argue for the most ambitious answer.',
  B: 'Be sceptical: look for what breaks.',
  C: 'Focus on cost and risk.',
};

const Position = z.object({ answer: z.string().describe('one line: the answer you hold now'), reply: z.string() });
const Verdict = z.object({
  answer: z.string(),
  reasons: z.string(),
  answeredObjections: z.array(z.string()),
  openObjections: z.array(z.string()),
});
type Entry = { round: number; debater: string } & z.infer<typeof Position>;

// debaters appear by letter only: briefs stay private
const show = (t: Entry[]) => t.map((e) => `Round ${e.round}, debater ${e.debater}: ${e.answer}\n${e.reply}`).join('\n\n');

export async function run(task: string) {
  const transcript: Entry[] = [];
  let round = 0;
  while (round < MAX_ROUNDS) { // the gate: stop at 3 rounds
    round++;
    const prompt = `Question: ${task}` + (transcript.length ? `\n\nTranscript:\n${show(transcript)}` : '');
    const replies = await Promise.all(
      Object.entries(STANCES).map(async ([debater, stance]) => {
        const { output } = await generateText({
          model,
          output: Output.object({ schema: Position }),
          instructions: `${DEBATER}\nStance: ${stance}`,
          prompt,
        });
        return { round, debater, ...output };
      }),
    );
    transcript.push(...replies);
    if (new Set(replies.map((r) => r.answer.trim().toLowerCase())).size === 1) break; // ...or earlier on agreement
  }

  // the judge sees the question and full transcript, not the stances
  const { output: verdict } = await generateText({
    model,
    output: Output.object({ schema: Verdict }),
    instructions:
      'Read the full transcript. Choose the answer best supported by arguments, not by how many debaters ' +
      'hold it or how confident they sound. List the objections answered and those still open.',
    prompt: `Question: ${task}\n\n${show(transcript)}`,
  });
  return { verdict, rounds: round, transcript };
}

Agreement is an exact match on each one-line answer; give debaters a fixed set of candidate answers, and consider a different model for each stance.

Snippets are generated when the site is built and type-checked against the SDK versions listed in the repository. Treat them as a starting skeleton.

What goes wrong

  • Identical debaters agree too quickly. Give each one a different stance, and if possible a different model.
  • Long replies bury the arguments and inflate cost. Cap each reply and ask for the key points first.
  • A judge that counts votes ignores a lone debater who is right. Tell it to weigh arguments, not headcount.

Chain it

Its result can feed

It can take the result of

Source