AWS Strands Agents session persistence backed by PerSQL — durable sessions, agents, and messages in an isolated SQLite database per agent.
Project description
strands-persql
AWS Strands Agents session persistence backed by PerSQL — durable sessions, agents, and messages in an isolated SQLite database per agent, provisioned instantly.
pip install strands-persql
Usage
import os
from strands import Agent
from persql import PerSQL
from strands_persql import PerSQLSessionManager
client = PerSQL(token=os.environ["PERSQL_TOKEN"])
manager = PerSQLSessionManager("user-42", client.database("acme/agent-state"))
agent = Agent(session_manager=manager)
agent("hi") # history and state persist across restarts
Or let the manager own the client:
manager = PerSQLSessionManager.from_token("user-42", os.environ["PERSQL_TOKEN"], "acme/agent-state")
PerSQLSessionRepository is also exported for use with
RepositorySessionManager or your own manager.
What it stores
The same data model as FileSessionManager, with tables instead of
directories — one row per session (strands_sessions), per agent
(strands_agents), and per message (strands_messages), each holding
the dataclass's JSON. Multi-agent (Graph/Swarm) state goes to
strands_multi_agents. Pass table_prefix= to change the strands_
prefix.
Limits
- The repository contract is synchronous, so calls block on HTTP to your PerSQL database (or run in-process in local mode).
update_agent/update_messageare read-then-write (to preservecreated_at), not atomic over HTTP. Keep one writer per session — the same assumption Strands' file and S3 managers make.- Requires
strands-agents >= 1.42, < 2— the package subclassesSessionRepository, so a framework major version can change the contract.
Local mode for tests
from persql import PerSQL
manager = PerSQLSessionManager("t", PerSQL(local=":memory:").database("test/db"))
Runs against in-process SQLite — no network, no token.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file strands_persql-0.1.0.tar.gz.
File metadata
- Download URL: strands_persql-0.1.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d798dbe2b6dfaefd873445bb6c400a7bfd6f9432ad777a15fec58446f32bd0a
|
|
| MD5 |
345e3e6260446b959ef209c364c2b1d8
|
|
| BLAKE2b-256 |
6f52727d5074a6252129d9ed505bfd72f5f49e9949f981759e3d67049eaa4c4e
|
Provenance
The following attestation bundles were made for strands_persql-0.1.0.tar.gz:
Publisher:
python-release-strands.yml on persql/persql
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
strands_persql-0.1.0.tar.gz -
Subject digest:
3d798dbe2b6dfaefd873445bb6c400a7bfd6f9432ad777a15fec58446f32bd0a - Sigstore transparency entry: 1806532601
- Sigstore integration time:
-
Permalink:
persql/persql@2224964164159f280e81ba65880d1981b7e77164 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/persql
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release-strands.yml@2224964164159f280e81ba65880d1981b7e77164 -
Trigger Event:
push
-
Statement type:
File details
Details for the file strands_persql-0.1.0-py3-none-any.whl.
File metadata
- Download URL: strands_persql-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07e2a0e6286280466ae97924b75695d67579498c6aa45ffca1e3364da41c52f7
|
|
| MD5 |
297e9c4261661bf7a512116959fb6ec3
|
|
| BLAKE2b-256 |
3716237ee43b4905392627688d1c00a60704c586e85f83f00af4627bd640bf5f
|
Provenance
The following attestation bundles were made for strands_persql-0.1.0-py3-none-any.whl:
Publisher:
python-release-strands.yml on persql/persql
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
strands_persql-0.1.0-py3-none-any.whl -
Subject digest:
07e2a0e6286280466ae97924b75695d67579498c6aa45ffca1e3364da41c52f7 - Sigstore transparency entry: 1806532897
- Sigstore integration time:
-
Permalink:
persql/persql@2224964164159f280e81ba65880d1981b7e77164 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/persql
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release-strands.yml@2224964164159f280e81ba65880d1981b7e77164 -
Trigger Event:
push
-
Statement type: