Skip to content

Commit 3143d6d

Browse files
committed
fix(langgraph): include the payload with the original user message that is going to be regenerated
1 parent aeda92e commit 3143d6d

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
@@ -688,8 +688,11 @@ async def get_checkpoint_before_message(self, message_id: str, thread_id: str):
688688

689689
snapshot_values_without_messages = snapshot.values.copy()
690690
del snapshot_values_without_messages["messages"]
691-
checkpoint = history_list[idx - 1] # use one snapshot *before* the one that includes the message
692-
checkpoint.values = {**checkpoint.values, **snapshot_values_without_messages}
691+
checkpoint = history_list[idx - 1]
692+
693+
merged_values = {**checkpoint.values, **snapshot_values_without_messages}
694+
checkpoint = checkpoint._replace(values=merged_values)
695+
693696
return checkpoint
694697

695698
raise ValueError("Message ID not found in history")

0 commit comments

Comments
 (0)