Update agents.py
Browse files
agents.py
CHANGED
|
@@ -1,4 +1,7 @@
|
|
| 1 |
import os
|
|
|
|
|
|
|
|
|
|
| 2 |
from dotenv import load_dotenv
|
| 3 |
from langchain.chat_models import init_chat_model
|
| 4 |
from langgraph_supervisor import create_supervisor
|
|
@@ -28,7 +31,13 @@ _llm = init_chat_model(
|
|
| 28 |
# STATE / MEMORY (sqlite, kept for this agent's whole lifetime, tuned to be
|
| 29 |
# safe on S3-style / object-storage persistent buckets — see storage_paths.py)
|
| 30 |
# ---------------------------------------------------------------------------
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
# ---------------------------------------------------------------------------
|
| 34 |
# ASSISTANT AGENT BACKSTORY AND GOAL
|
|
|
|
| 1 |
import os
|
| 2 |
+
import asyncio
|
| 3 |
+
import aiosqlite
|
| 4 |
+
from langgraph.checkpoint.sqlite.aio import AsyncSqliteSaver
|
| 5 |
from dotenv import load_dotenv
|
| 6 |
from langchain.chat_models import init_chat_model
|
| 7 |
from langgraph_supervisor import create_supervisor
|
|
|
|
| 31 |
# STATE / MEMORY (sqlite, kept for this agent's whole lifetime, tuned to be
|
| 32 |
# safe on S3-style / object-storage persistent buckets — see storage_paths.py)
|
| 33 |
# ---------------------------------------------------------------------------
|
| 34 |
+
|
| 35 |
+
async def _make_checkpointer(db_path: str) -> AsyncSqliteSaver:
|
| 36 |
+
os.makedirs(os.path.dirname(db_path), exist_ok=True)
|
| 37 |
+
conn = await aiosqlite.connect(db_path)
|
| 38 |
+
return AsyncSqliteSaver(conn)
|
| 39 |
+
|
| 40 |
+
_checkpointer = asyncio.run(_make_checkpointer(DB_PATH))
|
| 41 |
|
| 42 |
# ---------------------------------------------------------------------------
|
| 43 |
# ASSISTANT AGENT BACKSTORY AND GOAL
|