Skip to content

Does AgentScope Java support pause and resume for an in-flight ReActAgent streaming run? #1390

@KKJava1

Description

@KKJava1

Hi AgentScope Java team,

I am using io.agentscope:agentscope:1.0.11 in a Spring Boot application with a web chat UI.

Current flow:

  • The frontend starts a streaming chat request through SSE.
  • The backend runs ReActAgent.call(...).block() in a background Reactor thread.
  • We use hooks such as ReasoningChunkEvent and SummaryChunkEvent to stream reasoning and answer chunks back to the browser.
  • We already use event.stopAgent() in a hook for human confirmation before sensitive tool execution. After the user confirms, we can call agent.call().block() to
    continue from that checkpoint.

Now I want to implement a frontend button with this behavior:

  1. User clicks “Pause generating” while the agent is reasoning or streaming.
  2. The current generation should pause.
  3. No more chunks should be sent to the frontend while paused.
  4. Later, user clicks “Resume generating”.
  5. The same agent run should continue from where it paused, instead of starting a new user turn or regenerating from scratch.
  6. Session/memory should remain consistent.

Questions:

  1. Does AgentScope Java provide an official pause/resume mechanism for an in-flight ReActAgent.call()?
  2. Is event.stopAgent() intended only for stopping at hook checkpoints, or can it be used as a general pause checkpoint?
  3. After event.stopAgent() is triggered by a custom pause hook, is calling agent.call().block() the correct way to resume the same run?
  4. Can AgentScope pause in the middle of model streaming, or only between framework events such as PostReasoningEvent, PreActingEvent, and tool execution
    boundaries?
  5. If true pause/resume is not supported, what is the recommended pattern for a web UI pause button?
    • Should the backend keep the model run active and buffer chunks while the frontend is paused?
    • Or should the app implement checkpoint-style pause through a custom Hook and resume through session state?

A simplified version of our backend flow:

Mono.fromCallable(() -> {
    ChatTurnResult result = powerTradingAgent.chatDetailed(
        conversationId,
        userMessage,
        streamingHookContext
    );

    return result.finalText();
})
.subscribeOn(Schedulers.boundedElastic())
.subscribe(...);

And our existing checkpoint logic uses:

event.stopAgent();

Then later resumes with:

agent.call().block();

I would like to know the recommended AgentScope Java design for user-driven pause and resume in a streaming web chat UI.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions