[PR #268] [CLOSED] (WIP) Add support for early stopping in agent executor #1347

Closed
opened 2026-02-20 17:44:30 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/langgraph/pull/268
Author: @ccurme
Created: 4/2/2024
Status: Closed

Base: mainHead: cc/agent_executor_abort


📝 Commits (4)

📊 Changes

3 files changed (+684 additions, -5 deletions)

View changed files

📝 langgraph/prebuilt/agent_executor.py (+60 -5)
tests/__snapshots__/test_agent_executor.ambr (+481 -0)
tests/test_agent_executor.py (+143 -0)

📄 Description

Following https://github.com/langchain-ai/langgraph/issues/265, here we add support for early stopping (e.g., via max_iterations or max_execution_time) as in AgentExecutor.

WIP: looking for feedback on the general strategy for incorporating AgentExecutor's attributes, eventually including

  • return_intermediate_steps
  • max_iterations
  • max_execution_time
  • early_stopping_method
  • handle_parsing_errors
  • trim_intermediate_steps

Here I've added some to AgentState, but it's unclear to me how to set defaults when they are not passed in by the caller on invoke, stream, etc. For example, even if I set iteration_count: int = 0 in AgentState, it gets set to 0 if not included in the input. Looking for suggestions on other ways to do this!


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/langgraph/pull/268 **Author:** [@ccurme](https://github.com/ccurme) **Created:** 4/2/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `cc/agent_executor_abort` --- ### 📝 Commits (4) - [`3aa439a`](https://github.com/langchain-ai/langgraph/commit/3aa439ad118b734d0b0893c6e1d9063e0459736e) add max_iterations - [`3c8a713`](https://github.com/langchain-ai/langgraph/commit/3c8a7133a436109a8f236c1191d91c652f48d483) add test - [`f405009`](https://github.com/langchain-ai/langgraph/commit/f40500905fb0cdf1e3dd05eb591adbae5e3cbdb9) format - [`9e9119a`](https://github.com/langchain-ai/langgraph/commit/9e9119a7a683b42dfccf20cc951b03f3ab48f548) lint ### 📊 Changes **3 files changed** (+684 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `langgraph/prebuilt/agent_executor.py` (+60 -5) ➕ `tests/__snapshots__/test_agent_executor.ambr` (+481 -0) ➕ `tests/test_agent_executor.py` (+143 -0) </details> ### 📄 Description Following https://github.com/langchain-ai/langgraph/issues/265, here we add support for early stopping (e.g., via `max_iterations` or `max_execution_time`) as in AgentExecutor. WIP: looking for feedback on the general strategy for incorporating AgentExecutor's attributes, eventually including - `return_intermediate_steps` - `max_iterations` - `max_execution_time` - `early_stopping_method` - `handle_parsing_errors` - `trim_intermediate_steps` Here I've added some to `AgentState`, but it's unclear to me how to set defaults when they are not passed in by the caller on invoke, stream, etc. For example, even if I set `iteration_count: int = 0` in AgentState, it gets set to 0 if not included in the input. Looking for suggestions on other ways to do this! --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-20 17:44:30 -05:00
yindo closed this issue 2026-02-20 17:44:30 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#1347