AS AgentScopeAPI 手册 / API Reference

StreamUserInput

@Deprecated(forRemoval = true, since = "2.0.0") public class StreamUserInput implements UserInputBase
源码Source io/agentscope/core/agent/user/StreamUserInput.java:55–256

流用户输入,驱动智能体的推理、工具调用与会话执行。位于 io.agentscope.core.agent.user 包,实现 UserInputBase。核心成员包括 builder、handleInput。

Stream-based user input implementation that reads from any InputStream and writes to any OutputStream. By default, uses System.in and System.out for console interaction.

Supports both simple text input and structured data input via key=value pairs. Blocking I/O operations are executed on the bounded elastic scheduler to maintain reactive compatibility.

Usage examples:

`// Default console input/output
StreamUserInput consoleInput = StreamUserInput.builder().build();

// Custom streams (e.g., for testing)
StreamUserInput customInput = StreamUserInput.builder()
.inputStream(myInputStream)
.outputStream(myOutputStream)
.inputHint("Enter: ")
.build();
`

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
Builder类class
StreamUserInput的构建器。
Builder for StreamUserInput.

方法摘要Method Summary

方法Method说明Description
public static Builder builder()
static
创建用于StreamUserInput的构建器。
Create a new builder for StreamUserInput.
public Mono<UserInputData> handleInput(String agentId, String agentName, List<Msg> contextMessages, Class<?> structuredModel)
处理输入。
Handle user input from the configured input stream.

方法详情Method Detail

builder

public static Builder builder()
static

创建用于StreamUserInput的构建器。

Create a new builder for StreamUserInput.

返回Returns Builder
一种新的构建器实例。A new builder instance
源码Source io/agentscope/core/agent/user/StreamUserInput.java:78–80

handleInput

public Mono<UserInputData> handleInput(String agentId, String agentName, List<Msg> contextMessages, Class<?> structuredModel)

处理输入。

Handle user input from the configured input stream.

参数Parameters
名称Name类型Type说明Description
agentIdString智能体标识(类型 `String`)。The agent identifier (unused in this implementation)
agentNameString智能体名称(类型 `String`)。The agent name (unused in this implementation)
contextMessagesList<Msg>上下文消息(类型 `List`)。Optional messages to display before prompting (e.g., assistant response)
structuredModelClass<?>用于结构化输入格式的可选类。Optional class for structured input format
返回Returns Mono<UserInputData>
返回Mono。Mono containing the user input data
源码Source io/agentscope/core/agent/user/StreamUserInput.java:95–132

嵌套类详情Nested Class Detail

Builder

public static class Builder

StreamUserInput的构建器。位于 io.agentscope.core.agent.user 包。核心成员包括 inputHint、inputStream、outputStream、build。

Builder for StreamUserInput.

Provides fluent API for configuring input/output streams and prompt hint. Defaults to System.in/System.out if not specified.

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