mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-05-20 23:21:06 +00:00
feat(persistence): add SQLAlchemy 2.0 async ORM scaffold
Introduce a unified database configuration (DatabaseConfig) that controls both the LangGraph checkpointer and the DeerFlow application persistence layer from a single `database:` config section. New modules: - deerflow.config.database_config — Pydantic config with memory/sqlite/postgres backends - deerflow.persistence — async engine lifecycle, DeclarativeBase with to_dict mixin, Alembic skeleton - deerflow.runtime.runs.store — RunStore ABC + MemoryRunStore implementation Gateway integration initializes/tears down the persistence engine in the existing langgraph_runtime() context manager. Legacy checkpointer config is preserved for backward compatibility. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -584,6 +584,35 @@ checkpointer:
|
||||
# type: postgres
|
||||
# connection_string: postgresql://user:password@localhost:5432/deerflow
|
||||
|
||||
# ============================================================================
|
||||
# Database
|
||||
# ============================================================================
|
||||
# Unified storage backend for LangGraph checkpointer and DeerFlow
|
||||
# application data (runs, threads metadata, etc.).
|
||||
#
|
||||
# backend: memory -- No persistence, data lost on restart (default)
|
||||
# backend: sqlite -- Single-node deployment, files in sqlite_dir
|
||||
# backend: postgres -- Production multi-node deployment
|
||||
#
|
||||
# SQLite mode automatically uses separate .db files for checkpointer
|
||||
# and application data to avoid write-lock contention.
|
||||
#
|
||||
# Postgres mode: put your connection URL in .env as DATABASE_URL,
|
||||
# then reference it here with $DATABASE_URL.
|
||||
# Install the postgres driver: uv sync --extra postgres
|
||||
#
|
||||
# NOTE: When both `checkpointer` and `database` are configured,
|
||||
# `checkpointer` takes precedence for LangGraph state persistence.
|
||||
# If you use `database`, you can remove the `checkpointer` section.
|
||||
#
|
||||
# database:
|
||||
# backend: sqlite
|
||||
# sqlite_dir: ./data
|
||||
#
|
||||
# database:
|
||||
# backend: postgres
|
||||
# postgres_url: $DATABASE_URL
|
||||
|
||||
# ============================================================================
|
||||
# IM Channels Configuration
|
||||
# ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user