Skip to content

Commit 067cd73

Browse files
committed
chore: update agent configuration to include recursion limit in astream call
1 parent 967eede commit 067cd73

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

apps/application/flow/tools.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,9 @@ async def _yield_mcp_response(chat_model, message_list, mcp_servers, mcp_output_
313313
try:
314314
client = MultiServerMCPClient(json.loads(mcp_servers))
315315
tools = await client.get_tools()
316-
agent = create_react_agent(chat_model, tools).configure(recursion_limit=(int(CONFIG.get("LANGCHAIN_GRAPH_RECURSION_LIMIT", '25'))))
317-
response = agent.astream({"messages": message_list}, stream_mode='messages')
316+
agent = create_react_agent(chat_model, tools)
317+
recursion_limit = int(CONFIG.get("LANGCHAIN_GRAPH_RECURSION_LIMIT", '25'))
318+
response = agent.astream({"messages": message_list}, config={"recursion_limit": recursion_limit}, stream_mode='messages')
318319

319320
# 用于存储工具调用信息(按 tool_id)以及按 index 聚合分片
320321
tool_calls_info = {}

0 commit comments

Comments
 (0)