Skip to content

Commit 4fc9dbd

Browse files
committed
fix: reset active run values to an actual dictionary
1 parent ca9312e commit 4fc9dbd

File tree

1 file changed

+5
-2
lines changed
  • typescript-sdk/integrations/langgraph/python/ag_ui_langgraph

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,13 @@ async def run(self, input: RunAgentInput) -> AsyncGenerator[str, None]:
100100

101101
async def _handle_stream_events(self, input: RunAgentInput) -> AsyncGenerator[str, None]:
102102
thread_id = input.thread_id or str(uuid.uuid4())
103-
self.active_run = {
103+
INITIAL_ACTIVE_RUN = {
104104
"id": input.run_id,
105105
"thread_id": thread_id,
106106
"thinking_process": None,
107+
"node_name": None,
107108
}
109+
self.active_run = INITIAL_ACTIVE_RUN
108110

109111
forwarded_props = input.forwarded_props
110112
node_name_input = forwarded_props.get('node_name', None) if forwarded_props else None
@@ -256,7 +258,8 @@ async def _handle_stream_events(self, input: RunAgentInput) -> AsyncGenerator[st
256258
yield self._dispatch_event(
257259
RunFinishedEvent(type=EventType.RUN_FINISHED, thread_id=thread_id, run_id=self.active_run["id"])
258260
)
259-
self.active_run = None
261+
# Reset active run to how it was before the stream started
262+
self.active_run = INITIAL_ACTIVE_RUN
260263

261264

262265
async def prepare_stream(self, input: RunAgentInput, agent_state: State, config: RunnableConfig):

0 commit comments

Comments
 (0)