Skip to content

Commit 85dd3c8

Browse files
committed
recursion_limit
1 parent 75e6a45 commit 85dd3c8

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/service/opey_session.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,12 @@ def build_config(self, base_config: dict | None = None) -> dict:
261261
**session_configurable,
262262
**base_config.get("configurable", {})
263263
}
264-
264+
265+
# LangGraph caps graph execution at `recursion_limit` super-steps (default 25).
266+
# Opey's tool-call cycle is ~5 super-steps per round, so 25 gives ~5 tool
267+
# calls per turn. Override via OPEY_RECURSION_LIMIT env var.
265268
return {
269+
"recursion_limit": int(os.getenv("OPEY_RECURSION_LIMIT", "100")),
266270
**base_config,
267271
"configurable": merged_configurable
268272
}

src/service/streaming_legacy.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
ToolCallApproval,
99
)
1010
from typing import Any, AsyncGenerator
11+
import os
1112
import uuid
1213
import json
1314
from langchain_core.runnables import RunnableConfig
@@ -26,7 +27,9 @@ def _parse_input(user_input: UserInput, session_id: str = None) -> tuple[dict[st
2627
kwargs = {
2728
"input": _input,
2829
"config": RunnableConfig(
29-
configurable={"thread_id": thread_id}, run_id=run_id
30+
configurable={"thread_id": thread_id},
31+
run_id=run_id,
32+
recursion_limit=int(os.getenv("OPEY_RECURSION_LIMIT", "100")),
3033
),
3134
}
3235
return kwargs, run_id

0 commit comments

Comments
 (0)