StreamOptions
public class StreamOptions
io/agentscope/core/agent/StreamOptions.java:62–370用于Agent#streamAPI的配置选项。位于 io.agentscope.core.agent 包。核心成员包括 defaults、builder、getEventTypes、isIncremental、isIncludeReasoningChunk、isIncludeReasoningResult。
Configuration options for the Agent#stream API.
Controls which event types to receive and how streaming content is delivered.
Reasoning filtering (Issue #265): Some streaming stores emit both:
-
Reasoning chunks: incremental deltas during the reasoning process
-
Reasoning result: the final consolidated reasoning output
Use #isIncludeReasoningChunk() and #isIncludeReasoningResult() to filter
these reasoning-related emissions when EventType#REASONING is enabled.
Example usage:
`// Only reasoning events, incremental mode
StreamOptions options = StreamOptions.builder()
.eventTypes(EventType.REASONING)
.incremental(true)
.build();
// Reasoning events, but hide intermediate deltas and only keep the final reasoning result
StreamOptions options = StreamOptions.builder()
.eventTypes(EventType.REASONING)
.includeReasoningChunk(false)
.includeReasoningResult(true)
.incremental(true)
.build();
// Multiple specific types
StreamOptions options = StreamOptions.builder()
.eventTypes(EventType.REASONING, EventType.TOOL_RESULT)
.incremental(true)
.build();
`
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Builder | 类class | `StreamOptions`的构建器。 Builder for `StreamOptions`. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public static StreamOptions defaults()static | 返回 `defaults` 结果。 Default options: All event types, incremental mode, include both reasoning chunk and reasoning result. |
public static Builder builder()static | 创建新的构建器用于 StreamOptions。 Creates a new builder for StreamOptions. |
public Set<EventType> getEventTypes() | 获取事件类型。 Get the set of event types that should be streamed. |
public boolean isIncremental() | 判断是否 `isIncremental`。 Check if incremental mode is enabled. |
public boolean isIncludeReasoningChunk() | 判断是否 `isIncludeReasoningChunk`。 Whether reasoning "chunk" emissions should be included. |
public boolean isIncludeReasoningResult() | 判断是否 `isIncludeReasoningResult`。 Whether the final reasoning result should be included. |
public boolean isIncludeActingChunk() | 判断是否 `isIncludeActingChunk`。 Whether acting (tool execution) chunk emissions should be included. |
public boolean isIncludeSummaryChunk() | 判断是否 `isIncludeSummaryChunk`。 Whether summary chunk emissions should be included. |
public boolean isIncludeSummaryResult() | 判断是否 `isIncludeSummaryResult`。 Whether the final summary result should be included. |
public boolean shouldStream(EventType type) | 设置应当流。 Check if a specific event type should be streamed. |
public boolean shouldIncludeReasoningEmission(boolean isChunk) | 设置该参数。 Convenience method for stream implementations to decide whether to emit a reasoning subtype. |
public boolean shouldIncludeSummaryEmission(boolean isChunk) | 设置该参数。 Convenience method for stream implementations to decide whether to emit a summary subtype. |
方法详情Method Detail
defaults
public static StreamOptions defaults()
返回 defaults 结果。
Default options: All event types, incremental mode, include both reasoning chunk and reasoning result.
StreamOptionsio/agentscope/core/agent/StreamOptions.java:127–129builder
public static Builder builder()
创建新的构建器用于 StreamOptions。
Creates a new builder for StreamOptions.
Builderio/agentscope/core/agent/StreamOptions.java:136–138getEventTypes
public Set<EventType> getEventTypes()
获取事件类型。
Get the set of event types that should be streamed.
Set<EventType>io/agentscope/core/agent/StreamOptions.java:147–149isIncremental
public boolean isIncremental()
判断是否 isIncremental。
Check if incremental mode is enabled.
booleanio/agentscope/core/agent/StreamOptions.java:159–161isIncludeReasoningChunk
public boolean isIncludeReasoningChunk()
判断是否 isIncludeReasoningChunk。
Whether reasoning "chunk" emissions should be included.
booleanio/agentscope/core/agent/StreamOptions.java:170–172isIncludeReasoningResult
public boolean isIncludeReasoningResult()
判断是否 isIncludeReasoningResult。
Whether the final reasoning result should be included.
booleanio/agentscope/core/agent/StreamOptions.java:181–183isIncludeActingChunk
public boolean isIncludeActingChunk()
判断是否 isIncludeActingChunk。
Whether acting (tool execution) chunk emissions should be included.
booleanio/agentscope/core/agent/StreamOptions.java:192–194isIncludeSummaryChunk
public boolean isIncludeSummaryChunk()
判断是否 isIncludeSummaryChunk。
Whether summary chunk emissions should be included.
booleanio/agentscope/core/agent/StreamOptions.java:204–206isIncludeSummaryResult
public boolean isIncludeSummaryResult()
判断是否 isIncludeSummaryResult。
Whether the final summary result should be included.
booleanio/agentscope/core/agent/StreamOptions.java:216–218shouldStream
public boolean shouldStream(EventType type)
设置应当流。
Check if a specific event type should be streamed.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
type | EventType | 事件类型到检查。The event type to check |
booleanio/agentscope/core/agent/StreamOptions.java:226–228shouldIncludeReasoningEmission
public boolean shouldIncludeReasoningEmission(boolean isChunk)
设置该参数。
Convenience method for stream implementations to decide whether to emit a reasoning subtype.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
isChunk | boolean | 是分块(类型 `boolean`)。true if the reasoning emission is an incremental chunk, false if it is the final result |
booleanio/agentscope/core/agent/StreamOptions.java:239–241shouldIncludeSummaryEmission
public boolean shouldIncludeSummaryEmission(boolean isChunk)
设置该参数。
Convenience method for stream implementations to decide whether to emit a summary subtype.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
isChunk | boolean | 是分块(类型 `boolean`)。true if the summary emission is an incremental chunk, false if it is the final result |
booleanio/agentscope/core/agent/StreamOptions.java:249–251嵌套类详情Nested Class Detail
Builder
public static class BuilderStreamOptions的构建器。位于 io.agentscope.core.agent 包。核心成员包括 eventTypes、incremental、includeReasoningChunk、includeReasoningResult、includeActingChunk、includeSummaryChunk。
Builder for StreamOptions.