mirror of
https://github.com/langchain-ai/langgraph-swarm-py.git
synced 2026-07-01 12:47:18 -04:00
handoff_tool needs protection against infinite loops #3
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @arthurdorigueto on GitHub (Feb 26, 2025).
The way
create_handoff_toolis implemented allows for two agents to keep calling each other until the number of steps hit the graph recursion limit. There should be some hard protection agains that, right now the only protection is prompt engineering.@vbarda commented on GitHub (Feb 26, 2025):
LangGraph has that -- you can use
recursion_limitwhen invoking the system like the following:swarm_graph.invoke({...}, config={"recursion_limit": 100})@arthurdorigueto commented on GitHub (Feb 26, 2025):
How can I use this if I'm deploying my graph using LangGraph Cloud?
@vbarda commented on GitHub (Mar 5, 2025):
if you're asking about recursion limit, you can simply pass this when interacting w/ deployment via LangGraph SDK -
client.runs.stream(input=input, config=config, ...)where config containsrecursion_limit