Skip to content

Commit 971c901

Browse files
committed
fix: dispatch step start when resuming an interrupt
1 parent 5c49784 commit 971c901

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

typescript-sdk/integrations/langgraph/python/ag_ui_langgraph/agent.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ async def _handle_stream_events(self, input: RunAgentInput) -> AsyncGenerator[st
131131
RunStartedEvent(type=EventType.RUN_STARTED, thread_id=thread_id, run_id=self.active_run["id"])
132132
)
133133

134+
# In case of resume (interrupt), re-start resumed step
135+
if resume_input and self.active_run.get("node_name"):
136+
yield self._dispatch_event(
137+
StepStartedEvent(type=EventType.STEP_STARTED, step_name=self.active_run.get("node_name"))
138+
)
139+
134140
state = prepared_stream_response["state"]
135141
stream = prepared_stream_response["stream"]
136142
config = prepared_stream_response["config"]

typescript-sdk/integrations/langgraph/src/agent.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export class LangGraphAgent extends AbstractAgent {
169169
return subscriber.error('No stream to regenerate');
170170
}
171171

172-
this.handleStreamEvents(preparedStream, threadId, subscriber, input, streamMode)
172+
await this.handleStreamEvents(preparedStream, threadId, subscriber, input, streamMode)
173173
}
174174

175175
async prepareRegenerateStream(input: RegenerateInput, streamMode: StreamMode | StreamMode[]) {
@@ -353,6 +353,11 @@ export class LangGraphAgent extends AbstractAgent {
353353
runId: this.activeRun!.id,
354354
});
355355

356+
// In case of resume (interrupt), re-start resumed step
357+
if (forwardedProps?.command?.resume && this.activeRun!.nodeName) {
358+
this.startStep(this.activeRun!.nodeName)
359+
}
360+
356361
for await (let streamResponseChunk of streamResponse) {
357362
// @ts-ignore
358363
if (!streamMode.includes(streamResponseChunk.event as StreamMode)) {

0 commit comments

Comments
 (0)