Skip to content

Conversation

pgrayy
Copy link
Member

@pgrayy pgrayy commented Oct 15, 2025

Description

Temporarily warn customers that single agent interrupts are not supported in multi-agent networks.

We do plan to support interrupts in multi-agents, but if customers start using single agent interrupts before then, they should know the limitations.

Related Issues

Documentation PR

Interrupts will be documented once all related PRs are merged.

Type of Change

Other (please describe): Warning to users that interrupt feature is not fully ready.

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

  • I ran hatch run prepare
  • Ran the following test script:
from strands import Agent, tool
from strands.hooks import BeforeToolCallEvent, HookProvider
from strands.multiagent import GraphBuilder

@tool
def my_tool_01() -> str:
    print("MY TOOL 01")
    return "stored data"

@tool
def my_tool_02() -> str:
    print("MY TOOL 02")
    return "logged data"

class ToolInterruptHook(HookProvider):
    def register_hooks(self, registry, **kwargs):
        registry.add_callback(BeforeToolCallEvent, self.interrupt)

    def interrupt(self, event):
        response = event.interrupt("my_interrupt")
        print(f"RESPONSE: {response}")

agent_01 = Agent(name="agent_01", hooks=[ToolInterruptHook()], tools=[my_tool_01], callback_handler=None)
agent_02 = Agent(name="agent_01", tools=[my_tool_02], callback_handler=None)

### GRAPH
builder = GraphBuilder()
builder.add_node(agent_01, "agent_01")
builder.add_node(agent_02, "agent_02")
builder.add_edge("agent_01", "agent_02")
builder.set_entry_point("agent_01")

graph = builder.build()

try:
    graph("Call my tools")
except Exception:
    print(f"NODE 0 - INTERRUPT STATE: {graph.nodes["agent_01"].executor._interrupt_state}")
    print(f"NODE 0 - MESSAGES: {graph.nodes["agent_01"].executor.messages}")
    print(f"NODE 1 - INTERRUPT STATE: {graph.nodes["agent_02"].executor._interrupt_state}")
    print(f"NODE 1 - MESSAGES: {graph.nodes["agent_02"].executor.messages}")

"""
Output:
RuntimeError: user raised interrupt from agent | interrupts are not yet supported in graphs
NODE 0 - INTERRUPT STATE: InterruptState(interrupts={}, context={}, activated=False)
NODE 0 - MESSAGES: [{'role': 'user', 'content': [{'text': 'Call my tools'}]}]
NODE 1 - INTERRUPT STATE: InterruptState(interrupts={}, context={}, activated=False)
NODE 1 - MESSAGES: []
"""

#### SWARM
swarm = Swarm([agent_01, agent_02], entry_point=agent_01)

swarm("Call my tools")
print(f"NODE 0 - INTERRUPT STATE: {swarm.nodes["agent_01"].executor._interrupt_state}")
print(f"NODE 0 - MESSAGES: {swarm.nodes["agent_01"].executor.messages}")
print(f"NODE 1 - INTERRUPT STATE: {swarm.nodes["agent_02"].executor._interrupt_state}")
print(f"NODE 1 - MESSAGES: {swarm.nodes["agent_02"].executor.messages}")

"""
Output:
RuntimeError: user raised interrupt from agent | interrupts are not yet supported in swarms
NODE 0 - INTERRUPT STATE: InterruptState(interrupts={}, context={}, activated=False)
NODE 0 - MESSAGES: [{'role': 'user', 'content': [{'text': "Context:\nUser Request: Call my tools\n\nOther agents available for collaboration:\nAgent name: agent_02.\n\nYou have access to swarm coordination tools if you need help from other agents. If you don't hand off to another agent, the swarm will consider the task complete.\n\n"}]}]
NODE 1 - INTERRUPT STATE: InterruptState(interrupts={}, context={}, activated=False)
NODE 1 - MESSAGES: []
"""

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings: They intentionally do.
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link

codecov bot commented Oct 15, 2025

Codecov Report

❌ Patch coverage is 38.46154% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/strands/multiagent/graph.py 0.00% 3 Missing and 1 partial ⚠️
src/strands/multiagent/swarm.py 0.00% 3 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@pgrayy pgrayy marked this pull request as ready for review October 15, 2025 21:03
Copy link
Member

@Unshure Unshure left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this? What is the behavior today if we interrupt an agent in a graph?

@pgrayy
Copy link
Member Author

pgrayy commented Oct 16, 2025

Why do we need this? What is the behavior today if we interrupt an agent in a graph?

The agent is left in a state that the user can't respond to. Graph and Swarm do not accept interrupt responses and so the user won't be able to move forward from an interrupt. The agent, when prompted, would keep asking for the responses though unless we clear out the interrupt state.

Copy link
Contributor

@mkmeral mkmeral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also create the ticket to support interrupts in multi-agent?

@pgrayy
Copy link
Member Author

pgrayy commented Oct 16, 2025

Can we also create the ticket to support interrupts in multi-agent?

This work is being tracked in #204, which I have linked in the overview above.

@pgrayy pgrayy merged commit 61e41da into strands-agents:main Oct 16, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants