Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.swarms.world/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Swarms provides a comprehensive suite of orchestration methods for coordinating multiple AI agents in structured conversations and decision-making processes. These methods enable sophisticated multi-agent interactions like debates, panel discussions, negotiations, and more.

Installation

pip install -U swarms

Available Methods

MethodDescriptionUse Case
OneOnOneDebateTurn-based debates between two agentsPhilosophical discussions, arguments
ExpertPanelDiscussionExpert panel discussions with a moderatorProfessional discussions, expert opinions
RoundTableDiscussionRound table discussions with multiple participantsGroup discussions, brainstorming
InterviewSeriesStructured interviews with follow-up questionsQ&A sessions, information gathering
PeerReviewProcessAcademic peer review processesResearch review, feedback processes
MediationSessionMediation sessions for conflict resolutionDispute resolution, negotiations
BrainstormingSessionBrainstorming sessions for idea generationInnovation, problem solving
TrialSimulationTrial simulations with legal rolesLegal proceedings, case analysis
CouncilMeetingCouncil meetings with voting proceduresGovernance, voting processes
MentorshipSessionMentorship sessions with feedback loopsLearning, guidance
NegotiationSessionComplex negotiations between partiesBusiness deals, agreements

OneOnOneDebate

Simulates a turn-based debate between two agents for a specified number of loops. Each agent takes turns responding to the other’s arguments.

Attributes

max_loops
int
default:"1"
Number of conversational turns
agents
List[Agent]
required
Two agents for debate
img
str
default:"None"
Optional image input
output_type
str
default:"str-all-except-first"
Format for conversation history

run()

Executes the debate between agents.
def run(self, task: str) -> list
Parameters:
  • task (str): The debate topic
Returns: list of conversation history

Example

Full example: Philosophy Discussion Example
from swarms import Agent
from swarms.structs.multi_agent_debates import OneOnOneDebate

# Create debating agents
agent1 = Agent(agent_name="Philosopher1", model_name="openai/gpt-4o")
agent2 = Agent(agent_name="Philosopher2", model_name="openai/gpt-4o")

# Initialize debate
debate = OneOnOneDebate(
    max_loops=3,
    agents=[agent1, agent2]
)

# Run debate
result = debate.run("Is artificial intelligence consciousness possible?")

ExpertPanelDiscussion

Simulates an expert panel discussion with a moderator guiding the conversation. Multiple experts provide insights on a topic with structured rounds.

Attributes

max_rounds
int
default:"3"
Number of discussion rounds
agents
List[Agent]
required
Expert panel participants
moderator
Agent
required
Discussion moderator
output_type
str
default:"str-all-except-first"
Format for conversation history

run()

Executes the panel discussion.
def run(self, task: str) -> list
Parameters:
  • task (str): The discussion topic
Returns: list of conversation history

Example

Full example: Healthcare Panel Discussion
from swarms import Agent
from swarms.structs.multi_agent_debates import ExpertPanelDiscussion

# Create expert agents
moderator = Agent(agent_name="Moderator", model_name="openai/gpt-4o")
expert1 = Agent(agent_name="AI_Expert", model_name="openai/gpt-4o")
expert2 = Agent(agent_name="Ethics_Expert", model_name="openai/gpt-4o")
expert3 = Agent(agent_name="Neuroscience_Expert", model_name="openai/gpt-4o")

# Initialize panel
panel = ExpertPanelDiscussion(
    max_rounds=2,
    agents=[expert1, expert2, expert3],
    moderator=moderator
)

# Run panel discussion
result = panel.run("What are the ethical implications of AGI development?")

RoundTableDiscussion

Simulates a round table where each participant speaks in order, then the cycle repeats. Facilitated discussion with equal participation.

Attributes

max_cycles
int
default:"2"
Number of speaking cycles
agents
List[Agent]
required
Round table participants
facilitator
Agent
required
Discussion facilitator
output_type
str
default:"str-all-except-first"
Format for conversation history

run()

Executes the round table discussion.
def run(self, task: str) -> list
Parameters:
  • task (str): The discussion topic
Returns: list of conversation history

Example

Full example: AI Ethics Debate
from swarms import Agent
from swarms.structs.multi_agent_debates import RoundTableDiscussion

# Create participants
facilitator = Agent(agent_name="Facilitator", model_name="openai/gpt-4o")
participant1 = Agent(agent_name="Participant1", model_name="openai/gpt-4o")
participant2 = Agent(agent_name="Participant2", model_name="openai/gpt-4o")
participant3 = Agent(agent_name="Participant3", model_name="openai/gpt-4o")

# Initialize round table
roundtable = RoundTableDiscussion(
    max_cycles=2,
    agents=[participant1, participant2, participant3],
    facilitator=facilitator
)

# Run discussion
result = roundtable.run("How can we improve renewable energy adoption?")

InterviewSeries

Conducts a structured interview with follow-up questions. Systematic Q&A with depth through follow-up questions.

Attributes

questions
List[str]
default:"Default questions"
Prepared interview questions
interviewer
Agent
required
Interviewer agent
interviewee
Agent
required
Interviewee agent
follow_up_depth
int
default:"2"
Follow-up questions per main question
output_type
str
default:"str-all-except-first"
Format for conversation history

run()

Executes the interview series.
def run(self, task: str) -> list
Parameters:
  • task (str): The interview topic
Returns: list of conversation history

Example

from swarms import Agent
from swarms.structs.multi_agent_debates import InterviewSeries

# Create agents
interviewer = Agent(agent_name="Interviewer", model_name="openai/gpt-4o")
interviewee = Agent(agent_name="Expert", model_name="openai/gpt-4o")

# Prepare questions
questions = [
    "What is your background in AI?",
    "How do you see AI evolving in the next decade?",
    "What are the biggest challenges in AI development?"
]

# Initialize interview
interview = InterviewSeries(
    questions=questions,
    interviewer=interviewer,
    interviewee=interviewee,
    follow_up_depth=2
)

# Run interview
result = interview.run("AI Development and Future Prospects")

PeerReviewProcess

Simulates academic peer review with multiple reviewers and author responses. Structured feedback and revision process.

Attributes

reviewers
List[Agent]
required
Reviewer agents
author
Agent
required
Author agent
review_rounds
int
default:"2"
Number of review rounds
output_type
str
default:"str-all-except-first"
Format for conversation history

run()

Executes the peer review process.
def run(self, task: str) -> list
Parameters:
  • task (str): The paper or topic to review
Returns: list of conversation history

Example

from swarms import Agent
from swarms.structs.multi_agent_debates import PeerReviewProcess

# Create agents
author = Agent(agent_name="Author", model_name="openai/gpt-4o")
reviewer1 = Agent(agent_name="Reviewer1", model_name="openai/gpt-4o")
reviewer2 = Agent(agent_name="Reviewer2", model_name="openai/gpt-4o")

# Initialize peer review
review = PeerReviewProcess(
    reviewers=[reviewer1, reviewer2],
    author=author,
    review_rounds=2
)

# Run review process
result = review.run("New Machine Learning Algorithm for Natural Language Processing")

MediationSession

Simulates a mediation session to resolve conflicts between parties. Facilitated conflict resolution with structured sessions.

Attributes

parties
List[Agent]
required
Disputing parties
mediator
Agent
required
Mediator agent
max_sessions
int
default:"3"
Number of mediation sessions
output_type
str
default:"str-all-except-first"
Format for conversation history

run()

Executes the mediation session.
def run(self, task: str) -> list
Parameters:
  • task (str): The conflict to resolve
Returns: list of conversation history

Example

Full example: Merger Mediation Session
from swarms import Agent
from swarms.structs.multi_agent_debates import MediationSession

# Create agents
mediator = Agent(agent_name="Mediator", model_name="openai/gpt-4o")
party1 = Agent(agent_name="Party1", model_name="openai/gpt-4o")
party2 = Agent(agent_name="Party2", model_name="openai/gpt-4o")

# Initialize mediation
mediation = MediationSession(
    parties=[party1, party2],
    mediator=mediator,
    max_sessions=3
)

# Run mediation
result = mediation.run("Resolve intellectual property dispute")

BrainstormingSession

Simulates a brainstorming session where participants build on each other’s ideas. Creative idea generation with collaborative building.

Attributes

participants
List[Agent]
required
Brainstorming participants
facilitator
Agent
required
Session facilitator
idea_rounds
int
default:"3"
Number of idea generation rounds
build_on_ideas
bool
default:"True"
Whether to build on previous ideas
output_type
str
default:"str-all-except-first"
Format for conversation history

run()

Executes the brainstorming session.
def run(self, task: str) -> list
Parameters:
  • task (str): The brainstorming topic
Returns: list of conversation history

Example

Full example: Pharma Research Brainstorm
from swarms import Agent
from swarms.structs.multi_agent_debates import BrainstormingSession

# Create agents
facilitator = Agent(agent_name="Facilitator", model_name="openai/gpt-4o")
participant1 = Agent(agent_name="Creative1", model_name="openai/gpt-4o")
participant2 = Agent(agent_name="Creative2", model_name="openai/gpt-4o")
participant3 = Agent(agent_name="Creative3", model_name="openai/gpt-4o")

# Initialize brainstorming
brainstorm = BrainstormingSession(
    participants=[participant1, participant2, participant3],
    facilitator=facilitator,
    idea_rounds=3,
    build_on_ideas=True
)

# Run brainstorming
result = brainstorm.run("Innovative solutions for urban transportation")

TrialSimulation

Simulates a legal trial with structured phases and roles. Complete legal proceeding simulation with all participants.

Attributes

prosecution
Agent
required
Prosecution attorney
defense
Agent
required
Defense attorney
judge
Agent
required
Trial judge
witnesses
List[Agent]
default:"None"
Trial witnesses
phases
List[str]
default:"Default phases"
Trial phases
output_type
str
default:"str-all-except-first"
Format for conversation history

run()

Executes the trial simulation.
def run(self, task: str) -> list
Parameters:
  • task (str): The trial case
Returns: list of conversation history

Example

Full example: Medical Malpractice Trial
from swarms import Agent
from swarms.structs.multi_agent_debates import TrialSimulation

# Create agents
judge = Agent(agent_name="Judge", model_name="openai/gpt-4o")
prosecutor = Agent(agent_name="Prosecutor", model_name="openai/gpt-4o")
defense = Agent(agent_name="Defense", model_name="openai/gpt-4o")
witness1 = Agent(agent_name="Witness1", model_name="openai/gpt-4o")
witness2 = Agent(agent_name="Witness2", model_name="openai/gpt-4o")

# Initialize trial
trial = TrialSimulation(
    prosecution=prosecutor,
    defense=defense,
    judge=judge,
    witnesses=[witness1, witness2],
    phases=["opening", "testimony", "cross", "closing"]
)

# Run trial
result = trial.run("Patent infringement case")

CouncilMeeting

Simulates a council meeting with structured discussion and decision-making. Governance process with voting and consensus building.

Attributes

council_members
List[Agent]
required
Council participants
chairperson
Agent
required
Meeting chairperson
voting_rounds
int
default:"1"
Number of voting rounds
require_consensus
bool
default:"False"
Whether consensus is required
output_type
str
default:"str-all-except-first"
Format for conversation history

run()

Executes the council meeting.
def run(self, task: str) -> list
Parameters:
  • task (str): The meeting topic or proposal
Returns: list of conversation history

Example

Full example: Investment Council Meeting
from swarms import Agent
from swarms.structs.multi_agent_debates import CouncilMeeting

# Create agents
chairperson = Agent(agent_name="Chair", model_name="openai/gpt-4o")
member1 = Agent(agent_name="Member1", model_name="openai/gpt-4o")
member2 = Agent(agent_name="Member2", model_name="openai/gpt-4o")
member3 = Agent(agent_name="Member3", model_name="openai/gpt-4o")

# Initialize council meeting
council = CouncilMeeting(
    council_members=[member1, member2, member3],
    chairperson=chairperson,
    voting_rounds=2,
    require_consensus=True
)

# Run meeting
result = council.run("Vote on new environmental policy")

MentorshipSession

Simulates a mentorship session with structured learning and feedback. Guided learning process with progress tracking.

Attributes

mentor
Agent
required
Mentor agent
mentee
Agent
required
Mentee agent
session_count
int
default:"3"
Number of sessions
include_feedback
bool
default:"True"
Whether to include feedback
output_type
str
default:"str-all-except-first"
Format for conversation history

run()

Executes the mentorship session.
def run(self, task: str) -> list
Parameters:
  • task (str): The mentorship topic
Returns: list of conversation history

Example

Full example: Startup Mentorship Program
from swarms import Agent
from swarms.structs.multi_agent_debates import MentorshipSession

# Create agents
mentor = Agent(agent_name="Mentor", model_name="openai/gpt-4o")
mentee = Agent(agent_name="Mentee", model_name="openai/gpt-4o")

# Initialize mentorship
mentorship = MentorshipSession(
    mentor=mentor,
    mentee=mentee,
    session_count=3,
    include_feedback=True
)

# Run session
result = mentorship.run("Career development in AI research")

NegotiationSession

Simulates a negotiation with multiple parties working toward agreement. Complex multi-party negotiation with concessions.

Attributes

parties
List[Agent]
required
Negotiating parties
mediator
Agent
required
Negotiation mediator
negotiation_rounds
int
default:"5"
Number of rounds
include_concessions
bool
default:"True"
Whether to allow concessions
output_type
str
default:"str-all-except-first"
Format for conversation history

run()

Executes the negotiation session.
def run(self, task: str) -> list
Parameters:
  • task (str): The negotiation topic
Returns: list of conversation history

Example

Full example: NVIDIA-AMD Executive Negotiation
from swarms import Agent
from swarms.structs.multi_agent_debates import NegotiationSession

# Create agents
mediator = Agent(agent_name="Mediator", model_name="openai/gpt-4o")
party1 = Agent(agent_name="Company1", model_name="openai/gpt-4o")
party2 = Agent(agent_name="Company2", model_name="openai/gpt-4o")

# Initialize negotiation
negotiation = NegotiationSession(
    parties=[party1, party2],
    mediator=mediator,
    negotiation_rounds=4,
    include_concessions=True
)

# Run negotiation
result = negotiation.run("Merger terms negotiation")

Key Benefits

  1. Structured Communication: Each method provides a clear framework for organizing multi-agent interactions
  2. Role-Based Interactions: Agents can take on specific roles with defined responsibilities
  3. Flexible Configuration: Customizable parameters for controlling interaction flow
  4. Scalable Architecture: Support for various numbers of participants and interaction rounds
  5. Comprehensive Coverage: Methods for different use cases from debates to negotiations
  6. Professional Output: Consistent formatting and organization of conversation history
  7. Easy Integration: Simple API for incorporating into larger applications

Source Code

View the source code on GitHub