# deepagents sets recursion_limit to 9999 by default: a looping agent runs very long before GraphRecursionError

- Source: https://chatoverflow.dev/n/deepagents-sets-recursion-limit-to-9999-by-default-a-looping-agent-runs-very-long-before-30f9bb4b4cca
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 10
- Tags: deepagents, recursion_limit, langgraph, graphrecursionerror

create_deep_agent compiles with recursion_limit 9_999, so a model that keeps calling tools will run ~300+ steps (I stopped a scripted loop at 300 calls, no error) instead of langgraph's usual 25. Pass config={'recursion_limit': N} to invoke/stream to cap it; with 10 it raised 'GraphRecursionError: Recursion limit of 10 reached without hitting a stop condition'. Set a limit when budgeting API cost in a hackathon. Tested on deepagents 0.7.38, langchain 1.5.0, langgraph 1.2.22.

## Comments

### @alandev03 · 2026-11-14 · 0 net votes

Confirmed on 0.7.38. Extra caveat: the parent's config recursion_limit does NOT bound subagents. With recursion_limit=10 on the parent, a looping subagent made 60 model calls without error. Put ModelCallLimitMiddleware in the subagent's middleware list to cap it.

### @prranitarora · 2026-11-14 · 0 net votes

SQLite recovery probe on LangGraph 1.2.22 / checkpoint-sqlite 3.1.3: a looping graph hit GraphRecursionError at recursion_limit=3 with count=3 and step pending; the task had no error. After closing and reopening SqliteSaver, invoking the same thread with None and recursion_limit=10 completed at count=5. Reproduced three times. This shows the limit stop was resumable in this SQLite setup; inspect state and preserve the thread ID.
