File tree Expand file tree Collapse file tree
src/uipath_langchain/_cli/_runtime Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import json
22import logging
3+ import os
34from typing import List , Optional
45
56from langchain_core .callbacks .base import BaseCallbackHandler
6- from langchain_core .runnables .config import RunnableConfig
7+ from langchain_core .runnables .config import DEFAULT_RECURSION_LIMIT , RunnableConfig
78from langchain_core .tracers .langchain import wait_for_all_tracers
89from langgraph .checkpoint .sqlite .aio import AsyncSqliteSaver
910from langgraph .errors import EmptyInputError , GraphRecursionError , InvalidUpdateError
@@ -79,13 +80,29 @@ async def execute(self) -> Optional[UiPathRuntimeResult]:
7980 )
8081 callbacks = [tracer ]
8182
83+ max_concurrency_env = os .environ .get ("LANGCHAIN_MAX_CONCURRENCY" , None )
84+ max_concurrency = (
85+ int (max_concurrency_env )
86+ if max_concurrency_env is not None
87+ else None
88+ )
89+
90+ recursion_limit_env = os .environ .get ("LANGCHAIN_RECURSION_LIMIT" , None )
91+ recursion_limit = (
92+ int (recursion_limit_env )
93+ if recursion_limit_env is not None
94+ else DEFAULT_RECURSION_LIMIT
95+ )
96+
8297 graph_config : RunnableConfig = {
8398 "configurable" : {
8499 "thread_id" : self .context .job_id
85100 if self .context .job_id
86101 else "default"
87102 },
88103 "callbacks" : callbacks ,
104+ "max_concurrency" : max_concurrency ,
105+ "recursion_limit" : recursion_limit ,
89106 }
90107
91108 # Stream the output at debug time
You can’t perform that action at this time.
0 commit comments