Microsoft Agent Framework conversation history backed by PerSQL — durable message history in an isolated SQLite database per agent.
Project description
agent-framework-persql
Microsoft Agent Framework conversation history backed by PerSQL — durable message history in an isolated SQLite database per agent, provisioned instantly.
pip install agent-framework-persql
Usage
import os
from persql import PerSQL
from agent_framework_persql import PerSQLHistoryProvider
client = PerSQL(token=os.environ["PERSQL_TOKEN"])
provider = PerSQLHistoryProvider(client.database("acme/agent-state"))
agent = chat_client.as_agent(instructions="...", context_providers=[provider])
session = agent.create_session(session_id="user-42")
await agent.run("hi", session=session)
Or let the provider own the client:
with PerSQLHistoryProvider.from_token(os.environ["PERSQL_TOKEN"], "acme/agent-state") as provider:
...
AsyncPerSQL databases are awaited natively; sync databases run via
asyncio.to_thread.
What it stores
One agent_framework_messages row per message (Message.to_dict() as
JSON), appended in run order and replayed with Message.from_dict().
Pass messages_table= to rename the table. The standard
HistoryProvider flags (load_messages, store_inputs,
store_outputs, store_context_messages, store_context_from) and
skip_excluded work as in the built-in providers, so the same class
covers primary memory, audit-only, and evaluation storage.
provider.clear(session_id) deletes one session's history.
Limits
- A
Nonesession_id maps to one shared"default"history — the same behavior as the framework'sFileHistoryProvider. Pass session ids for per-user isolation. - Message payloads are JSON; binary content should be referenced by URI, not embedded.
- Requires
agent-framework-core >= 1.8, < 2— the package subclassesHistoryProvider, so a framework major version can change the contract.
Local mode for tests
from persql import PerSQL
provider = PerSQLHistoryProvider(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 agent_framework_persql-0.1.0.tar.gz.
File metadata
- Download URL: agent_framework_persql-0.1.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9943b1da239bf687a336fcc847e82fddf6db77c3278f02c91346eef396151df
|
|
| MD5 |
6ff536263d39bb6928b807512dd11031
|
|
| BLAKE2b-256 |
b64a7298477d237f54221c017cdfaafb54171e903b1034aeffd799b90b7fd255
|
Provenance
The following attestation bundles were made for agent_framework_persql-0.1.0.tar.gz:
Publisher:
python-release-af.yml on persql/persql
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_framework_persql-0.1.0.tar.gz -
Subject digest:
e9943b1da239bf687a336fcc847e82fddf6db77c3278f02c91346eef396151df - Sigstore transparency entry: 1806531017
- 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-af.yml@2224964164159f280e81ba65880d1981b7e77164 -
Trigger Event:
push
-
Statement type:
File details
Details for the file agent_framework_persql-0.1.0-py3-none-any.whl.
File metadata
- Download URL: agent_framework_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 |
eba5f92c9181ef09bdcc529e461bbe1dd177e7745c04b85172434c884c9df69a
|
|
| MD5 |
0fa515a18b6090b4303bbbc69b548246
|
|
| BLAKE2b-256 |
b90c4615456eb3c644cb038a538dc5a6210da46c6e5c9877442a93b55ce4f3e2
|
Provenance
The following attestation bundles were made for agent_framework_persql-0.1.0-py3-none-any.whl:
Publisher:
python-release-af.yml on persql/persql
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_framework_persql-0.1.0-py3-none-any.whl -
Subject digest:
eba5f92c9181ef09bdcc529e461bbe1dd177e7745c04b85172434c884c9df69a - Sigstore transparency entry: 1806531053
- 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-af.yml@2224964164159f280e81ba65880d1981b7e77164 -
Trigger Event:
push
-
Statement type: