Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

feat: Factor out some uvicorn settings as environment variables (#1266)

Matthew Zhou194dc5669671
diff --git a/letta/server/rest_api/app.py b/letta/server/rest_api/app.py
index d249a3a20..a40132697 100644
--- a/letta/server/rest_api/app.py
+++ b/letta/server/rest_api/app.py
@@ -322,6 +322,9 @@ def start_server(
app,
host=host or "localhost",
port=port or REST_DEFAULT_PORT,
+ workers=settings.uvicorn_workers,
+ reload=settings.uvicorn_reload,
+ timeout_keep_alive=settings.uvicorn_timeout_keep_alive,
ssl_keyfile="certs/localhost-key.pem",
ssl_certfile="certs/localhost.pem",
)
@@ -338,4 +341,7 @@ def start_server(
app,
host=host or "localhost",
port=port or REST_DEFAULT_PORT,
+ workers=settings.uvicorn_workers,
+ reload=settings.uvicorn_reload,
+ timeout_keep_alive=settings.uvicorn_timeout_keep_alive,
)
diff --git a/letta/settings.py b/letta/settings.py
index f5c67d778..2aad93bab 100644
--- a/letta/settings.py
+++ b/letta/settings.py
@@ -174,6 +174,11 @@ class Settings(BaseSettings):
# telemetry logging
verbose_telemetry_logging: bool = False
+ # uvicorn settings
+ uvicorn_workers: int = 1
+ uvicorn_reload: bool = False
+ uvicorn_timeout_keep_alive: int = 5
+
@property
def letta_pg_uri(self) -> str:
if self.pg_uri: