AS AgentScopeAPI 手册 / API Reference
包package agentscope.tui

agentscope.tui

module agentscope.tui

agentscope.tui 属于基础设施,类型、异常、传输与工具函数。 该包共收录 4 个公开类型。

Interactive terminal UI components for AgentScope.

源码Source agentscope/tui/__init__.py:1

类Classes

ChatUI
类class
聊天 UI,为框架提供通用类型与基础能力。
Messages, composer and HITL controls without an Agent dependency.
MessagesUI
类class
消息 UI,为框架提供通用类型与基础能力。
Render authoritative message snapshots without consuming events.

函数Functions

launch_realtime_ui
函数function
启动实时语音界面
Launch a full-screen terminal view of a voice session.
launch_tui
函数function
启动全屏终端对话
Launch a full-screen interactive terminal chat.

函数详情Function Details

launch_realtime_ui

async def launch_realtime_ui(agent: RealtimeAgent, transport: TransportBase, *, messages: Sequence[Msg] = (), user_name: str = 'user') -> None
async

启动全屏终端界面展示实时语音会话状态与转写结果。

Both the agent and the transport are borrowed: they must already be started, and neither is closed here.

参数Parameters
名称Name类型Type说明Description
agentRealtimeAgent智能体(类型 `RealtimeAgent`)。A connected realtime agent. Its `reply_stream` runs for the whole session, while a confirmation, an interrupt or a typed turn goes back in through `send`.
transportTransportBase传输层(类型 `TransportBase`)。The started transport carrying the audio. It plays the reply itself, so the view shows the transcripts only.
messageskw默认default ()Sequence[Msg]消息列表(类型 `Sequence[Msg]`)。Historical messages displayed before live interaction starts.
user_namekw默认default 'user'str用户名称(类型 `str`)。Name assigned to messages submitted from the composer, which is disabled for a model that takes no text input.
返回Returns None
无返回值。No value is returned.
源码Source agentscope/tui/_launcher.py:329–355

launch_tui

async def launch_tui(target: Agent | PipelineProtocol, *, messages: Sequence[Msg] = (), user_name: str = 'user') -> None
async

启动全屏交互式终端对话界面,适合本地体验与演示。

Launch a full-screen interactive terminal chat.

参数Parameters
名称Name类型Type说明Description
targetAgent | PipelineProtocol目标(类型 `Agent | PipelineProtocol`)。Agent or pipeline whose `reply_stream` consumes user messages and HITL continuation events.
messageskw默认default ()Sequence[Msg]消息列表(类型 `Sequence[Msg]`)。Historical messages displayed before live interaction starts.
user_namekw默认default 'user'str用户名称(类型 `str`)。Name assigned to messages submitted from the composer.
返回Returns None
无返回值。No value is returned.
源码Source agentscope/tui/_launcher.py:309–326
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.