feat(AutoContextMemory): optimize current round msg compress#182
Merged
AlbumenJ merged 1 commit intoagentscope-ai:mainfrom Dec 11, 2025
Merged
Conversation
此提交为 `AutoContextMemory` 添加了新的消息分类方法,并优化了压缩提示文本的格式。新添加的方法用于判断消息是否与工具调用相关,以及是否是最终响应给用户的助手消息。同时更新了压缩提示文本的格式,使其更加详细和易于理解。 Change-Id: I035493bc5ee0322c1584f32dd54ecf3bc9a25ab1 Co-developed-by: Aone Copilot <noreply@alibaba-inc.com>
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
AlbumenJ
approved these changes
Dec 11, 2025
JGoP-L
pushed a commit
to JGoP-L/agentscope-java
that referenced
this pull request
Dec 29, 2025
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.
This pull request introduces several enhancements and improvements to the auto-context memory system and file tool capabilities. The most significant changes include adding a new directory listing tool, expanding message classification utilities for tool-related messages, refining prompt templates for message compression, and improving session management and persistence in the advanced example. Additionally, minor test code updates ensure consistency with refactored method names.
File Tool Enhancements
list_directorytool toReadFileToolthat lists all files and directories in a specified path, with robust error handling and formatted output. [1] [2]Auto-Context Memory Utilities
MsgUtilsto classify messages as tool-related, tool use, tool result, and final assistant responses, improving message handling and compression logic.Prompt and Compression Improvements
Promptsto support more granular and context-aware message compression for both current round tool messages and large messages, including new format strings and hints for offloaded content. [1] [2]Session Management and Persistence
AutoMemoryExample.java) to use a persistent session manager with JSON-based session storage, ensuring session state is saved and restored across runs. Also updated auto-context configuration for improved token management. [1] [2] [3] [4] [5]Test Code Consistency
getOriginalMemoryMsgs()method name for accessing original message storage, reflecting recent refactoring. [1] [2] [3] [4] [5]此提交为AutoContextMemory添加了新的消息分类方法,并优化了压缩提示文本的格式。新添加的方法用于判断消息是否与工具调用相关,以及是否是最终响应给用户的助手消息。同时更新了压缩提示文本的格式,使其更加详细和易于理解。Change-Id: I035493bc5ee0322c1584f32dd54ecf3bc9a25ab1
Co-developed-by: Aone Copilot noreply@alibaba-inc.com
AgentScope-Java Version
[The version of AgentScope-Java you are working on, e.g. 1.0.1, 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)