Debate Pattern: Multiple Agents Arguing Different Positions to Reach a Better Answer

~12 min read

Not one of the book's 7 named patterns, but a real, well-documented complementary technique: multiple agents argue distinct positions on a question, and either a judge agent or consensus resolves them to the strongest final answer.

A note before this subtopic starts: the Debate pattern is NOT one of this course's 7 named multi-agent orchestration patterns (Parallel, Sequential, Loop, Router, Aggregator, Network, Hierarchical) — it's included here as a real, well-documented complementary technique from broader agent-engineering practice, since it doesn't contradict anything this course's 7 patterns describe; it's simply a distinct pattern this course doesn't happen to name.

The Debate pattern has multiple agents argue different positions on the same question, specifically to surface disagreements and weaknesses in reasoning that a single agent's confident-sounding answer might paper over. Rather than one agent producing a single answer and being trusted at face value, two or more agents are explicitly prompted to take different (sometimes deliberately opposing) stances, each producing their own reasoning and conclusion — and then either a separate judge agent evaluates the arguments to pick the strongest one, or the debating agents themselves go through additional rounds responding to each other's points before converging.

This is worth distinguishing carefully from this course's Aggregator pattern, which it superficially resembles: Aggregator combines multiple agents' INDEPENDENT opinions (each formed without seeing the others) into a consensus, treating disagreement as something to average or vote across. Debate is different in kind — agents explicitly argue AGAINST each other's positions, often across multiple rounds, with the goal of exposing weak reasoning through confrontation rather than simply combining independent takes. Aggregator assumes independent opinions are each partially right and worth blending; Debate assumes forcing agents to defend a position against challenge surfaces flaws that quiet independent agreement wouldn't.

This pattern is most valuable for genuinely contestable, judgment-heavy questions — evaluating a business strategy's risks, weighing competing technical trade-offs, or fact-checking a claim where a single agent might confidently assert something wrong without anything to push back against it. It's considerably more expensive than a single-agent answer (multiple agents, often multiple rounds, plus a judgment step), so it's worth reserving for decisions where getting it right is worth that extra cost, not as a default for routine questions.

💻 Code example

from openai import OpenAI

client = OpenAI()

def debate_agent(position: str, question: str) -> str:
    resp = client.chat.completions.create(model="gpt-4.1", messages=[
        {"role": "user", "content":
            f"Argue the '{position}' position on this question, as persuasively "
            f"and rigorously as you can: {question}"}
    ])
    return resp.choices[0].message.content

def judge_agent(question: str, arg_for: str, arg_against: str) -> str:
    resp = client.chat.completions.create(model="gpt-4.1", messages=[
        {"role": "user", "content":
            f"Question: {question}\n\nArgument FOR:\n{arg_for}\n\n"
            f"Argument AGAINST:\n{arg_against}\n\n"
            f"Evaluate both arguments and give the strongest, most well-reasoned final answer."}
    ])
    return resp.choices[0].message.content

def debate_pipeline(question: str) -> str:
    # Two agents explicitly argue opposing positions, THEN a judge
    # resolves them — distinct from Aggregator's independent-opinion blending
    arg_for = debate_agent("for", question)
    arg_against = debate_agent("against", question)
    return judge_agent(question, arg_for, arg_against)

print(debate_pipeline("Should this team migrate from a monolith to microservices now?"))

💬 Deep Dive with AI

Key points

  • Debate is NOT one of the book's 7 named patterns — included as a real, documented complementary technique that doesn't contradict them
  • Multiple agents explicitly argue different (often opposing) positions, rather than one agent's answer being trusted at face value
  • Distinct from Aggregator: Aggregator blends independent opinions into consensus; Debate forces agents to argue against each other to expose weak reasoning
  • A judge agent (or further debate rounds) resolves the arguments into a final answer
  • Most valuable for genuinely contestable, judgment-heavy questions — considerably more expensive than a single-agent answer, so reserve it for decisions worth the cost