mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-04-25 11:18:22 +00:00
28 lines
1.0 KiB
Python
28 lines
1.0 KiB
Python
"""Configuration for LangGraph checkpointer."""
|
|
|
|
from typing import Literal
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
CheckpointerType = Literal["memory", "sqlite", "postgres"]
|
|
|
|
|
|
class CheckpointerConfig(BaseModel):
|
|
"""Configuration for LangGraph state persistence checkpointer."""
|
|
|
|
model_config = ConfigDict(frozen=True)
|
|
|
|
type: CheckpointerType = Field(
|
|
description="Checkpointer backend type. "
|
|
"'memory' is in-process only (lost on restart). "
|
|
"'sqlite' persists to a local file (requires langgraph-checkpoint-sqlite). "
|
|
"'postgres' persists to PostgreSQL (requires langgraph-checkpoint-postgres)."
|
|
)
|
|
connection_string: str | None = Field(
|
|
default=None,
|
|
description="Connection string for sqlite (file path) or postgres (DSN). "
|
|
"Required for sqlite and postgres types. "
|
|
"For sqlite, use a file path like '.deer-flow/checkpoints.db' or ':memory:' for in-memory. "
|
|
"For postgres, use a DSN like 'postgresql://user:pass@localhost:5432/db'.",
|
|
)
|