diff --git a/.env.example b/.env.example index 9e98c0f..ad66a42 100644 --- a/.env.example +++ b/.env.example @@ -22,6 +22,8 @@ USERS_OPEN_REGISTRATION=False MAX_UPLOAD_SIZE=50_000_000 # Sets the number of processes MAX_WORKERS=1 +# Controls LangGraph's recursion_limit configuration parameter. If empty, defaults to 25. +RECURSION_LIMIT=25 # llm provider keys. Add only to models that you want to use OPENAI_API_KEY= diff --git a/backend/app/core/config.py b/backend/app/core/config.py index 7377590..b780719 100644 --- a/backend/app/core/config.py +++ b/backend/app/core/config.py @@ -156,5 +156,8 @@ def _enforce_non_default_secrets(self) -> Self: MAX_UPLOAD_SIZE: int = 50_000_000 + # LangGraph config + RECURSION_LIMIT: int = 25 + settings = Settings() # type: ignore diff --git a/backend/app/core/graph/build.py b/backend/app/core/graph/build.py index 024aead..768992f 100644 --- a/backend/app/core/graph/build.py +++ b/backend/app/core/graph/build.py @@ -512,7 +512,7 @@ async def generator( config: RunnableConfig = { "configurable": {"thread_id": thread_id}, - "recursion_limit": 25, + "recursion_limit": settings.RECURSION_LIMIT, } # Handle interrupt logic by orriding state if interrupt and interrupt.decision == InterruptDecision.APPROVED: diff --git a/docker-compose.yml b/docker-compose.yml index 63c1378..2381efb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -110,6 +110,7 @@ services: - DENSE_EMBEDDING_MODEL=${DENSE_EMBEDDING_MODEL?Variable not set} - SPARSE_EMBEDDING_MODEL=${SPARSE_EMBEDDING_MODEL?Variable not set} - MAX_UPLOAD_SIZE=${MAX_UPLOAD_SIZE} + - RECURSION_LIMIT=${RECURSION_LIMIT} - CELERY_BROKER_URL=redis://redis:6379/0 - CELERY_RESULT_BACKEND=redis://redis:6379/0 build: