- Notifications
You must be signed in to change notification settings - Fork 507
interrupts - swarm #1193
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
base: main
Are you sure you want to change the base?
interrupts - swarm #1193
Conversation
7c5dbc8 to 6d6f2ac Compare 6d6f2ac to 50f616e Compare 50f616e to 71589dd Compare Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
71589dd to e302d40 Compare e302d40 to 44437df Compare 44437df to 1f9ef9a Compare 1f9ef9a to ce9efae Compare 95ab9a5 to d0a21ab Compare d0a21ab to 560a6af Compare 560a6af to 4ebc4e3 Compare 4ebc4e3 to 4cc7fdc Compare 4cc7fdc to a523194 Compare a523194 to 2b5a99c Compare | If Swarm is resuming from an interrupt, we reset the executor state from the interrupt context. | ||
| """ | ||
| if self.swarm and self.swarm._interrupt_state.activated: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for if the node agent itself interrupts. The user can raise an interrupt at the swarm level in the BeforeNodeCallEvent hook. They can also raise interrupts in the agent nodes themselves. If raising an interrupt in an agent, we need to restore its interrupt state on resume, which is what we handle here.
| return name in ["cancel_node"] | ||
| | ||
| @override | ||
| def _interrupt_id(self, name: str) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shoot, need to add a check in Graph to temporarily error on use of interrupts. This PR just adds the functionality to Swarm. Graph will be a fast follow. Still, please feel free to review the rest of the PR in the meanwhile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still need to do this. Apologies for the delay. But still please feel free to review.
Description
Adding interrupt (HIL) support to Swarm. Will add support to Graph in a separate PR.
Usage
Note, these are the same interfaces available for single agent interrupts (docs).
BeforeNodeCallEvent Hook
Within Agent
Related Issues
#204
Documentation PR
After closing out PR, will add usage instructions to https://strandsagents.com/latest/documentation/docs/user-guide/concepts/interrupts/
Type of Change
New feature
Testing
How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli
hatch run prepare: Wrote new unit testshatch test tests_integ/interrupts/multiagent/*.py: Wrote new integ testsChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.