Skip to main content

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 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

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

orchid_storage_postgres-1.0.3.tar.gz (28.6 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.3-py3-none-any.whl (27.0 kB view details)

Uploaded Python 3

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

Hashes for orchid_storage_postgres-1.0.3.tar.gz
Algorithm Hash digest
SHA256 9447589fb1cb9ed3f9921e3b1b5e49897aa349ae4b363737a6a5eda14e946e42
MD5 8cdf444bfad6aed0992b5d9f04850ce3
BLAKE2b-256 d46e416e79a808058b97b49905cdeae5a2a9bc0ead13c2452e877cde507cae55

See more details on using hashes here.

Provenance

The following attestation bundles were made for orchid_storage_postgres-1.0.3.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.3-py3-none-any.whl.

File metadata

File hashes

Hashes for orchid_storage_postgres-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2ce7359d84bc08242f4221079e603bd090e29848b261d6de63e92fd30a0aaa92
MD5 e7b7210eb7591dec8386d3ef32e7723d
BLAKE2b-256 a5ff958547d88f2768064f83f355933e4c9264efec5229ee9e77e811b568c92d

See more details on using hashes here.

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

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