Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public enum EventType {
SUMMARY,

/**
* Special value to stream all event types (except {@link #AGENT_RESULT}).
* Special value to stream all event types, including {@link #AGENT_RESULT}.
*
* <p>Use this in {@link StreamOptions} to receive all events without filtering.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ public static Builder builder() {
/**
* Get the set of event types that should be streamed.
*
* <p>If the set contains {@link EventType#ALL}, all event types will be streamed.
* <p>If the set contains {@link EventType#ALL}, all event types will be streamed,
* including {@link EventType#AGENT_RESULT}.
*
* @return The set of event types to stream
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ void testBuilderAllEventTypes() {
assertTrue(options.shouldStream(EventType.AGENT_RESULT));
}

@Test
void testAllMeansAllIncludingAgentResult() {
StreamOptions options = StreamOptions.builder().eventTypes(EventType.ALL).build();

assertTrue(options.shouldStream(EventType.AGENT_RESULT));
}

@Test
void testBuilderIncrementalMode() {
// Test incremental mode (true)
Expand Down
6 changes: 3 additions & 3 deletions docs/en/task/streaming.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ Flux<Event> events = agent.stream(msgs, StreamOptions.defaults(), ctx);
| `TOOL_RESULT` | After each tool execution | `ToolResultBlock` (tool name, id, output) |
| `HINT` | After RAG / memory retrieval | Context text injected into the model |
| `SUMMARY` | When `maxIters` is reached | Iteration summary text |
| `AGENT_RESULT` | Final reply ready | Same as `call()` return value; **not included** in stream by default |
| `ALL` | Placeholder for all the above (except `AGENT_RESULT`) | — |
| `AGENT_RESULT` | Final reply ready | Same as `call()` return value |
| `ALL` | Placeholder for all event types | - |

### Subscribe to specific types only

Expand Down Expand Up @@ -153,7 +153,7 @@ serialize `event.getSource()` as well — see [Harness Subagent Streaming](../ha

```java
StreamOptions options = StreamOptions.builder()
// Event types to receive (default: ALL, excluding AGENT_RESULT)
// Event types to receive (default: ALL)
.eventTypes(EventType.REASONING, EventType.TOOL_RESULT, EventType.AGENT_RESULT)

// Incremental mode: true = push deltas (default), false = push full accumulated text
Expand Down
6 changes: 3 additions & 3 deletions docs/zh/task/streaming.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ Flux<Event> events = agent.stream(msgs, StreamOptions.defaults(), ctx);
| `TOOL_RESULT` | 每次工具执行完毕后 | `ToolResultBlock`(含工具名、id、输出) |
| `HINT` | RAG / 记忆检索注入后 | 注入模型的上下文文本 |
| `SUMMARY` | 达到 `maxIters` 上限时 | 迭代摘要文本 |
| `AGENT_RESULT` | 最终回复就绪 | 与 `call()` 返回值相同,默认**不在**流中 |
| `ALL` | 占位符,代表全部(不含 `AGENT_RESULT`) | — |
| `AGENT_RESULT` | 最终回复就绪 | 与 `call()` 返回值相同 |
| `ALL` | 占位符,代表全部事件类型 | - |

### 只订阅指定类型

Expand Down Expand Up @@ -151,7 +151,7 @@ public Flux<ServerSentEvent<String>> chat(@RequestParam String message) {

```java
StreamOptions options = StreamOptions.builder()
// 订阅的事件类型(默认 ALL,不含 AGENT_RESULT
// 订阅的事件类型(默认 ALL)
.eventTypes(EventType.REASONING, EventType.TOOL_RESULT, EventType.AGENT_RESULT)

// 增量模式(默认 true)
Expand Down
Loading