Skip to content

fix(agent): Raise recursion_limit to allow more tool calls per interaction - #245

Merged
marcelklehr merged 2 commits into
mainfrom
fix/recursion-limit
Oct 20, 2026
Merged

marcelklehr merged 2 commits into
mainfrom
fix/recursion-limit

Conversation

@marcelklehr

@marcelklehr marcelklehr commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

see https://docs.langchain.com/oss/python/langgraph/errors/GRAPH_RECURSION_LIMIT

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI (N/A)

…ction

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
@marcelklehr marcelklehr changed the title fix(agent): Raise recursion_limit to allow more tool calls per intera… fix(agent): Raise recursion_limit to allow more tool calls per interaction Oct 1, 2026
@marcelklehr
marcelklehr marked this pull request as ready for review October 20, 2026 08:27
@marcelklehr
marcelklehr requested a review from WSHAPER October 20, 2026 08:27
@WSHAPER

WSHAPER commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

What's the specific rationale behind this change?
Are there any issues related to it?

@marcelklehr

Copy link
Copy Markdown
Member Author

see #253

@WSHAPER WSHAPER left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, minor nitpicks

Comment thread ex_app/lib/agent.py Outdated
graph_config = {
# Dummy thread id as we return the whole state
"configurable": {"thread_id": "thread-1"},
# Maximum amount of tool calls per interaction

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly misleading, each tool call usually costs ~ two steps afaik

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

256 may be too generous for local models, wdyt

@marcelklehr marcelklehr Oct 20, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I chose a number that would be high but not hurt when actually hit by an infinite loop. What would you choose?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

128 tool calls in practice is then even lower

Comment thread ex_app/lib/agent.py Outdated
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
@marcelklehr
marcelklehr merged commit 7c559db into main Oct 20, 2026
7 checks passed
@marcelklehr
marcelklehr deleted the fix/recursion-limit branch October 20, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants