Skip to main content

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 None session_id maps to one shared "default" history — the same behavior as the framework's FileHistoryProvider. 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 subclasses HistoryProvider, 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agent_framework_persql-0.1.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent_framework_persql-0.1.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

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

Hashes for agent_framework_persql-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e9943b1da239bf687a336fcc847e82fddf6db77c3278f02c91346eef396151df
MD5 6ff536263d39bb6928b807512dd11031
BLAKE2b-256 b64a7298477d237f54221c017cdfaafb54171e903b1034aeffd799b90b7fd255

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_framework_persql-0.1.0.tar.gz:

Publisher: python-release-af.yml on persql/persql

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agent_framework_persql-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agent_framework_persql-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eba5f92c9181ef09bdcc529e461bbe1dd177e7745c04b85172434c884c9df69a
MD5 0fa515a18b6090b4303bbbc69b548246
BLAKE2b-256 b90c4615456eb3c644cb038a538dc5a6210da46c6e5c9877442a93b55ce4f3e2

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page