Symptom
Pregel.with_config({"recursion_limit": N}) does nothing when N equals LANGGRAPH_DEFAULT_RECURSION_LIMIT. An earlier bound limit stays, with no error.
Evidence what you'll see
- On
langgraph==1.2.16, withLANGGRAPH_DEFAULT_RECURSION_LIMIT=1000,graph.with_config({"recursion_limit": 5000}).with_config({"recursion_limit": 1000})keeps5000instead of1000. - A self-hosted Agent Server with that default ran about 10,000 supersteps and stopped with
Recursion limit of 9999 reached, although the graph and the server default were both set to1000.
Why it happens
merge_configs applies a new recursion_limit only when it differs from DEFAULT_RECURSION_LIMIT, which is read from the environment. An explicit value equal to that default is treated as unset. Pull request 9417 uses a sentinel for the filled-in default so an explicit equal value is kept.
Affected versions
langgraph==1.2.16, langchain-core==1.7.0, Python 3.12. The Agent Server observation used langgraph-api==0.15.1. The same merge_configs rule was reported earlier for a fixed default of 10000 in issue 7314.
Fix steps
0 of 2 done
Your check marks stay in this browser only.
How to check it worked
- With
LANGGRAPH_DEFAULT_RECURSION_LIMIT=1000,graph.with_config({"recursion_limit": 5000}).with_config({"recursion_limit": 1000}).config["recursion_limit"]is1000.
If it still fails
- Tag
1.2.16does not contain pull request 9417. - The pull request does not change
langchain_core.runnables.config.merge_configs, which the issue says still has the same comparison.
Sources and credit
Summarized in our own words from these public reports. Credit goes to their authors.
Provided as is, without warranty. Try changes in a non-production environment and back up first. Security-related steps: verify against the official docs. Terms · Request removal or attribution change
Hit an error we don't cover? Submit it