Skip to main content

Overview

swarms.structs.multi_agent_debates provides structured conversation orchestrators for coordinating multiple agents in turn-based discussions. Each orchestrator takes a list of Agent instances, drives them through a scripted exchange, and returns the resulting conversation history. Both classes live in swarms.structs.multi_agent_debates and are imported from that module directly — they are not re-exported from the top-level swarms package.

Installation

Available Methods

OneOnOneDebate

Simulates a turn-based debate between two agents for a specified number of loops. Both agents are first given a short introduction naming their opponent, then they alternate: each agent’s response becomes the next agent’s prompt.

Attributes

int
default:"1"
Number of conversational turns. One agent speaks per loop, alternating.
list[Agent]
default:"None"
Exactly two agents. run() raises ValueError if the list does not contain exactly two entries.
str
default:"None"
Optional image passed to each agent’s run() call.
str
default:"str-all-except-first"
Format for the returned conversation history.

run()

Executes the debate between the two agents.
str
required
The debate topic used as the opening prompt.
str | list | dict
The conversation history, formatted according to output_type.
agents must contain exactly two agents. Any other number raises ValueError when run() is called.

Example

ExpertPanelDiscussion

Simulates an expert panel discussion with a moderator guiding the conversation. Each round, the moderator introduces the topic, every expert responds in turn, and the moderator then synthesises the responses into a follow-up question that becomes the next round’s topic.

Attributes

int
default:"3"
Number of discussion rounds. Note this is max_rounds, not max_loops.
List[Agent]
default:"None"
Expert panel participants. At least two are required.
Agent
default:"None"
The moderator agent who introduces each round and synthesises responses.
str
default:"str-all-except-first"
Format for the returned conversation history.

run()

Executes the panel discussion.
str
required
The main topic for discussion, used as the first round’s topic.
str | list | dict
The conversation history, formatted according to output_type.
run() raises ValueError if fewer than two experts are supplied in agents, or if moderator is not set.

Example

Full example: Healthcare Panel Discussion

Other Conversation Patterns

Eight further scripted conversation patterns — interview series, peer review, mediation, brainstorming, trial simulation, council meeting, mentorship, and negotiation — ship as standalone example scripts rather than as part of the library. They are built entirely from the public Agent and Conversation APIs, so they are meant to be copied into your project and adapted, not imported from swarms. Browse them at examples/multi_agent/alternate_debates/ on GitHub — each file contains one pattern plus a runnable demo.

Source Code

View the source code on GitHub