From 0ea0c3b65c36bc9f41a7428387a7512ac88e3b37 Mon Sep 17 00:00:00 2001
From: guslegend <1670547022@qq.com>
Date: Sat, 30 May 2026 09:20:16 +0800
Subject: [PATCH 1/3] docs(agent): clarify AGENT_RESULT stream default
---
.../src/main/java/io/agentscope/core/agent/EventType.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/agentscope-core/src/main/java/io/agentscope/core/agent/EventType.java b/agentscope-core/src/main/java/io/agentscope/core/agent/EventType.java
index 431ef16518..75a1af5476 100644
--- a/agentscope-core/src/main/java/io/agentscope/core/agent/EventType.java
+++ b/agentscope-core/src/main/java/io/agentscope/core/agent/EventType.java
@@ -67,7 +67,10 @@ public enum EventType {
* Final result event - The agent's complete response.
*
*
This is the message returned by {@link Agent#call(io.agentscope.core.message.Msg)}.
- * By default, this event is NOT included in the stream to avoid duplication since it's the return value.
+ * In streaming APIs, this event is emitted whenever {@link StreamOptions} includes
+ * {@link #AGENT_RESULT} explicitly or uses {@link #ALL}. Since the default
+ * {@link StreamOptions} configuration uses {@link #ALL}, {@code AGENT_RESULT} is streamed
+ * by default.
*
*
Characteristics:
*
From 2084520489c3b9541c1f49b241fa707e5bd9991c Mon Sep 17 00:00:00 2001
From: guslegend <1670547022@qq.com>
Date: Wed, 10 Jun 2026 15:43:14 +0800
Subject: [PATCH 2/3] docs(agent): align EventType streaming javadocs
---
.../src/main/java/io/agentscope/core/agent/EventType.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/agentscope-core/src/main/java/io/agentscope/core/agent/EventType.java b/agentscope-core/src/main/java/io/agentscope/core/agent/EventType.java
index 75a1af5476..3810866168 100644
--- a/agentscope-core/src/main/java/io/agentscope/core/agent/EventType.java
+++ b/agentscope-core/src/main/java/io/agentscope/core/agent/EventType.java
@@ -76,7 +76,8 @@ public enum EventType {
*
* - Message role: {@link io.agentscope.core.message.MsgRole#ASSISTANT}
* - Content: Final response text
- * - Streaming: Not applicable
+ * - Streaming: Included when {@link StreamOptions} contains {@link #AGENT_RESULT}
+ * or {@link #ALL} (the default)
*
*/
AGENT_RESULT,
@@ -94,7 +95,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}.
*
* Use this in {@link StreamOptions} to receive all events without filtering.
*/
From 7fa55a4d1aaca9f7f7593f2827d9f211b558d381 Mon Sep 17 00:00:00 2001
From: guslegend <1670547022@qq.com>
Date: Thu, 11 Jun 2026 17:52:14 +0800
Subject: [PATCH 3/3] docs: align streaming docs with ALL semantics
---
.../core/agent/AgentStreamingTest.java | 23 +++++++++++++++++++
docs/v1/en/docs/task/streaming.md | 6 ++---
docs/v1/zh/docs/task/streaming.md | 6 ++---
3 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/agentscope-core/src/test/java/io/agentscope/core/agent/AgentStreamingTest.java b/agentscope-core/src/test/java/io/agentscope/core/agent/AgentStreamingTest.java
index 79e90657b4..e8327197fd 100644
--- a/agentscope-core/src/test/java/io/agentscope/core/agent/AgentStreamingTest.java
+++ b/agentscope-core/src/test/java/io/agentscope/core/agent/AgentStreamingTest.java
@@ -114,6 +114,29 @@ void testStreamWithIncludeAgentResult() {
assertNotNull(lastEvent.getMessage());
}
+ @Test
+ void testStreamWithAllIncludesAgentResult() {
+ TestStreamingAgent agent = new TestStreamingAgent("test-agent");
+ agent.setResponseText("Response");
+
+ Msg inputMsg =
+ Msg.builder()
+ .name("user")
+ .role(MsgRole.USER)
+ .content(List.of(TextBlock.builder().text("Test").build()))
+ .build();
+
+ StreamOptions options = StreamOptions.builder().eventTypes(EventType.ALL).build();
+
+ List events = new ArrayList<>();
+ agent.stream(inputMsg, options).doOnNext(events::add).blockLast();
+
+ assertFalse(events.isEmpty());
+ Event lastEvent = events.get(events.size() - 1);
+ assertEquals(EventType.AGENT_RESULT, lastEvent.getType());
+ assertTrue(lastEvent.isLast());
+ }
+
@Test
void testStreamWithSpecificEventTypes() {
TestStreamingAgent agent = new TestStreamingAgent("test-agent");
diff --git a/docs/v1/en/docs/task/streaming.md b/docs/v1/en/docs/task/streaming.md
index 3931b702de..d30c33757f 100644
--- a/docs/v1/en/docs/task/streaming.md
+++ b/docs/v1/en/docs/task/streaming.md
@@ -43,8 +43,8 @@ Flux 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
@@ -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
diff --git a/docs/v1/zh/docs/task/streaming.md b/docs/v1/zh/docs/task/streaming.md
index aa23d71b94..686770eeb7 100644
--- a/docs/v1/zh/docs/task/streaming.md
+++ b/docs/v1/zh/docs/task/streaming.md
@@ -43,8 +43,8 @@ Flux 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` | 占位符,代表全部事件类型 | - |
### 只订阅指定类型
@@ -151,7 +151,7 @@ public Flux> chat(@RequestParam String message) {
```java
StreamOptions options = StreamOptions.builder()
- // 订阅的事件类型(默认 ALL,不含 AGENT_RESULT)
+ // 订阅的事件类型(默认 ALL)
.eventTypes(EventType.REASONING, EventType.TOOL_RESULT, EventType.AGENT_RESULT)
// 增量模式(默认 true)