reply_stream produces.
AgentScope offers two terminal interfaces for this: agentscope.console prints the event stream line by line and needs nothing beyond the core install, while agentscope.tui builds a full-screen interface on Textual with Markdown rendering, keyboard-driven confirmations, and AskUser question forms.
The entries of the two modules and when to use each are as follows:
Launch an Interactive Chat
launch_console takes a constructed agent and handles the entire terminal interaction:
Chat with an agent in the terminal
launch_console accepts the following parameters:
Agent | PipelineProtocol
required
The agent to interact with, or any pipeline satisfying
PipelineProtocol.str
default:"user"
The sender name attached to the user’s messages, also used as the
input prompt.
str
default:"default"
Output verbosity, one of
"quiet", "default", or "debug". See
Control the Output Verbosity.int | None
default:"20"
Maximum number of printed lines per tool result; the excess collapses
into a hint line.
None disables truncation.Neither
launch_console nor launch_tui involves session management or persistence: the conversation lives in agent.state and ends with the process. For multi-user, multi-session, and persistent deployments, use the agent service.Embed the Event Renderer
When you own the run logic yourself (an agent pipeline, a test script), useConsoleRenderer for printing only. The renderer is passive: how events are produced, and how inputs and confirmations are handled, are entirely up to the caller.
Render the event stream in your own code
Render a multi-agent pipeline
Control the Output Verbosity
Bothlaunch_console and ConsoleRenderer take a verbosity parameter with three increasing levels:
Unknown event types are skipped silently (
debug prints one line with the type name), so new event types in the protocol never break existing rendering.Launch the Full-Screen Interface
For a richer interactive experience,launch_tui opens a full-screen chat interface. It depends on Textual, so install the tui extra first (agentscope[full] already includes it):
Install the full-screen interface dependencies
launch_tui is used the same way as launch_console: pass it a constructed agent. The example below also equips AskUser, so when the agent asks a question the interface shows a keyboard-driven form:
Chat with an agent in the full-screen interface
launch_tui accepts the following parameters:
Agent | PipelineProtocol
required
The agent to interact with, or any pipeline that satisfies
PipelineProtocol.Sequence[Msg]
default:"()"
History messages to display before the interaction starts.
str
default:"user"
The sender name of messages sent from the input box.
Show Realtime Voice Sessions
The input of a realtime voice agent is a continuous audio stream, so it has its own entry,launch_realtime_ui. The interface shows the transcripts of both sides, tool calls, and confirmation cards. Confirmations, interruptions, and typed input go back to the agent through agent.send(), while the audio itself is played by the transport and never enters the interface. Install both the realtime and the full-screen interface dependencies before running it:
Install the realtime and full-screen interface dependencies
Run a voice session in the full-screen interface
launch_realtime_ui differs from launch_tui in the following ways:
launch_realtime_ui accepts the following parameters:
RealtimeAgent
required
The connected realtime voice agent.
TransportBase
required
The started audio transport, which captures and plays audio.
Sequence[Msg]
default:"()"
History messages to display before the interaction starts.
str
default:"user"
The sender name of messages sent from the input box.
Embed Interface Components
If you already have a Textual app, you can use the two components ofagentscope.tui directly. The components only display Msg objects; they neither consume events nor modify the conversation history. They split the work as follows:
The example below connects
ChatUI to your own runtime backend runtime, which applies events to messages (Msg.append_event()) and pushes the messages that changed:
Embed ChatUI in a Textual app
Mutating an existing
Msg object in place does not refresh the interface. Call set_messages() to load or replace the whole history, and update_message() for streaming updates.