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.2.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.2.0
File Size Uploaded
orchid_storage_postgres-1.2.0.tar.gz 31.9 kB Details

Built distribution (wheel)

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

Total release size: 63.7 kB

Release files / orchid_storage_postgres-1.2.0.tar.gz

Download URL orchid_storage_postgres-1.2.0.tar.gz
Size 31.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b47a9ad06f879861a2fbd010d71fa95734ca565a95bcc27f41fd9e0cf0b6b139
BLAKE2b-256 checksum
How to use checksums
dfedd4c50ff3b350e9eaaf4be6d15562210c0ad4504dc9285fa89ea95a22ddbd
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 Oct 8, 2026.

Transparency log

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

Download URL orchid_storage_postgres-1.2.0-py3-none-any.whl
Size 31.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
584325c0b0badceb9ab7d77f60f435af2d8aeee887c23b5ed25c426fbb125f76
BLAKE2b-256 checksum
How to use checksums
efa955f350450653b1d65bb9a4b8650af00af50d52ec1f6b3dc9354de04ab18a
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 Oct 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.0

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