Repository navigation
Description
Describe the bug
ReActAgent provides per-session interrupt methods that are essential for the stateless (singleton) agent pattern introduced in 2.0:
interrupt(RuntimeContext ctx)interrupt(String userId, String sessionId)interrupt(String userId, String sessionId, Msg msg)
However, HarnessAgent only overrides the deprecated no-arg interrupt() and interrupt(Msg), which fall back to defaultSessionId. In a multi-session singleton deployment, calling interrupt() on a shared HarnessAgent cannot target a specific session — it always hits the default session, leaving other concurrent sessions unaffected when they should be interrupted.
To Reproduce
- Build a singleton
HarnessAgent(nodefaultSessionIdset):
HarnessAgent agent = HarnessAgent.builder()
.name("my-agent")
.model(model)
.stateStore(new MysqlAgentStateStore(dataSource))
.build();- Start concurrent calls with different
RuntimeContext:
agent.streamEvents(msgs, RuntimeContext.builder()
.userId("user-1").sessionId("session-A").build());
agent.streamEvents(msgs, RuntimeContext.builder()
.userId("user-2").sessionId("session-B").build());- Try to interrupt only session-A:
agent.interrupt("user-1", "session-A"); // compile error: method not found- Workaround via
getDelegate():
agent.getDelegate().interrupt("user-1", "session-A"); // works but leaks internalsExpected behavior
HarnessAgent should forward the per-session interrupt methods to its ReActAgent delegate, consistent with how it already forwards interrupt() and interrupt(Msg):
public void interrupt(RuntimeContext ctx) {
delegate.interrupt(ctx);
}
public void interrupt(String userId, String sessionId) {
delegate.interrupt(userId, sessionId);
}
public void interrupt(String userId, String sessionId, Msg msg) {
delegate.interrupt(userId, sessionId, msg);
}Environment
- AgentScope-Java Version: 2.0.0-RC2
- Java Version: 21
- OS: Windows 11
Additional context
The HarnessAgent.getDelegate() method exists as a workaround, but requiring users to reach through the wrapper defeats the purpose of the facade. Since 2.0 explicitly promotes the stateless singleton pattern, per-session interrupt is a core capability that HarnessAgent should expose.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsIn progress
Activity
yulindong commentedon Jun 29, 2026
We've encountered the same issue. Should we abstract these methods into an interface?