[BUGF][one_on_one_debate][Retain the first answer in default output]
Both one-on-one debate APIs omit the first generated answer with their default output settings. With the default max_loops=1, they return an empty string even when the agent returns a nonempty answer.
Reproduced on master at 687bdd8fb4053f95702700774f54e847b4d34e2f (Swarms 15.0.2, Python 3.12.13, macOS). This reproduction uses scripted agents and makes no model calls.
Reproduction
from swarms.structs.deep_discussion import one_on_one_debate
from swarms.structs.multi_agent_debates import OneOnOneDebate
class EchoAgent:
def __init__(self, name):
self.agent_name = name
def run(self, task=None, **kwargs):
return f"{self.agent_name} answer"
for loops in (1, 2):
agents = [EchoAgent("A"), EchoAgent("B")]
function_result = one_on_one_debate(
agents=agents, task="topic", max_loops=loops
)
class_result = OneOnOneDebate(
agents=agents, max_loops=loops
).run("topic")
print(loops, repr(function_result), repr(class_result))Actual output:
1 '' ''
2 'B answer' 'B answer'Passing output_type="dict" to either API returns A answer as the first row, followed by B answer when two turns are requested. The answer is generated and recorded; it disappears during default output formatting.
Root cause
Both APIs default to output_type="str-all-except-first". Their shared conversations contain only the agents' answers, without an initial task or system row. Conversation.return_all_except_first_string() slices the history at index 1, removing the first answer.
Relevant source at the reproduced revision:
Expected behavior and compatibility
The default result should retain the opening answer, including when only one turn is requested. Explicitly requesting str-all-except-first can continue to mean exactly that.
Would changing both defaults to "str" be the preferred correction? That preserves the existing conversation rows and explicit list/dict shapes, but changes default text presentation. Recording the task as the first row is another option, though it changes list/dict lengths currently asserted by the tests.
Validation and related work
An offline parametrized reproduction covering both APIs with one and two turns produced 4 failing assertions that default output includes A answer; 4 controls passed for explicit dictionary output retaining that answer and the expected row count. No implementation change has been made.
#2113 fixes forwarding an answer rather than a growing transcript; it does not change this output selection. #1849 discusses duplication between these APIs. I found no existing issue or PR for the first-answer omission.
Prepared with AI assistance; the reproduction and assertions were executed locally.
Source: kyegomez/swarms