StudioWebSocketClient
public class StudioWebSocketClient
io/agentscope/core/studio/StudioWebSocketClient.java:48–398Studio WebSocket 客户端,封装与远端服务的连接和调用。位于 io.agentscope.core.studio 包。核心成员包括 connect、waitForInput、close、isConnected、StudioWebSocketClient。
WebSocket client for real-time communication with AgentScope Studio.
This client uses Socket.IO to connect to Studio's /python namespace and receive user input events. It maintains a persistent connection with automatic reconnection support.
The client listens for "forwardUserInput" events from Studio, which are sent when a user provides input through the web interface. The input is then delivered to the waiting agent via a Mono.
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
UserInputData | 类class | 用户输入数据,对智能体行为进行评测、追踪与可观测性分析。 Data structure representing user input from Studio. |
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public StudioWebSocketClient(StudioConfig config) | 初始化 `StudioWebSocketClient` 实例。 Creates a new Studio WebSocket client. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Mono<Void> connect() | 建立连接并完成初始化。 Connects to Studio's WebSocket endpoint (/python namespace). |
public Mono<UserInputData> waitForInput(String requestId) | 等待用于输入。 Waits for user input matching the given request ID. |
public void close() | 关闭连接并释放相关资源。 Closes the WebSocket connection and releases resources. |
public boolean isConnected() | 判断是否已连接。 Checks if the WebSocket is currently connected. |
构造器详情Constructor Detail
StudioWebSocketClient
public StudioWebSocketClient(StudioConfig config)
初始化 StudioWebSocketClient 实例。
Creates a new Studio WebSocket client.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
config | StudioConfig | 配置对象(类型 `StudioConfig`)。Configuration for Studio connection |
io/agentscope/core/studio/StudioWebSocketClient.java:60–62方法详情Method Detail
connect
public Mono<Void> connect()
建立连接并完成初始化。
Connects to Studio's WebSocket endpoint (/python namespace).
Mono<Void>io/agentscope/core/studio/StudioWebSocketClient.java:83–140waitForInput
public Mono<UserInputData> waitForInput(String requestId)
等待用于输入。
Waits for user input matching the given request ID.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
requestId | String | 请求标识(类型 `String`)。The request ID to wait for (from StudioClient.requestUserInput) |
Mono<UserInputData>io/agentscope/core/studio/StudioWebSocketClient.java:327–338close
public void close()
关闭连接并释放相关资源。
Closes the WebSocket connection and releases resources.
io/agentscope/core/studio/StudioWebSocketClient.java:343–348isConnected
public boolean isConnected()
判断是否已连接。
Checks if the WebSocket is currently connected.
booleanio/agentscope/core/studio/StudioWebSocketClient.java:355–357嵌套类详情Nested Class Detail
UserInputData
public static class UserInputData用户输入数据,对智能体行为进行评测、追踪与可观测性分析。位于 io.agentscope.core.studio 包。核心成员包括 getBlocksInput、getStructuredInput、UserInputData。
Data structure representing user input from Studio.
This contains both content blocks (text, images, etc.) and optional structured data validated against a schema.