Skip to content

[Feature]: Agui mode does not expose sessionId during agent execution, preventing saveTo / session persistence #751

Closed

Description

@realreus319

Title

Agui mode does not expose sessionId during agent execution, preventing saveTo / session persistence

Is your feature request related to a problem? Please describe.

In Agui mode, we need to persist agent conversation state (e.g. messages / memory) using the existing AgentScope session mechanism.

However, during the agent execution lifecycle in Agui, there is currently no way to obtain the sessionId (or SessionKey / threadId) required for agent.saveTo(...) or other session persistence operations.

Although it is possible to access the Agent instance from certain hooks, the lack of session context makes it impossible to correctly save or restore conversation history.

This prevents message persistence and session-based state recovery when running agents through Agui.

Describe the solution you'd like

We would like Agui to expose or propagate the session context during agent execution, for example:

  • Provide access to sessionId / threadId / SessionKey in Agui hooks
  • Or offer an official extension point in Agui to perform session persistence (e.g. saveTo)
  • Or pass session-related metadata together with the Agent instance during execution

This would allow Agui-based executions to integrate cleanly with AgentScope’s existing Session / Memory persistence mechanisms.

Describe alternatives you've considered

  • Triggering saveTo manually inside hooks using the Agent instance
    → Not feasible because sessionId is not available

  • Managing a separate persistence mechanism outside of AgentScope
    → Causes duplication and breaks consistency with the existing Session design

Additional context

Currently, message saving and loading works correctly when using AgentScope directly, but not when running agents through Agui.

Supporting session persistence in Agui would enable:

  • Multi-turn conversation continuity
  • Proper memory loading and saving
  • Better alignment between Agui and AgentScope core session behavior

Activity

  1. added
    enhancement
    on Feb 6, 2026
  2. m13v commented on Apr 5, 2026

    @m13v

    session persistence for agents is trickier than it sounds because the agent's state includes more than just messages and memory. if the agent interacts with any visual interface, the screen state at each turn is part of the session context that gets lost on restart. we solved this by recording video chunks tagged with session IDs, so when you restore a session you can also restore what the agent was seeing. for Agui mode specifically, exposing the sessionId in the execution lifecycle would let external observers (like a recording service) tag their captures correctly. the saveTo mechanism could include a hook for external state providers, not just the built-in message history.

  3. m13v commented on Apr 5, 2026

    @m13v
  4. added
    area/ext/integration
    on May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/ext/integrationenhancement

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions