PostgreSQL storage backend plugin for the Orchid AI framework
Project description
orchid-storage-postgres
PostgreSQL storage backend plugin for the Orchid AI framework.
What it provides
PostgreSQL implementations of every framework persistence ABC:
OrchidPostgresChatStorage— chat sessions + messages + conversation summariesOrchidPostgresConfigStorage— agent configuration CRUDOrchidPostgresMCPTokenStore— per-server OAuth tokensOrchidPostgresMCPClientRegistrationStore— RFC 7591 dynamic-client registrationsOrchidPostgresMCPGatewayStateStore— gateway clients / auth codes / tokensPostgresEventStorage— signal / job / schedule / trigger persistence (events block)PostgresSignalQueue— durable lease-based queue withFOR UPDATE SKIP LOCKED+pg_notify- PostgreSQL visibility fragment for
build_run_filter_clause - Async PostgreSQL LangGraph checkpointer (registered as
postgrestype) - A unified v001 migration that provisions every framework-owned table in one pass
Installation
pip install orchid-storage-postgres
Usage
Reference the classes you need in your orchid.yml:
storage:
class: orchid_storage_postgres.chat_storage.OrchidPostgresChatStorage
dsn: postgresql://user:pass@localhost:5432/orchid
config_storage:
enabled: true
class: orchid_storage_postgres.config_storage.OrchidPostgresConfigStorage
dsn: postgresql://user:pass@localhost:5432/orchid
checkpointer:
type: postgres
dsn: postgresql://user:pass@localhost:5432/orchid
events:
enabled: true
store:
class_path: orchid_storage_postgres.event_storage.PostgresEventStorage
extra_args:
dsn: postgresql://user:pass@localhost:5432/orchid
queue:
class_path: orchid_storage_postgres.event_queue.PostgresSignalQueue
For MCP gateway / OAuth deployments, add:
mcp_token_store:
class: orchid_storage_postgres.mcp_token_store.OrchidPostgresMCPTokenStore
dsn: postgresql://user:pass@localhost:5432/orchid
mcp_client_registration_store:
class: orchid_storage_postgres.mcp_client_registration_store.OrchidPostgresMCPClientRegistrationStore
dsn: postgresql://user:pass@localhost:5432/orchid
mcp_gateway_state_store:
class: orchid_storage_postgres.mcp_gateway_state_store.OrchidPostgresMCPGatewayStateStore
dsn: postgresql://user:pass@localhost:5432/orchid
Or build any of them programmatically:
from orchid_storage_postgres import OrchidPostgresChatStorage
storage = OrchidPostgresChatStorage(dsn="postgresql://user:pass@localhost:5432/orchid")
await storage.init_db()
Schema ownership
The single v001_initial_schema migration creates all framework
tables (chat, MCP, events, agent_configs, conversation_summaries) in one
pass. All store classes share the same migration runner, so it does
not matter which class triggers init_db() first; subsequent calls
become no-ops thanks to CREATE TABLE IF NOT EXISTS.
Development
cd orchid-storage-postgres
pip install -e ".[dev]"
pytest tests/ -x
ruff check orchid_storage_postgres/
Tests are hermetic — they mock asyncpg.create_pool and the pool's
async context manager, so no live PostgreSQL is required.
License
MIT
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 orchid_storage_postgres-1.0.3.tar.gz.
File metadata
- Download URL: orchid_storage_postgres-1.0.3.tar.gz
- Upload date:
- Size: 28.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9447589fb1cb9ed3f9921e3b1b5e49897aa349ae4b363737a6a5eda14e946e42
|
|
| MD5 |
8cdf444bfad6aed0992b5d9f04850ce3
|
|
| BLAKE2b-256 |
d46e416e79a808058b97b49905cdeae5a2a9bc0ead13c2452e877cde507cae55
|
Provenance
The following attestation bundles were made for orchid_storage_postgres-1.0.3.tar.gz:
Publisher:
ci.yml on gadz82/orchid-storage-postgres
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
orchid_storage_postgres-1.0.3.tar.gz -
Subject digest:
9447589fb1cb9ed3f9921e3b1b5e49897aa349ae4b363737a6a5eda14e946e42 - Sigstore transparency entry: 1733531773
- Sigstore integration time:
-
Permalink:
gadz82/orchid-storage-postgres@7b7dd8279ac0c9ae0a23f5d6eef762a817b2e469 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/gadz82
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@7b7dd8279ac0c9ae0a23f5d6eef762a817b2e469 -
Trigger Event:
push
-
Statement type:
File details
Details for the file orchid_storage_postgres-1.0.3-py3-none-any.whl.
File metadata
- Download URL: orchid_storage_postgres-1.0.3-py3-none-any.whl
- Upload date:
- Size: 27.0 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 |
2ce7359d84bc08242f4221079e603bd090e29848b261d6de63e92fd30a0aaa92
|
|
| MD5 |
e7b7210eb7591dec8386d3ef32e7723d
|
|
| BLAKE2b-256 |
a5ff958547d88f2768064f83f355933e4c9264efec5229ee9e77e811b568c92d
|
Provenance
The following attestation bundles were made for orchid_storage_postgres-1.0.3-py3-none-any.whl:
Publisher:
ci.yml on gadz82/orchid-storage-postgres
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
orchid_storage_postgres-1.0.3-py3-none-any.whl -
Subject digest:
2ce7359d84bc08242f4221079e603bd090e29848b261d6de63e92fd30a0aaa92 - Sigstore transparency entry: 1733532077
- Sigstore integration time:
-
Permalink:
gadz82/orchid-storage-postgres@7b7dd8279ac0c9ae0a23f5d6eef762a817b2e469 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/gadz82
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@7b7dd8279ac0c9ae0a23f5d6eef762a817b2e469 -
Trigger Event:
push
-
Statement type: