Skip to content

Conversation

@DavdGao
Copy link
Member

@DavdGao DavdGao commented Sep 15, 2025

AgentScope Version

1.0.2

Description

  • Remove the argument session_id, so that one JSONSession object can handle multiple sessions
  • Modify the example accordingly

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has been formatted with pre-commit run --all-files command
  • All tests are passing
  • Docstrings are in Google style
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

@DavdGao DavdGao requested a review from Copilot September 15, 2025 14:24
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the session management system to support multiple sessions by removing the session_id parameter from the constructor and moving it to the method level. This allows a single session object to handle different session IDs dynamically.

  • Remove session_id from session constructors and move it to save_session_state and load_session_state methods
  • Add deprecation warning for backward compatibility when session_id is still passed to constructor
  • Update method signatures to include session_id and allow_not_exist parameters with proper error handling

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/agentscope/session/_session_base.py Updated base class to remove session_id from constructor and add it to method signatures
src/agentscope/session/_json_session.py Refactored JSONSession to support dynamic session IDs with deprecation warning
examples/functionality/session_with_sqlite/sqlite_session.py Updated SqliteSession implementation to match new interface
examples/functionality/session_with_sqlite/main.py Modified example to demonstrate multi-user session handling
tests/session_test.py Updated test to use new session_id parameter in method call
docs/tutorial/zh_CN/src/task_state.py Updated Chinese documentation example
docs/tutorial/en/src/task_state.py Updated English documentation example

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@DavdGao DavdGao merged commit 922c64b into agentscope-ai:main Sep 16, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant