Skip to content

feat(sdk): agent recursionLimit option#337

Open
blove wants to merge 2 commits into
mainfrom
blove/agent-recursion-limit
Open

feat(sdk): agent recursionLimit option#337
blove wants to merge 2 commits into
mainfrom
blove/agent-recursion-limit

Conversation

@blove

@blove blove commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a recursionLimit option to agent() that maps to LangGraph's per-run super-step ceiling (default 25). Deep agents — a coordinator that dispatches subagents and makes many tool calls — can raise the limit instead of aborting with Recursion limit of 25 reached without hitting a stop condition.

Surfaced by dogfooding the flagship research demo (coordinator → per-sub-question researcher → many corpus tool calls → synthesize legitimately exceeds 25 steps).

Change (2 files + tests)

  • packages/sdk/src/agent.tsrecursionLimit?: number on AgentConfig/DawnAgent, spread in the agent() factory (mirrors the existing retry option).
  • packages/langchain/src/agent-adapter.ts — in prepareAgentCall, set config.recursionLimit from the DawnAgent descriptor when present; LangGraph's Pregel reads it. Sourced from options.entry, exactly like retry.

Test plan

  • packages/langchain/test/agent-adapter.test.ts — 2 new tests: the descriptor's recursionLimit reaches the graph config; absent by default. (8/8 in the suite.)
  • Verified live: the research demo's deep run completes end-to-end with recursionLimit: 100 instead of erroring at 25.

🤖 Generated with Claude Code

blove and others added 2 commits July 9, 2026 20:25
Expose recursionLimit on agent() and wire it into the graph config
(prepareAgentCall), so deep agents can exceed LangGraph's default 25
super-steps. Sourced from the DawnAgent descriptor, mirroring retry. Tests
assert it reaches the invoke/stream config and is unset by default.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dawnai Ready Ready Preview, Comment Jul 10, 2026 3:26am

Request Review

@github-actions github-actions Bot 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.

Automated approval: this PR received an intelligent (AI) code review. See the review comments on this PR.

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Claude finished @blove's task in 0s —— View job


I'll analyze this and get back to you.

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.

1 participant