StudioUserAgent
public class StudioUserAgent extends AgentBase
io/agentscope/core/studio/StudioUserAgent.java:74–334Studio 用户智能体,对智能体行为进行评测、追踪与可观测性分析。位于 io.agentscope.core.studio 包,继承自 AgentBase。核心成员包括 handleInterrupt、doCall、builder。
User proxy agent that represents human users in the agent system.
This agent allows human users to interact with other agents either through:
-
Terminal/Console input (default mode)
-
AgentScope Studio web interface (when Studio integration is enabled)
When integrated with Studio, the agent will:
-
Send a requestUserInput HTTP request to Studio
-
Studio displays an input form in the web UI
-
User enters input in the browser
-
Studio sends input back via WebSocket
-
Agent receives and processes the input
Usage with terminal:
`UserProxyAgent user = UserProxyAgent.builder()
.name("User")
.build();
`
Usage with Studio:
`UserProxyAgent user = UserProxyAgent.builder()
.name("User")
.studioClient(StudioManager.getClient())
.webSocketClient(StudioManager.getWebSocketClient())
.build();
`
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Builder | 类class | UserProxyAgent的构建器。 Builder for UserProxyAgent. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
protected Mono<Msg> handleInterrupt(InterruptContext context, Msg... originalArgs) | 处理中断。 Handle interrupt scenarios. |
public Mono<Msg> doCall(List<Msg> msgs) | 执行调用操作。 Process a list of input messages |
public static Builder builder()static | 创建新的UserProxyAgent 构建器。 Creates a new UserProxyAgent builder. |
方法详情Method Detail
handleInterrupt
protected Mono<Msg> handleInterrupt(InterruptContext context, Msg... originalArgs)
处理中断。
Handle interrupt scenarios.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
context | InterruptContext | 上下文(类型 `InterruptContext`)。The interrupt context containing metadata about the interruption |
originalArgs varargs | Msg... | original 参数(类型 `Msg...`)。The original arguments passed to the call() method |
Mono<Msg>io/agentscope/core/studio/StudioUserAgent.java:203–213doCall
public Mono<Msg> doCall(List<Msg> msgs)
执行调用操作。
Process a list of input messages
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息列表(类型 `List`)。Input messages (ignored) |
Mono<Msg>io/agentscope/core/studio/StudioUserAgent.java:221–230builder
public static Builder builder()
创建新的UserProxyAgent 构建器。
Creates a new UserProxyAgent builder.
Builderio/agentscope/core/studio/StudioUserAgent.java:237–239嵌套类详情Nested Class Detail
Builder
public static class BuilderUserProxyAgent的构建器。位于 io.agentscope.core.studio 包。核心成员包括 name、description、studioClient、webSocketClient、inputTimeout、build。
Builder for UserProxyAgent.
继承成员Inherited Members
AgentBasegetAgentId, getName, getDescription, isCheckRunning, call, callInternal, interruptRunning, runLifecycle, callSerializationKey, call, call, doCall, doCall, addSystemHook, removeSystemHook, interrupt, interrupt, interrupt, checkInterruptedAsync, resetInterruptFlag, getInterruptFlag, getInterruptSource, doObserve, getAgentState, beforeAgentExecution, afterAgentExecution, getHooks, addHook, removeHook, getSortedHooks, seedSystemMsg, stateForCall, consumeSystemMsgAfterPreCall, removeSubscribers, resetSubscribers, hasSubscribers, getSubscriberCount, observe, observe, stream, stream, stream, toString, CALL_SCOPE_KEY, RUNTIME_CONTEXT_KEY, SHUTDOWN_REQUEST_ID_KEY