Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,15 @@ async def get_checkpoint_before_message(self, message_id: str, thread_id: str):
empty_snapshot = snapshot
empty_snapshot.values["messages"] = []
return empty_snapshot
return history_list[idx - 1] # return one snapshot *before* the one that includes the message

snapshot_values_without_messages = snapshot.values.copy()
del snapshot_values_without_messages["messages"]
checkpoint = history_list[idx - 1]

merged_values = {**checkpoint.values, **snapshot_values_without_messages}
checkpoint = checkpoint._replace(values=merged_values)

return checkpoint

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

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ag-ui-langgraph"
version = "0.0.5"
version = "0.0.6"
description = "Implementation of the AG-UI protocol for LangGraph."
authors = ["Ran Shem Tov <[email protected]>"]
readme = "README.md"
Expand Down
4 changes: 3 additions & 1 deletion typescript-sdk/integrations/langgraph/src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,9 @@ export class LangGraphAgent extends AbstractAgent {

const targetStateIndex = reversed.indexOf(targetState);

return reversed[targetStateIndex - 1] ?? { ...targetState, values: {} };
const { messages, ...targetStateValuesWithoutMessages } = targetState.values as State
const selectedCheckpoint = reversed[targetStateIndex - 1] ?? { ...targetState, values: {} }
return { ...selectedCheckpoint, values: { ...selectedCheckpoint.values, ...targetStateValuesWithoutMessages } };
}
}

Expand Down