Repository navigation
Multi-agent - agent as tools whether supported interrupt tool #1618
Replies: 2 comments 1 reply
|
I have same question. There is some example how to use interrupt in the pattern Agent-As-Tool? The issue 204 seems to implement for others Strands multi-agent features, but not for Agent-as-Tool. My Scenario:
I would like to use the interrupt feature. |
|
The built in agent as tool path does propagate hook interrupts now. Agent.as_tool() returns a tool whose stream method, in strands/agent/_agent_as_tool.py, forwards a sub agent hook interrupt (the docstring gives BeforeToolCallEvent as the example) to the parent as a ToolInterruptEvent, and on resume it forwards the interrupt responses back to the sub agent. Register the sub agent with subagent.as_tool() on the supervisor instead of a hand written @tool that calls the sub agent and returns a string. A plain function tool never yields ToolInterruptEvent, so the approval stops inside the sub agent and the parent only sees a normal tool result or an error. preserve_context matters for resume. The as_tool docstring says that when it is False the orchestrator stores the interrupted turn, and when it is True the sub agent keeps its own state and needs its own session manager or the resume cannot replay that turn. |
Uh oh!
There was an error while loading. Please reload this page.
Multi-agent - agent as tools whether supported interrupt tool
All reactions