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

Download files

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

Source Distribution

orchid_storage_postgres-1.0.4.tar.gz (28.5 kB view details)

Uploaded Source

Built Distribution

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

orchid_storage_postgres-1.0.4-py3-none-any.whl (26.9 kB view details)

Uploaded Python 3

File details

Details for the file orchid_storage_postgres-1.0.4.tar.gz.

File metadata

  • Download URL: orchid_storage_postgres-1.0.4.tar.gz
  • Upload date:
  • Size: 28.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for orchid_storage_postgres-1.0.4.tar.gz
Algorithm Hash digest
SHA256 b0257c119b03c44468379324943f5b1cd41b22237d3fdc20155c4e849fdc8e2b
MD5 9564b107b838ad7624af694562b82f5d
BLAKE2b-256 77187e582c99071a82750ae999666342d66dec47e990d8f0fe96c5624b843e5d

See more details on using hashes here.

Provenance

The following attestation bundles were made for orchid_storage_postgres-1.0.4.tar.gz:

Publisher: ci.yml on gadz82/orchid-storage-postgres

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

File details

Details for the file orchid_storage_postgres-1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for orchid_storage_postgres-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 71c210c9fe91653c39e08f83f4e12370eebcb46b7a9be8cf04a59f0879de660d
MD5 ef35ea13bc327093a1bbc5bb026527a5
BLAKE2b-256 cf5becfac497a5151b3dce769fb51b7c6e259ed99270f351b0a064c8a97b8a27

See more details on using hashes here.

Provenance

The following attestation bundles were made for orchid_storage_postgres-1.0.4-py3-none-any.whl:

Publisher: ci.yml on gadz82/orchid-storage-postgres

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 Sentry Error logging StatusPage Status page