[GH-ISSUE #77] Agent Stopping #25

Closed
opened 2026-02-16 06:16:54 -05:00 by yindo · 1 comment
Owner

Originally created by @jordanparker6 on GitHub (Dec 10, 2025).
Original GitHub issue: https://github.com/langchain-ai/deepagentsjs/issues/77

Seems to create recursion errors really easily when using this library... whats the ideal way of stopping the agent as it seems to just continue to create todos until it breaks.

Originally created by @jordanparker6 on GitHub (Dec 10, 2025). Original GitHub issue: https://github.com/langchain-ai/deepagentsjs/issues/77 Seems to create recursion errors really easily when using this library... whats the ideal way of stopping the agent as it seems to just continue to create todos until it breaks.
Author
Owner

@janpawellek commented on GitHub (Dec 11, 2025):

Hi @jordanparker6

For stopping the agent if it exceeds certain model and/or tool calls, you could try adding the modelCallLimitMiddleware or the toolCallLimitMiddleware as a middleware to your agent.

I found that also choosing a more detailed system prompt often helps preventing these issues (if you instruct the model more precisely on what to do in difficult cases or by establishing clear rules).

@janpawellek commented on GitHub (Dec 11, 2025): Hi @jordanparker6 For stopping the agent if it exceeds certain model and/or tool calls, you could try adding the [modelCallLimitMiddleware](https://docs.langchain.com/oss/javascript/langchain/middleware/built-in#model-call-limit) or the [toolCallLimitMiddleware](https://docs.langchain.com/oss/javascript/langchain/middleware/built-in#tool-call-limit) as a middleware to your agent. I found that also choosing a more detailed system prompt often helps preventing these issues (if you instruct the model more precisely on what to do in difficult cases or by establishing clear rules).
yindo changed title from Agent Stopping to [GH-ISSUE #77] Agent Stopping 2026-06-05 17:21:02 -04:00
yindo closed this issue 2026-06-05 17:21:03 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/deepagentsjs#25