Skip to content

feat(hook): add summary phase hook support for ReActAgent#577

Merged
chickenlj merged 3 commits intoagentscope-ai:mainfrom
AlbumenJ:0115-summary
Jan 16, 2026
Merged

feat(hook): add summary phase hook support for ReActAgent#577
chickenlj merged 3 commits intoagentscope-ai:mainfrom
AlbumenJ:0115-summary

Conversation

@AlbumenJ
Copy link
Collaborator

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.

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

Change-Id: I84319b0c1ad175adf9137b1e1552baaad53944b3
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and PostSummaryEvent
  • 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.

@codecov
Copy link

codecov bot commented Jan 15, 2026

AlbumenJ and others added 2 commits January 16, 2026 09:51
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Change-Id: I84547e00614ea91cd4a76034877a173212f73b1f
Copy link
Collaborator

@chickenlj chickenlj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@chickenlj chickenlj merged commit 651aa29 into agentscope-ai:main Jan 16, 2026
5 checks passed
Alexxigang pushed a commit to Alexxigang/agentscope-java that referenced this pull request Jan 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants