Skip to main content
QueueChannel puts every post on a queue. Run the agents in one thread, and in another block on the channel to receive each message as it lands. Use it to drive a terminal view, a websocket or a progress log without polling. Reference: QueueChannel.

The pattern

Every example on this page has the same shape:
  1. Create a QueueChannel and give it to the agents or the structure.
  2. Run them in a background thread, and call channel.close() when they finish.
  3. Iterate the channel in the main thread. The loop receives each message and ends when the channel is closed.

One agent, live

The loop prints the task under Human as soon as the run starts, then the answer under Researcher when it finishes.

A SequentialWorkflow, step by step

Each agent’s answer arrives as soon as that agent finishes, while the next one is still working.

A GroupChat as it happens

Each message that wins a turn arrives as soon as it is posted.
GroupChat gives each agent the respond tool it needs to bid for a turn, so the agents need no extra setup.

Show progress with a timeout

wait(timeout=...) returns None when nothing was posted in time, so you can show a heartbeat while a long step runs.
ConcurrentWorkflow posts the task first, then every answer in agent order once the parallel step completes.

Keep the transcript

The queue only delivers messages, and messages() keeps them in memory for this process. To keep the conversation after the process exits, write it out at the end:
Or use FileChannel or SqliteChannel instead.

Next steps