autogen icon indicating copy to clipboard operation
autogen copied to clipboard

Pausing before passing conversation to next agent[Feature Request]:

Open LopezNuance opened this issue 1 year ago • 9 comments

Is your feature request related to a problem? Please describe.

The feature request is related to the issue of managing rate limits. As all are aware OpenAI limits the rate of tokens per second and it is easy to hit that limit without warning. A way to insert a pause (similar in function to the Unix "sleep" command) to allow a set pause to occur before the next agent in a conversation starts processing the output of the previous agent in the conversation would allow for a simple way of avoiding hitting the rate limits for a given account.

Describe the solution you'd like

For instance, in the "Auto Generated Agent Chat: Performs Research with Multi-Agent Group Chat" example it is easy to hit the rate limit as the Coder agent, Critic agent, and Scientist agent discuss how to implement the task of finding papers on LLM applications from arxiv and creating a markdown table of different domains.

The solution I'd like to see is a method to set a pause time, similar in functionality to the Unix "sleep" command, before the output of one agent is sent onto the next agent. This should be easier to implement than a more dynamic 'check to see current number of tokens sent during a window of.....' although ultimately this would be the best solution of all.

Additional context

No response

LopezNuance avatar Jan 12 '24 16:01 LopezNuance

@sonichi Do you think this would have value? If so, where would be the sleep call live in the code, and how should the option be exposed?

rickyloynd-microsoft avatar Jan 12 '24 17:01 rickyloynd-microsoft

This behaviour could be achieved with existing code by registering a hook that just calls sleep.

@rickyloynd-microsoft am I right?

davorrunje avatar Jan 12 '24 20:01 davorrunje

Good point. For instance, the new AgentCapability class could be called CanSleep. It would define a hook and call register_hook to attach it to the existing hookable method, process_last_message, which gets called by generate_reply on every invocation.

rickyloynd-microsoft avatar Jan 12 '24 23:01 rickyloynd-microsoft

@LopezNuance Can we close this?

davorrunje avatar Jan 15 '24 09:01 davorrunje

Has there been any changes? I only see a discussion on how this could be implemented.

LopezNuance avatar Jan 15 '24 17:01 LopezNuance

@LopezNuance this could be implemented on the application level, there is no need to change anything in the framework. If you wish, we could create an example for you.

davorrunje avatar Jan 15 '24 18:01 davorrunje

Ok, I misunderstood the posts, sorry about that. Sure, an example would be great. Then go ahead and close the feature request. Thanks!

LopezNuance avatar Jan 15 '24 18:01 LopezNuance

Just to link #1240 . It would be a piece of cake with middleware.

ekzhu avatar Jan 15 '24 20:01 ekzhu

I see Davor Runje's comment especially applies: https://github.com/microsoft/autogen/pull/1240#issuecomment-1892502988

LopezNuance avatar Jan 15 '24 23:01 LopezNuance

@davorrunje

@LopezNuance this could be implemented on the application level, there is no need to change anything in the framework. If you wish, we could create an example for you.

@davorrunje If you wouldn't mind, could you provide me with an example and then go ahead and close the feature request?

LopezNuance avatar Jan 25 '24 16:01 LopezNuance