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:

  1. Send a requestUserInput HTTP request to Studio
  2. Studio displays an input form in the web UI
  3. User enters input in the browser
  4. Studio sends input back via WebSocket
  5. 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 Classes
    Modifier and Type
    Class
    Description
    static class 
    Builder 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 Type
    Method
    Description
    Creates a new UserProxyAgent builder.
    reactor.core.publisher.Mono<io.agentscope.core.message.Msg>
    doCall(List<io.agentscope.core.message.Msg> msgs)
    Process a list of input messages
    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.

    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, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface io.agentscope.core.agent.Agent

    getToolkit

    Methods inherited from interface io.agentscope.core.agent.CallableAgent

    call, call, call, call, call, call, call, call, call, call

    Methods 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:
      handleInterrupt in class io.agentscope.core.agent.AgentBase
      Parameters:
      context - The interrupt context containing metadata about the interruption
      originalArgs - 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:
      doCall in class io.agentscope.core.agent.AgentBase
      Parameters:
      msgs - Input messages (ignored)
      Returns:
      User input message
    • builder

      public static StudioUserAgent.Builder builder()
      Creates a new UserProxyAgent builder.
      Returns:
      A new builder instance