Skip to content

Surface agent interrupts as stream events#46

Merged
galuszkm merged 3 commits into
mainfrom
copilot/add-interrupt-event-streaming
May 23, 2026
Merged

Surface agent interrupts as stream events#46
galuszkm merged 3 commits into
mainfrom
copilot/add-interrupt-event-streaming

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 23, 2026

Agent HITL interrupts were only available on AgentResult, leaving streaming consumers unable to distinguish a paused invocation from a generic error. This adds an explicit interrupt event path so SSE/EventQueue clients can collect pending interrupt IDs and resume the agent.

  • Stream event contract

    • Added EventType.INTERRUPT with wire value "interrupt".
    • Documented the new event in streaming event lists.
  • EventPublisher behavior

    • Emits one interrupt StreamEvent per pending interrupt when AfterInvocationEvent.result.stop_reason == "interrupt".
    • Suppresses complete for interrupted invocations, since the session is paused rather than finished.
  • Payload shape

    StreamEvent(
        type=EventType.INTERRUPT,
        agent_name="agent",
        data={
            "interrupt_id": interrupt.id,
            "name": interrupt.name,
            "reason": interrupt.reason,
        },
    )
  • Coverage

    • Added focused tests for interrupt event emission, complete suppression, and enum coverage.

Copilot AI and others added 2 commits May 23, 2026 13:55
Agent-Logs-Url: https://github.com/strands-compose/sdk-python/sessions/8e9b0572-1021-4350-9815-8757ec1b3312

Co-authored-by: galuszkm <53984802+galuszkm@users.noreply.github.com>
Agent-Logs-Url: https://github.com/strands-compose/sdk-python/sessions/8e9b0572-1021-4350-9815-8757ec1b3312

Co-authored-by: galuszkm <53984802+galuszkm@users.noreply.github.com>
Copilot AI changed the title [WIP] Add dedicated InterruptEvent type in EventPublisher Surface agent interrupts as stream events May 23, 2026
Copilot AI requested a review from galuszkm May 23, 2026 13:59
Copy link
Copy Markdown
Member

@galuszkm galuszkm left a comment

Choose a reason for hiding this comment

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

lgtm

@galuszkm galuszkm marked this pull request as ready for review May 23, 2026 14:01
@galuszkm galuszkm merged commit 22f9358 into main May 23, 2026
8 checks passed
@galuszkm galuszkm deleted the copilot/add-interrupt-event-streaming branch May 23, 2026 14:02
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.

[FEATURE] Surface agent interrupts as a dedicated StreamEvent in EventPublisher

2 participants