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.2.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.2-py3-none-any.whl (27.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: orchid_storage_postgres-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 8e43a4d85c873babdff0b42863c9f1df91e7a8f1e35d952714e1758034d8869b
MD5 79ead12b7eea35b1a2ecd83a73be61af
BLAKE2b-256 1b5e6124d84108ae6153f8aa9d72f7348d8198e040cdfd34916291a3f73d56d2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for orchid_storage_postgres-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3f9f915d4f997d76628b9b6d6dd86455ccabf5531467b2059d76f0b637a194d4
MD5 1c4103a93c37638b94425007beca689d
BLAKE2b-256 057e7a0f902e1d92e0cb4ed45cd81f3de19817dd2aff2e38587039863dd04a54

See more details on using hashes here.

Provenance

The following attestation bundles were made for orchid_storage_postgres-1.0.2-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