类 UserAgent
java.lang.Object
io.agentscope.core.agent.AgentBase
io.agentscope.core.agent.user.UserAgent
- 所有已实现的接口:
Agent,CallableAgent,ObservableAgent,StreamableAgent
已过时, 待删除: 此 API 元素将从以后的版本中删除。
UserAgent class for handling user interaction within the agent framework.
Acts as a bridge between various user input sources (streams, web UI, etc.) and the message system. Supports pluggable input methods through the UserInputBase interface, allowing customization of how user input is collected and converted into framework messages.
Design Philosophy:
- UserAgent does NOT manage memory - it only captures user input
- Input is obtained via pluggable UserInputBase implementations
- Supports both simple text input and structured input with validation
- Can participate in MsgHub for multi-agent conversations
Usage Examples:
// Simple console input (default)
UserAgent user = UserAgent.builder()
.name("User")
.build();
Msg input = user.call().block();
// With custom input method
UserAgent user = UserAgent.builder()
.name("User")
.inputMethod(myCustomInput)
.build();
// With hooks
UserAgent user = UserAgent.builder()
.name("User")
.hooks(List.of(myHook))
.build();
-
嵌套类概要
嵌套类 -
字段概要
从类继承的字段 io.agentscope.core.agent.AgentBase
CALL_SCOPE_KEY, RUNTIME_CONTEXT_KEY, SHUTDOWN_REQUEST_ID_KEY -
方法概要
修饰符和类型方法说明static UserAgent.Builderbuilder()已过时, 待删除: 此 API 元素将从以后的版本中删除。Create a new builder for UserAgent.protected reactor.core.publisher.Mono<Msg> handleInterrupt(InterruptContext context, Msg... originalArgs) 已过时, 待删除: 此 API 元素将从以后的版本中删除。Handle interrupt scenarios.从类继承的方法 io.agentscope.core.agent.AgentBase
addHook, addSystemHook, afterAgentExecution, beforeAgentExecution, bindRuntimeContextToHooks, call, call, call, callInternal, callSerializationKey, checkInterruptedAsync, consumeSystemMsgAfterPreCall, doCall, getAgentId, getAgentState, getDescription, getHooks, getInterruptFlag, getInterruptSource, getName, getRuntimeContext, getSortedHooks, getSubscriberCount, hasSubscribers, interrupt, interrupt, interrupt, isCheckRunning, observe, observe, removeHook, removeSubscribers, removeSystemHook, resetInterruptFlag, resetSubscribers, runLifecycle, seedSystemMsg, stateForCall, stream, stream, stream, toString, unbindRuntimeContextFromHooks从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait从接口继承的方法 io.agentscope.core.agent.Agent
getToolkit
-
方法详细资料
-
builder
已过时, 待删除: 此 API 元素将从以后的版本中删除。Create a new builder for UserAgent.- 返回:
- A new builder instance
-
handleInterrupt
protected reactor.core.publisher.Mono<Msg> handleInterrupt(InterruptContext context, Msg... originalArgs) 已过时, 待删除: 此 API 元素将从以后的版本中删除。Handle interrupt scenarios. For UserAgent, interrupts simply return an interrupted message.- 指定者:
handleInterrupt在类中AgentBase- 参数:
context- The interrupt context containing metadata about the interruptionoriginalArgs- The original arguments passed to the call() method- 返回:
- Mono containing an interrupt message
-