Skip to content

Add a max_actions_per_run variable on AgentService as a backstop#535

Merged
eob merged 3 commits intomainfrom
backstop-on-action-loop
Aug 30, 2023
Merged

Add a max_actions_per_run variable on AgentService as a backstop#535
eob merged 3 commits intomainfrom
backstop-on-action-loop

Conversation

@eob
Copy link
Copy Markdown
Contributor

@eob eob commented Aug 29, 2023

An observed failure mode of a reasoning Agent is when it spirals into endlessly calling tools.

In a development loop, the programmer can quickly break the loop, but in a hosted situation this can result in surprising costs if each tool involves LLM usage.

This PR adds a simple backstop in which the max_actions_per_run variable on AgentService (default = 5) acts as a limit on how many actions the agent is permitted to run before being stopped.

If the AgentService attempts to run an action after max_actions_per_run has been reached, it is treated as an error which will be returned to the chat invoker.

@eob eob requested a review from douglas-reid August 29, 2023 20:05
@eob
Copy link
Copy Markdown
Contributor Author

eob commented Aug 29, 2023

Note:

On staging, the failed telegram test is fixed by #531
And the failed OpenAI test appears to be an error on their side of things.

Copy link
Copy Markdown
Contributor

@douglas-reid douglas-reid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a fine solution. I wonder if we'll see 5 be considered too few however. We should at least two for the simplest Tool invocation (tool + finish action).

@eob eob enabled auto-merge August 30, 2023 16:29
@eob eob disabled auto-merge August 30, 2023 17:20
@eob eob merged commit 7078c76 into main Aug 30, 2023
@eob eob deleted the backstop-on-action-loop branch August 30, 2023 17:20
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.

2 participants