Files
tw2/examples/functionality/session_with_sqlite/README.md
codex-bot a64378956a
Some checks failed
Pre-commit / run (ubuntu-latest) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_en (ubuntu-latest, 3.10) (push) Has been cancelled
Deploy Sphinx documentation to Pages / build_zh (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (macos-15, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (ubuntu-latest, 3.12) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.10) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.11) (push) Has been cancelled
Python Unittest Coverage / test (windows-latest, 3.12) (push) Has been cancelled
chore: initialize sandbox and overwrite remote content
2026-03-02 22:32:27 +08:00

25 lines
831 B
Markdown

# Session Management with Sqlite DB
This example demonstrates how to implement session management with a database backend. We use SQLite for simplicity,
but the approach can be adapted for other databases.
Specifically, we implement a ``SqliteSession`` class that persists and retrieves session data from a SQLite table.
The table schema includes fields for session ID, session data (stored as JSON), and timestamps for creation and last
update.
We will create a simple agent and chat with it, then store the session data in the SQLite database. Then in the
``test_load_session`` function, we will load the session data from the database and continue the chat.
## Quick Start
Install agentscope from Pypi or source code.
```bash
pip install agentscope
```
Run the example by the following command
```bash
python main.py
```