Skip to content

feat: support interrupts from AfterToolCallEvent (#1165)#2178

Open
alisknox wants to merge 1 commit intostrands-agents:mainfrom
alisknox:feat/after-tool-call-interrupt
Open

feat: support interrupts from AfterToolCallEvent (#1165)#2178
alisknox wants to merge 1 commit intostrands-agents:mainfrom
alisknox:feat/after-tool-call-interrupt

Conversation

@alisknox
Copy link
Copy Markdown

@alisknox alisknox commented Apr 21, 2026

Add interrupt support to AfterToolCallEvent.

Description

Extend AfterToolCallEvent with the _Interruptible mixin, allowing after-tool hook callbacks to pause agent execution.

On resume, the after-tool hook is replayed with the same event data (tool_use, result, exception, cancel_message) that was present at the time of interruption. The callback receives the interrupt result via event.interrupt() return value, and can then modify the result or request a retry.

Tools do not re-execute on resume unless the replayed hook explicitly sets retry=True.

Related Issues

#1165 (Solves primary use-case, other events interruptible is still nice to have)

Documentation PR

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

Within SSDP, executed the interrupt in the after tool call handler. Successfully re-hydrated and continued with the same context instead of needing the event.retry flag to resume from the before-tool hook.

  • I ran hatch run prepare

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
  • 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.

Add interrupt support to AfterToolCallEvent, enabling human-in-the-loop
workflows after tool execution. This allows hook callbacks to pause agent
execution after inspecting a tool result (e.g., on failure) and resume
with a human response.
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

❌ Patch coverage is 90.74074% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/strands/event_loop/event_loop.py 80.00% 2 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant