Problem Statement
Calling cancel() on an idle agent results in its next invocation being immediately cancelled. There is also no public interface to know whether an agent is idle or not and be able to know whether to cancel or not.
Proposed Solution
Cancel should be updated to internally check whether the agent is idle or not and become a no-op if already idle (not running).
Use Case
Expose stop functionality to end-users and prevent weird behavior such as cancelling an agent just as it becomes idle and then having the next invocation fail (immediately cancelled).
Alternatives Solutions
Leaving it up to users of the library to determine deal with this, possibly by looking at whether self._invocation_lock is locked or not. However this is a private field.
Additional Context
No response
Problem Statement
Calling
cancel()on an idle agent results in its next invocation being immediately cancelled. There is also no public interface to know whether an agent is idle or not and be able to know whether to cancel or not.Proposed Solution
Cancel should be updated to internally check whether the agent is idle or not and become a no-op if already idle (not running).
Use Case
Expose stop functionality to end-users and prevent weird behavior such as cancelling an agent just as it becomes idle and then having the next invocation fail (immediately cancelled).
Alternatives Solutions
Leaving it up to users of the library to determine deal with this, possibly by looking at whether
self._invocation_lockis locked or not. However this is a private field.Additional Context
No response