Skip to main content

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 summaries
  • OrchidPostgresConfigStorage — agent configuration CRUD
  • OrchidPostgresMCPTokenStore — per-server OAuth tokens
  • OrchidPostgresMCPClientRegistrationStore — RFC 7591 dynamic-client registrations
  • OrchidPostgresMCPGatewayStateStore — gateway clients / auth codes / tokens
  • PostgresEventStorage — signal / job / schedule / trigger persistence (events block)
  • PostgresSignalQueue — durable lease-based queue with FOR UPDATE SKIP LOCKED + pg_notify
  • PostgreSQL visibility fragment for build_run_filter_clause
  • Async PostgreSQL LangGraph checkpointer (registered as postgres type)
  • 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

Metadata

Release files for orchid-storage-postgres 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for orchid-storage-postgres 1.1.0
File Size Uploaded
orchid_storage_postgres-1.1.0.tar.gz 30.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for orchid-storage-postgres 1.1.0
File Interpreter ABI Platform
orchid_storage_postgres-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 59.7 kB

Release files / orchid_storage_postgres-1.1.0.tar.gz

Download URL orchid_storage_postgres-1.1.0.tar.gz
Size 30.3 kB
Tags Source
SHA-256 checksum
How to use checksums
53c226379cb51b18119d3ed25e2acadcdcac8494fe41bf5d8e4d30cb347c3c94
BLAKE2b-256 checksum
How to use checksums
923f6fbaf49cafa3dce593b224446ec1071f6959557301c65bc4112afeda93e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

Release files / orchid_storage_postgres-1.1.0-py3-none-any.whl

Download URL orchid_storage_postgres-1.1.0-py3-none-any.whl
Size 29.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
395cc6ed50b834ff49ccbe88e0e93284489869eda5ce56b3dd54d4597303c7c8
BLAKE2b-256 checksum
How to use checksums
b7c6c326007b6ce8c1153b2c503d9e598f57b2c511d38aa4d7dd173184604a6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 15, 2026.

Transparency log

Release history Release notifications | RSS feed

1.2.0

2 release files

This release

1.1.0 This release

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page