feat: working orhcestration engine

This commit is contained in:
2026-10-21 19:50:24 +01:00
commit ce5e2f20cd
161 changed files with 31794 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
"""The configured LangGraph checkpointer that makes paused Executions resumable."""
from __future__ import annotations
from collections.abc import AsyncIterator
from contextlib import asynccontextmanager
from langgraph.checkpoint.base import BaseCheckpointSaver
from langgraph.checkpoint.memory import InMemorySaver
from execution_engine.config import Settings
@asynccontextmanager
async def open_checkpointer(settings: Settings) -> AsyncIterator[BaseCheckpointSaver]:
"""Yield a checkpointer per CHECKPOINTER: memory | sqlite | postgres."""
kind = settings.CHECKPOINTER
if kind == "memory":
yield InMemorySaver()
elif kind == "sqlite":
from langgraph.checkpoint.sqlite.aio import AsyncSqliteSaver
async with AsyncSqliteSaver.from_conn_string(
settings.CHECKPOINT_DB_PATH
) as saver:
yield saver
elif kind == "postgres":
from langgraph.checkpoint.postgres.aio import AsyncPostgresSaver
async with AsyncPostgresSaver.from_conn_string(
settings.get_database_url()
) as saver:
await saver.setup()
yield saver
else:
raise ValueError(
f"CHECKPOINTER must be memory, sqlite or postgres, not {kind!r}"
)