feat(core): Expose ReActAgent state-cache cleanup APIs - #2572
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR exposes explicit APIs to clear ReActAgent’s in-memory per-session caches (agent state + permission engine), and wires that functionality through HarnessAgent so callers can release cached session data without affecting persisted AgentStateStore contents.
Changes:
- Added
ReActAgent.clearStateCache(...)overloads to clear all cached slots or a targeted(userId, sessionId)slot. - Added
HarnessAgent.clearStateCache(...)passthrough methods delegating to the wrappedReActAgent. - Added unit tests validating targeted/all-cache clearing and verifying persisted state remains intact after cache eviction.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| agentscope-harness/src/test/java/io/agentscope/harness/agent/HarnessAgentTest.java | Adds a harness-level test ensuring HarnessAgent.clearStateCache(ctx) evicts only the targeted delegate session cache. |
| agentscope-harness/src/main/java/io/agentscope/harness/agent/HarnessAgent.java | Exposes clearStateCache overloads on HarnessAgent by delegating to the wrapped ReActAgent. |
| agentscope-core/src/test/java/io/agentscope/core/agent/ReActAgentPerSessionStateTest.java | Adds coverage for clearing all caches, clearing a single session cache, and preserving persisted state after cache eviction. |
| agentscope-core/src/main/java/io/agentscope/core/ReActAgent.java | Implements cache-eviction APIs for per-session AgentState and permission engine caches; clears caches on close(). |
jujn
force-pushed
the
reactagent-state-cache-cleanup-api
branch
from
August 5, 2026 13:32
06302cf to
0b277b9
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This was referenced Aug 6, 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.
No description provided.