Quick Start
1
Two agents, two rounds
['critic', 'author', 'critic', 'author'] — two full passes.2
Add an early stop
AGREED.How It Works
API Reference
Discussion
Parameters
Result Variables
The transcript lands on the run result’s
variables (i.e. result.get("variables") from flow.run(...)) — not on flow.variables, which stays the declared initial state a second run would start from.Common Patterns
Round-robin debate
Default behavior — positioni in round r runs agents[i], no selector needed.
Custom speaker selection
Setselect= to choose the next speaker per turn. The signature is (turn_index, context) -> agent.
Early stop with until=
Stop as soon as a consensus keyword appears in the latest turn.
Using the transcript downstream
Follow the discussion with a summarizer whose prompt references{{discussion_transcript}}.
Refusals / Guardrails
Discussion is opinionated — it fails loudly rather than quietly wasting spend.Stop Propagation
A speaker with
on_error="stop" (the Task default) halts the entire enclosing workflow, not just the discussion — later steps do not run. This mirrors route(), loop(), repeat(), parallel(), and if_(). See Workflow Error Handling.Nesting
Discussion is a first-class workflow step and runs correctly inside loop, parallel, route, if_, and repeat.
Discussion vs. Repeat vs. AgentTeam
Best Practices
Keep rounds small
Keep rounds small
Start at 2–3; every additional round is a full pass over every speaker.
Give each speaker a distinct role
Give each speaker a distinct role
A critic + an author debate is more useful than two agents with identical instructions.
Use until= for consensus signals
Use until= for consensus signals
A keyword like
AGREED is more reliable than string-similarity heuristics.Reference {{discussion_transcript}} explicitly
Reference {{discussion_transcript}} explicitly
A summarizer that receives only
previous_result sees just the final turn.Related
Workflow Patterns
Overview of routing, parallel, loop, and repeat
Workflow Repeat
Repeat a single step until a condition is met
Workflow Loop
Iterate over lists and files
Workflow Error Handling
How stop propagates through nested patterns
Nested Workflows
Compose Discussion inside loop, parallel, route, and repeat

