-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Is your feature request related to a problem? Please describe.
Currently when the task is running the only way to change that is to cancel it. We should allow pausing and resuming as well.
There are two main usecases i see for this capability are:
- user initiated pause - maybe the user wants to pause because active running costs money and the user is unsure if he wants to proceed. maybe the agent is doing something to early and the user wants it to wait.
- agent initiated pause - user calls agent A which in turn delegates work in parallel to agents B and C. agent B requires additional data, so agent A pauses agent C and goes into input-required state awaiting user input. once the data is provided agent A wakes up, provides the data to agent B and resumes agent C.
This change is non-breaking: existing agents will default to present pause_resume capability as false and will fail on pause/resume calls.
Describe the solution you'd like
See PR. We introduce PauseTask and ResumeTask, with schemas identical to CancelTask.
Additionally we introduce a new AgentCapability flag pause_resume to indicate whether an agent supports them and a new state PAUSED indicating that a task was paused.
PauseTask and ResumeTask should return an error if pause_resume is false.
PauseTask should return success if task is already paused, pause the task if the task is working or submitted and return error for every other state.
ResumeTask should return success if task is running, resume the task if it's paused and return error for every other state.
All other methods should behave the same for a paused task as for a working task.
Describe alternatives you've considered
An alternative would be to cancel the task and then start a new one with the same context, effectively "restarting it under a new name". This is non-explicit behaviour that might not work, depending on the agent framework implementation. It is however simpler and doesn't require new methods.
Additional context
No response
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
Type
Projects
Status