Skip to main content
OneOnOneDebate puts two agents in a back-and-forth. The first agent answers your task. The second agent replies to that answer. Then the first replies to the second, and so on, one turn at a time. There is no judge and no moderator: you get the transcript and decide what to do with it. The same debate is also available as a plain function, one_on_one_debate. The class calls that function, so both behave the same way. Neither is exported from the top-level swarms package. Import the class from swarms.structs.multi_agent_debates and the function from swarms.structs.deep_discussion. Reference: OneOnOneDebate and one_on_one_debate.

1. Run a debate

Pass exactly two agents. max_loops is the total number of turns, so max_loops=4 gives each agent two turns. output_type="list" returns each turn with its speaker.
run raises ValueError if agents does not hold exactly two agents. The check happens when you call run, not when you build the debate.
Tell each agent to reply only as itself. Without that, models sometimes start with their own name or write the other side’s lines into their answer.

2. How the turns work

  • One call per turn. A run makes max_loops agent calls. agents[0] speaks on turns 1, 3, 5 and so on, and agents[1] on turns 2, 4, 6. With max_loops=1, only the first agent speaks.
  • Introductions are folded in. Each agent’s first turn starts with You are <name> debating against <other name>. Your role is to engage in a thoughtful debate., followed by the message it is replying to. There are no separate introduction calls.
  • Only answers are passed on. Each turn records the speaker’s final answer and sends only that answer to the other agent, never the speaker’s whole conversation.
  • Fresh agents every run. Both agents are reset at the start of every run, so a second debate never carries the first one’s turns.
  • Images. The class’s img parameter, or the function’s, is sent with every turn. Use a model that accepts images.

3. Read the transcript

The transcript does not include your task. Its first message is the first agent’s opening turn. That matters for output_type: For a readable record, use "str" or "list".

4. Use the function form

one_on_one_debate takes the same settings as arguments and returns the formatted transcript. Use it when you don’t need an object to keep. Here three turns give the optimist the first and last word:

5. Reuse a debate and track tokens

Because both agents are reset at the start of every run, one OneOnOneDebate can take many motions in a row. output_type="final" returns the last turn, here the second agent’s closing reply. usage sums the token counts of both agents across every run. This continues from section 1:
The reset clears each agent’s conversation, not its usage, so the total keeps growing across runs.

Tips

  • Pick the turn count for who speaks last. An even max_loops gives the last word to agents[1], an odd one to agents[0].
  • Add a judge yourself. The debate returns a transcript only. Pass the "str" output to a third agent to pick a winner, or use DebateWithJudge, which has a judge built in.
  • Run debates one at a time per pair. Both agents are reset at the start of each run, so two debates running on the same agents at once would clear each other’s turns.

Next steps