Package io.agentscope.core.studio
Class StudioUserAgent
java.lang.Object
io.agentscope.core.agent.AgentBase
io.agentscope.core.studio.StudioUserAgent
- All Implemented Interfaces:
io.agentscope.core.agent.Agent,io.agentscope.core.agent.CallableAgent,io.agentscope.core.agent.ObservableAgent,io.agentscope.core.agent.StreamableAgent
public class StudioUserAgent
extends io.agentscope.core.agent.AgentBase
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
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for UserProxyAgent. -
Field Summary
Fields inherited from class io.agentscope.core.agent.AgentBase
CALL_SCOPE_KEY, RUNTIME_CONTEXT_KEY, SHUTDOWN_REQUEST_ID_KEY -
Method Summary
Modifier and TypeMethodDescriptionstatic StudioUserAgent.Builderbuilder()Creates a new UserProxyAgent builder.reactor.core.publisher.Mono<io.agentscope.core.message.Msg>Process a list of input messagesprotected reactor.core.publisher.Mono<io.agentscope.core.message.Msg>handleInterrupt(io.agentscope.core.interruption.InterruptContext context, io.agentscope.core.message.Msg... originalArgs) Handle interrupt scenarios.Methods inherited from class io.agentscope.core.agent.AgentBase
addHook, addSystemHook, afterAgentExecution, beforeAgentExecution, call, call, call, callInternal, callSerializationKey, checkInterruptedAsync, consumeSystemMsgAfterPreCall, doCall, doCall, doObserve, getAgentId, getAgentState, getDescription, getHooks, getInterruptFlag, getInterruptSource, getName, getSortedHooks, getSubscriberCount, hasSubscribers, interrupt, interrupt, interrupt, interruptRunning, isCheckRunning, observe, observe, removeHook, removeSubscribers, removeSystemHook, resetInterruptFlag, resetSubscribers, runLifecycle, seedSystemMsg, stateForCall, stream, stream, stream, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.agentscope.core.agent.Agent
getToolkitMethods inherited from interface io.agentscope.core.agent.CallableAgent
call, call, call, call, call, call, call, call, call, callMethods inherited from interface io.agentscope.core.agent.StreamableAgent
stream, stream, stream, stream, stream, stream, stream, stream, stream
-
Method Details
-
handleInterrupt
protected reactor.core.publisher.Mono<io.agentscope.core.message.Msg> handleInterrupt(io.agentscope.core.interruption.InterruptContext context, io.agentscope.core.message.Msg... originalArgs) Handle interrupt scenarios. For UserAgent, interrupts simply return an interrupted message.- Specified by:
handleInterruptin classio.agentscope.core.agent.AgentBase- Parameters:
context- The interrupt context containing metadata about the interruptionoriginalArgs- The original arguments passed to the call() method- Returns:
- Mono containing an interrupt message
-
doCall
public reactor.core.publisher.Mono<io.agentscope.core.message.Msg> doCall(List<io.agentscope.core.message.Msg> msgs) Process a list of input messages- Specified by:
doCallin classio.agentscope.core.agent.AgentBase- Parameters:
msgs- Input messages (ignored)- Returns:
- User input message
-
builder
Creates a new UserProxyAgent builder.- Returns:
- A new builder instance
-