feat(hook): add summary phase hook support for ReActAgent#577
Merged
chickenlj merged 3 commits intoagentscope-ai:mainfrom Jan 16, 2026
Merged
feat(hook): add summary phase hook support for ReActAgent#577chickenlj merged 3 commits intoagentscope-ai:mainfrom
chickenlj merged 3 commits intoagentscope-ai:mainfrom
Conversation
Change-Id: I84319b0c1ad175adf9137b1e1552baaad53944b3
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds summary phase hook support for ReActAgent, enabling monitoring and modification of summary generation when max iterations are reached. The implementation follows the existing hook patterns for reasoning and acting phases.
Changes:
- Introduces three new event classes for summary phase hooks:
PreSummaryEvent,SummaryChunkEvent, andPostSummaryEvent - Integrates summary hooks into ReActAgent's
summarizing()method with notification points for pre/post/chunk events - Extends StreamOptions to control summary chunk and result emissions for streaming use cases
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| SummaryEvent.java | Base sealed class for summary-related events with model name and generation options context |
| PreSummaryEvent.java | Event fired before summary generation, allowing modification of input messages and generation options |
| SummaryChunkEvent.java | Event fired during summary streaming with incremental and accumulated chunk information |
| PostSummaryEvent.java | Event fired after summary generation, allowing modification of summary message and stop requests |
| HookEventType.java | Adds three new event types: PRE_SUMMARY, POST_SUMMARY, SUMMARY_CHUNK |
| HookEvent.java | Updates sealed permits clause to include SummaryEvent |
| StreamingHook.java | Adds handling for PostSummaryEvent and SummaryChunkEvent in streaming context |
| StreamOptions.java | Adds includeSummaryChunk and includeSummaryResult flags with corresponding builder methods |
| ReActAgent.java | Refactors summarizing() method to notify hooks and adds helper methods for summary hook notifications |
| SummaryEventTest.java | Comprehensive unit tests for all three summary event classes |
Comments suppressed due to low confidence (1)
agentscope-core/src/main/java/io/agentscope/core/ReActAgent.java:854
- This method needs a Javadoc comment explaining its purpose and parameters, particularly how it handles different content block types.
private Mono<Void> notifySummaryChunk(
Msg chunkMsg, ReasoningContext context, GenerateOptions generateOptions) {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
agentscope-core/src/main/java/io/agentscope/core/ReActAgent.java
Outdated
Show resolved
Hide resolved
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Change-Id: I84547e00614ea91cd4a76034877a173212f73b1f
Alexxigang
pushed a commit
to Alexxigang/agentscope-java
that referenced
this pull request
Jan 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change-Id: I84319b0c1ad175adf9137b1e1552baaad53944b3
AgentScope-Java Version
[The version of AgentScope-Java you are working on, e.g. 1.0.7, check your pom.xml dependency version or run
mvn dependency:tree | grep agentscope-parent:pom(only mac/linux)]Description
[Please describe the background, purpose, changes made, and how to test this PR]
Checklist
Please check the following items before code is ready to be reviewed.
mvn spotless:applymvn test)