Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix(db): Disable Prepared Statements to Satisfy the Connection Pooler (#2449)
Kian Jonesf308aa2b80b4
diff --git a/letta/server/db.py b/letta/server/db.pyindex fc2fa3e24..1e9a94633 100644--- a/letta/server/db.py+++ b/letta/server/db.py@@ -1,5 +1,6 @@import osimport threading+import uuidfrom contextlib import asynccontextmanager, contextmanagerfrom typing import Any, AsyncGenerator, Generator@@ -165,6 +166,17 @@ class DatabaseRegistry:if not is_async:base_args["pool_use_lifo"] = settings.pool_use_lifo+ elif is_async:+ # For asyncpg, statement_cache_size should be in connect_args+ base_args.update(+ {+ "connect_args": {+ "prepared_statement_name_func": lambda: f"__asyncpg_{uuid.uuid4()}__",+ "statement_cache_size": 0,+ "prepared_statement_cache_size": 0,+ }+ }+ )return base_argsdef _wrap_sqlite_engine(self, engine: Engine) -> None: