Round-Robin Communication¶
This example demonstrates how to set up a cyclic communication pattern between agents using LLMling's connection system.
flowchart LR
player1[player1]
player2[player2]
player3[player3]
player1--|run|-->player2
player2--|run stop:check|-->player3
player3--|run|-->player1
Note
Mermaid diagrams can be generated using pool.get_mermaid_diagram() for a whole pool, as well as ConnectionManager.get_mermaid_diagram() for a single agent.
Running the Example¶
Start the chain by sending a word to player1:
Example output:
How it Works¶
- Each agent is configured with the same system prompt defining the word chain game
- Agents are connected in a circle: player1 -> player2 -> player3 -> player1
- Messages flow through the connections automatically
- Optional stop condition can terminate the loop when needed
Adding Controls¶
You can add various conditions to control the conversation:
- Stop condition to end the chain based on cost/tokens/messages
- Transform function to modify messages
- Filter condition to control which messages pass through