AS AgentScopeAPI 手册 / API Reference

StudioWebSocketClient

public class StudioWebSocketClient
源码Source io/agentscope/core/studio/StudioWebSocketClient.java:48–398

Studio 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.

参数Parameters
名称Name类型Type说明Description
configStudioConfig配置对象(类型 `StudioConfig`)。Configuration for Studio connection
源码Source io/agentscope/core/studio/StudioWebSocketClient.java:60–62

方法详情Method Detail

connect

public Mono<Void> connect()

建立连接并完成初始化。

Connects to Studio's WebSocket endpoint (/python namespace).

返回Returns Mono<Void>
返回Mono。A Mono that completes when the connection is established
源码Source io/agentscope/core/studio/StudioWebSocketClient.java:83–140

waitForInput

public Mono<UserInputData> waitForInput(String requestId)

等待用于输入。

Waits for user input matching the given request ID.

参数Parameters
名称Name类型Type说明Description
requestIdString请求标识(类型 `String`)。The request ID to wait for (from StudioClient.requestUserInput)
返回Returns Mono<UserInputData>
返回Mono。A Mono that emits the user input data when available
源码Source io/agentscope/core/studio/StudioWebSocketClient.java:327–338

close

public void close()

关闭连接并释放相关资源。

Closes the WebSocket connection and releases resources.

源码Source io/agentscope/core/studio/StudioWebSocketClient.java:343–348

isConnected

public boolean isConnected()

判断是否已连接。

Checks if the WebSocket is currently connected.

返回Returns boolean
返回布尔值,表示判断结果。true if connected, false otherwise
源码Source io/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.

基于官方固定版本源码静态生成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.