Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(WIP) Add support for early stopping in agent executor #268

Closed
wants to merge 4 commits into from

Conversation

ccurme
Copy link

@ccurme ccurme commented Apr 2, 2024

Following #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!

@nfcampos
Copy link
Contributor

nfcampos commented Apr 2, 2024

We support max_iterations natively in langgraph through the config key recursion_limit:

app.invoke(..., {"recursion_limit": 15})

@nfcampos
Copy link
Contributor

nfcampos commented Apr 2, 2024

We support step_timeout arg natively in langgraph, see step_timeout constructor arg in Pregel/CompiledGraph. I don't think we need total_timeout when we have step timeout.

@ccurme ccurme closed this May 31, 2024
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.

None yet

2 participants