Skip to content

Add a RunBlocked AgentEvent to signal that a run is blocked on hooks#193

Merged
msullivan merged 2 commits into
mainfrom
run-blocked
Jul 8, 2026
Merged

Add a RunBlocked AgentEvent to signal that a run is blocked on hooks#193
msullivan merged 2 commits into
mainfrom
run-blocked

Conversation

@msullivan

Copy link
Copy Markdown
Contributor

A run is blocked when at least one hook is pending, no model stream is
producing events, and every in-flight tool call is suspended awaiting a
hook.

This could be potentially useful in a bunch of cases, but the directly
inciting one is for seal, which is workflow based but talks to the
useChat API. useChat expects the stream to get stopped when a run is
blocked.

We add a RunStateTracker to process the event stream to detect these
events and emit transitions.

We add a tool_call_id to HookPart to support directly matching hooks
with tool calls. We were already extracting this from the name in the
UI adapters so this is strictly more principled than that.

A run is blocked when at least one hook is pending, no model stream is
producing events, and every in-flight tool call is suspended awaiting a
hook.

This could be potentially useful in a bunch of cases, but the directly
inciting one is for seal, which is workflow based but talks to the
useChat API. useChat expects the stream to get stopped when a run is
blocked.

We add a RunStateTracker to process the event stream to detect these
events and emit transitions.

We add a `tool_call_id` to HookPart to support directly matching hooks
with tool calls. We were already extracting this from the name in the
UI adapters so this is strictly more principled than that.
@msullivan
msullivan requested a review from anbuzin July 7, 2026 21:43
@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ai-python Ready Ready Preview, Comment Jul 8, 2026 4:49pm

Comment thread src/ai/agents/ui/ai_sdk/approvals.py Outdated
@msullivan
msullivan merged commit 92c0766 into main Jul 8, 2026
7 checks passed
@msullivan
msullivan deleted the run-blocked branch July 8, 2026 17:18
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.

2 participants