Useful Pluginsui_stream

ui_stream

Stream agent completion summaries to WebSocket UI clients. Used with host() for real-time updates in web chat interfaces.

When an agent finishes a turn, sends a completion event to the WebSocket client: tools used, LLM calls made, total iterations.

Quick Start

main.py
from connectonion import Agent, host from connectonion.useful_plugins import ui_stream agent = Agent("assistant", plugins=[ui_stream]) host(agent, port=8000) # WebSocket clients receive completion events

Completion event payload

Sent to the WebSocket client when each turn completes:

code
{ "type": "complete", "tools_used": ["read_file", "edit", "bash"], "llm_calls": 3, "iterations": 3 }

Other streaming events

Individual events are emitted directly from their sources — ui_stream only adds the final summary:

Event typeEmitted byWhen
thinkingagent.pyBefore each LLM call
tool_resulttool_executor.pyAfter each tool call
assistantagent.pyWhen agent responds
completeui_stream pluginWhen turn finishes

Does nothing when agent runs locally without a WebSocket connection (if not agent.io: return).

Events used

EventHandlerPurpose
on_completestream_completeSend completion summary to WebSocket

Star us on GitHub

If ConnectOnion saves you time, a ⭐ goes a long way — and earns you a coffee chat with our founder.