From a1c856c088712147e76eaffdd67722df82891260 Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Tue, 17 Jun 2025 17:28:52 -0700 Subject: [PATCH] Reduce extraneous keys in checkpoint.metadata - Leave it up to each checkpointer implementation to decide whether to merge in configurable/metadata (previously PregelLoop would do some of this always) - Never copy over internal langgraph keys into checkpoint.metadata (these are redundant/misleading to include) --- libs/checkpoint-postgres/tests/test_async.py | 1 - libs/checkpoint-postgres/tests/test_sync.py | 1 - .../checkpoint-sqlite/tests/test_aiosqlite.py | 12 +- libs/checkpoint-sqlite/tests/test_sqlite.py | 12 +- .../langgraph/checkpoint/base/__init__.py | 12 +- libs/checkpoint/tests/test_memory.py | 23 +-- libs/langgraph/langgraph/pregel/__init__.py | 20 +-- libs/langgraph/langgraph/pregel/loop.py | 6 - .../tests/test_checkpoint_migration.py | 24 --- libs/langgraph/tests/test_large_cases.py | 157 ------------------ .../langgraph/tests/test_large_cases_async.py | 122 -------------- libs/langgraph/tests/test_pregel.py | 13 -- libs/langgraph/tests/test_pregel_async.py | 34 ---- libs/prebuilt/tests/test_react_agent.py | 2 - 14 files changed, 23 insertions(+), 416 deletions(-) diff --git a/libs/checkpoint-postgres/tests/test_async.py b/libs/checkpoint-postgres/tests/test_async.py index 905aa8968..9027307f6 100644 --- a/libs/checkpoint-postgres/tests/test_async.py +++ b/libs/checkpoint-postgres/tests/test_async.py @@ -228,7 +228,6 @@ async def test_combined_metadata(saver_name: str, test_data) -> None: checkpoint = await saver.aget_tuple(config) assert checkpoint.metadata == { **metadata, - "thread_id": "thread-2", "run_id": "my_run_id", } diff --git a/libs/checkpoint-postgres/tests/test_sync.py b/libs/checkpoint-postgres/tests/test_sync.py index b010b5bbe..3c212135d 100644 --- a/libs/checkpoint-postgres/tests/test_sync.py +++ b/libs/checkpoint-postgres/tests/test_sync.py @@ -210,7 +210,6 @@ def test_combined_metadata(saver_name: str, test_data) -> None: checkpoint = saver.get_tuple(config) assert checkpoint.metadata == { **metadata, - "thread_id": "thread-2", "run_id": "my_run_id", } diff --git a/libs/checkpoint-sqlite/tests/test_aiosqlite.py b/libs/checkpoint-sqlite/tests/test_aiosqlite.py index 503b7ade2..5a471aef4 100644 --- a/libs/checkpoint-sqlite/tests/test_aiosqlite.py +++ b/libs/checkpoint-sqlite/tests/test_aiosqlite.py @@ -71,7 +71,6 @@ class TestAsyncSqliteSaver: checkpoint = await saver.aget_tuple(config) assert checkpoint is not None and checkpoint.metadata == { **self.metadata_2, - "thread_id": "thread-2", "run_id": "my_run_id", } @@ -92,18 +91,11 @@ class TestAsyncSqliteSaver: search_results_1 = [c async for c in saver.alist(None, filter=query_1)] assert len(search_results_1) == 1 - assert search_results_1[0].metadata == { - "thread_id": "thread-1", - "thread_ts": "1", - **self.metadata_1, - } + assert search_results_1[0].metadata == self.metadata_1 search_results_2 = [c async for c in saver.alist(None, filter=query_2)] assert len(search_results_2) == 1 - assert search_results_2[0].metadata == { - "thread_id": "thread-2", - **self.metadata_2, - } + assert search_results_2[0].metadata == self.metadata_2 search_results_3 = [c async for c in saver.alist(None, filter=query_3)] assert len(search_results_3) == 3 diff --git a/libs/checkpoint-sqlite/tests/test_sqlite.py b/libs/checkpoint-sqlite/tests/test_sqlite.py index 2a027fa3b..b672c54d9 100644 --- a/libs/checkpoint-sqlite/tests/test_sqlite.py +++ b/libs/checkpoint-sqlite/tests/test_sqlite.py @@ -72,7 +72,6 @@ class TestSqliteSaver: checkpoint = saver.get_tuple(config) assert checkpoint is not None and checkpoint.metadata == { **self.metadata_2, - "thread_id": "thread-2", "run_id": "my_run_id", } @@ -95,18 +94,11 @@ class TestSqliteSaver: search_results_1 = list(saver.list(None, filter=query_1)) assert len(search_results_1) == 1 - assert search_results_1[0].metadata == { - "thread_id": "thread-1", - "thread_ts": "1", - **self.metadata_1, - } + assert search_results_1[0].metadata == self.metadata_1 search_results_2 = list(saver.list(None, filter=query_2)) assert len(search_results_2) == 1 - assert search_results_2[0].metadata == { - "thread_id": "thread-2", - **self.metadata_2, - } + assert search_results_2[0].metadata == self.metadata_2 search_results_3 = list(saver.list(None, filter=query_3)) assert len(search_results_3) == 3 diff --git a/libs/checkpoint/langgraph/checkpoint/base/__init__.py b/libs/checkpoint/langgraph/checkpoint/base/__init__.py index e9350a993..9719118d2 100644 --- a/libs/checkpoint/langgraph/checkpoint/base/__init__.py +++ b/libs/checkpoint/langgraph/checkpoint/base/__init__.py @@ -392,11 +392,10 @@ def get_checkpoint_metadata( for obj in (config.get("metadata"), config.get("configurable")): if not obj: continue - for key in obj: + for key, v in obj.items(): if key in metadata or key in EXCLUDED_METADATA_KEYS or key.startswith("__"): continue - v = obj[key] - if isinstance(v, str): + elif isinstance(v, str): metadata[key] = v.replace("\u0000", "") elif isinstance(v, (int, bool, float)): metadata[key] = v @@ -413,9 +412,16 @@ Each Checkpointer implementation should use this mapping in put_writes. WRITES_IDX_MAP = {ERROR: -1, SCHEDULED: -2, INTERRUPT: -3, RESUME: -4} EXCLUDED_METADATA_KEYS = { + "thread_id", + "thread_ts", "checkpoint_id", "checkpoint_ns", "checkpoint_map", + "langgraph_step", + "langgraph_node", + "langgraph_triggers", + "langgraph_path", + "langgraph_checkpoint_ns", } # --- below are deprecated utilities used by past versions of LangGraph --- diff --git a/libs/checkpoint/tests/test_memory.py b/libs/checkpoint/tests/test_memory.py index ad2dbdb1e..4893a3d59 100644 --- a/libs/checkpoint/tests/test_memory.py +++ b/libs/checkpoint/tests/test_memory.py @@ -75,7 +75,6 @@ class TestMemorySaver: assert checkpoint is not None assert checkpoint.metadata == { **self.metadata_2, - "thread_id": "thread-2", "run_id": "my_run_id", } @@ -112,18 +111,11 @@ class TestMemorySaver: search_results_1 = list(self.memory_saver.list(None, filter=query_1)) assert len(search_results_1) == 1 - assert search_results_1[0].metadata == { - "thread_id": "thread-1", - "thread_ts": "1", - **self.metadata_1, - } + assert search_results_1[0].metadata == self.metadata_1 search_results_2 = list(self.memory_saver.list(None, filter=query_2)) assert len(search_results_2) == 1 - assert search_results_2[0].metadata == { - "thread_id": "thread-2", - **self.metadata_2, - } + assert search_results_2[0].metadata == self.metadata_2 search_results_3 = list(self.memory_saver.list(None, filter=query_3)) assert len(search_results_3) == 3 @@ -178,20 +170,13 @@ class TestMemorySaver: c async for c in self.memory_saver.alist(None, filter=query_1) ] assert len(search_results_1) == 1 - assert search_results_1[0].metadata == { - "thread_id": "thread-1", - "thread_ts": "1", - **self.metadata_1, - } + assert search_results_1[0].metadata == self.metadata_1 search_results_2 = [ c async for c in self.memory_saver.alist(None, filter=query_2) ] assert len(search_results_2) == 1 - assert search_results_2[0].metadata == { - "thread_id": "thread-2", - **self.metadata_2, - } + assert search_results_2[0].metadata == self.metadata_2 search_results_3 = [ c async for c in self.memory_saver.alist(None, filter=query_3) diff --git a/libs/langgraph/langgraph/pregel/__init__.py b/libs/langgraph/langgraph/pregel/__init__.py index 5cf977637..e8fa34ade 100644 --- a/libs/langgraph/langgraph/pregel/__init__.py +++ b/libs/langgraph/langgraph/pregel/__init__.py @@ -1415,10 +1415,8 @@ class Pregel(PregelProtocol[StateT, InputT, OutputT], Generic[StateT, InputT, Ou ) }, ) - checkpoint_metadata = config["metadata"] if saved: checkpoint_config = patch_configurable(config, saved.config[CONF]) - checkpoint_metadata = {**saved.metadata, **checkpoint_metadata} channels, managed = channels_from_checkpoint( self.channels, checkpoint, @@ -1483,7 +1481,6 @@ class Pregel(PregelProtocol[StateT, InputT, OutputT], Generic[StateT, InputT, Ou checkpoint_config, create_checkpoint(checkpoint, None, step), { - **checkpoint_metadata, "source": "update", "step": step + 1, "parents": saved.metadata.get("parents", {}) if saved else {}, @@ -1506,7 +1503,6 @@ class Pregel(PregelProtocol[StateT, InputT, OutputT], Generic[StateT, InputT, Ou checkpoint_config, next_checkpoint, { - **checkpoint_metadata, "source": "update", "step": step + 1, "parents": saved.metadata.get("parents", {}) if saved else {}, @@ -1543,9 +1539,11 @@ class Pregel(PregelProtocol[StateT, InputT, OutputT], Generic[StateT, InputT, Ou checkpoint_config, create_checkpoint(checkpoint, channels, next_step), { - **checkpoint_metadata, "source": "input", "step": next_step, + "parents": saved.metadata.get("parents", {}) + if saved + else {}, }, get_new_channel_versions( checkpoint_previous_versions, @@ -1581,7 +1579,6 @@ class Pregel(PregelProtocol[StateT, InputT, OutputT], Generic[StateT, InputT, Ou saved.parent_config or saved.config if saved else checkpoint_config, next_checkpoint, { - **checkpoint_metadata, "source": "fork", "step": step + 1, "parents": saved.metadata.get("parents", {}) if saved else {}, @@ -1743,7 +1740,6 @@ class Pregel(PregelProtocol[StateT, InputT, OutputT], Generic[StateT, InputT, Ou checkpoint_config, checkpoint, { - **checkpoint_metadata, "source": "update", "step": step + 1, "parents": saved.metadata.get("parents", {}) if saved else {}, @@ -1837,10 +1833,8 @@ class Pregel(PregelProtocol[StateT, InputT, OutputT], Generic[StateT, InputT, Ou ) }, ) - checkpoint_metadata = config["metadata"] if saved: checkpoint_config = patch_configurable(config, saved.config[CONF]) - checkpoint_metadata = {**saved.metadata, **checkpoint_metadata} channels, managed = channels_from_checkpoint( self.channels, checkpoint, @@ -1903,7 +1897,6 @@ class Pregel(PregelProtocol[StateT, InputT, OutputT], Generic[StateT, InputT, Ou checkpoint_config, create_checkpoint(checkpoint, None, step), { - **checkpoint_metadata, "source": "update", "step": step + 1, "parents": saved.metadata.get("parents", {}) if saved else {}, @@ -1926,7 +1919,6 @@ class Pregel(PregelProtocol[StateT, InputT, OutputT], Generic[StateT, InputT, Ou checkpoint_config, next_checkpoint, { - **checkpoint_metadata, "source": "update", "step": step + 1, "parents": saved.metadata.get("parents", {}) if saved else {}, @@ -1963,9 +1955,11 @@ class Pregel(PregelProtocol[StateT, InputT, OutputT], Generic[StateT, InputT, Ou checkpoint_config, create_checkpoint(checkpoint, channels, next_step), { - **checkpoint_metadata, "source": "input", "step": next_step, + "parents": saved.metadata.get("parents", {}) + if saved + else {}, }, get_new_channel_versions( checkpoint_previous_versions, @@ -2001,7 +1995,6 @@ class Pregel(PregelProtocol[StateT, InputT, OutputT], Generic[StateT, InputT, Ou saved.parent_config or saved.config if saved else checkpoint_config, next_checkpoint, { - **checkpoint_metadata, "source": "fork", "step": step + 1, "parents": saved.metadata.get("parents", {}) if saved else {}, @@ -2161,7 +2154,6 @@ class Pregel(PregelProtocol[StateT, InputT, OutputT], Generic[StateT, InputT, Ou checkpoint_config, checkpoint, { - **checkpoint_metadata, "source": "update", "step": step + 1, "parents": saved.metadata.get("parents", {}) if saved else {}, diff --git a/libs/langgraph/langgraph/pregel/loop.py b/libs/langgraph/langgraph/pregel/loop.py index 5ff4771b3..4549d2244 100644 --- a/libs/langgraph/langgraph/pregel/loop.py +++ b/libs/langgraph/langgraph/pregel/loop.py @@ -30,7 +30,6 @@ from typing_extensions import ParamSpec, Self from langgraph.cache.base import BaseCache from langgraph.channels.base import BaseChannel from langgraph.checkpoint.base import ( - EXCLUDED_METADATA_KEYS, WRITES_IDX_MAP, BaseCheckpointSaver, ChannelVersions, @@ -721,11 +720,6 @@ class PregelLoop: ) # bail if no checkpointer if do_checkpoint and self._checkpointer_put_after_previous is not None: - for k, v in self.config["metadata"].items(): - if k in EXCLUDED_METADATA_KEYS: - continue - metadata.setdefault(k, v) # type: ignore - self.prev_checkpoint_config = ( self.checkpoint_config if CONFIG_KEY_CHECKPOINT_ID in self.checkpoint_config[CONF] diff --git a/libs/langgraph/tests/test_checkpoint_migration.py b/libs/langgraph/tests/test_checkpoint_migration.py index 85229c7a8..1f3b47c13 100644 --- a/libs/langgraph/tests/test_checkpoint_migration.py +++ b/libs/langgraph/tests/test_checkpoint_migration.py @@ -43,7 +43,6 @@ def get_expected_history(*, exc_task_results: int = 0) -> list[StateSnapshot]: "source": "loop", "step": 4, "parents": {}, - "thread_id": "1", }, created_at=AnyStr(), parent_config={ @@ -73,7 +72,6 @@ def get_expected_history(*, exc_task_results: int = 0) -> list[StateSnapshot]: "source": "loop", "step": 3, "parents": {}, - "thread_id": "1", }, created_at=AnyStr(), parent_config={ @@ -131,7 +129,6 @@ def get_expected_history(*, exc_task_results: int = 0) -> list[StateSnapshot]: "source": "loop", "step": 2, "parents": {}, - "thread_id": "1", }, created_at=AnyStr(), parent_config={ @@ -168,7 +165,6 @@ def get_expected_history(*, exc_task_results: int = 0) -> list[StateSnapshot]: "source": "loop", "step": 1, "parents": {}, - "thread_id": "1", }, created_at=AnyStr(), parent_config={ @@ -218,7 +214,6 @@ def get_expected_history(*, exc_task_results: int = 0) -> list[StateSnapshot]: "source": "loop", "step": 0, "parents": {}, - "thread_id": "1", }, created_at=AnyStr(), parent_config={ @@ -257,7 +252,6 @@ def get_expected_history(*, exc_task_results: int = 0) -> list[StateSnapshot]: "source": "input", "step": -1, "parents": {}, - "thread_id": "1", }, created_at=AnyStr(), parent_config=None, @@ -343,7 +337,6 @@ SAVED_CHECKPOINTS = { "source": "loop", "step": 4, "parents": {}, - "thread_id": "1", }, parent_config={ "configurable": { @@ -404,7 +397,6 @@ SAVED_CHECKPOINTS = { "source": "loop", "step": 3, "parents": {}, - "thread_id": "1", }, parent_config={ "configurable": { @@ -480,7 +472,6 @@ SAVED_CHECKPOINTS = { "source": "loop", "step": 2, "parents": {}, - "thread_id": "1", }, parent_config={ "configurable": { @@ -532,7 +523,6 @@ SAVED_CHECKPOINTS = { "source": "loop", "step": 1, "parents": {}, - "thread_id": "1", }, parent_config={ "configurable": { @@ -587,7 +577,6 @@ SAVED_CHECKPOINTS = { "source": "loop", "step": 0, "parents": {}, - "thread_id": "1", }, parent_config={ "configurable": { @@ -636,7 +625,6 @@ SAVED_CHECKPOINTS = { "source": "input", "step": -1, "parents": {}, - "thread_id": "1", }, parent_config=None, pending_writes=[ @@ -720,7 +708,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "thread_id": "1", "step": 4, "parents": {}, }, @@ -782,7 +769,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "thread_id": "1", "step": 3, "parents": {}, }, @@ -861,7 +847,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "thread_id": "1", "step": 2, "parents": {}, }, @@ -917,7 +902,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "thread_id": "1", "step": 1, "parents": {}, }, @@ -977,7 +961,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "thread_id": "1", "step": 0, "parents": {}, }, @@ -1026,7 +1009,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "input", - "thread_id": "1", "step": -1, "parents": {}, }, @@ -1112,7 +1094,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "thread_id": "1", "step": 4, "parents": {}, }, @@ -1174,7 +1155,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "thread_id": "1", "step": 3, "parents": {}, }, @@ -1253,7 +1233,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "thread_id": "1", "step": 2, "parents": {}, }, @@ -1309,7 +1288,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "thread_id": "1", "step": 1, "parents": {}, }, @@ -1369,7 +1347,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "thread_id": "1", "step": 0, "parents": {}, }, @@ -1418,7 +1395,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "input", - "thread_id": "1", "step": -1, "parents": {}, }, diff --git a/libs/langgraph/tests/test_large_cases.py b/libs/langgraph/tests/test_large_cases.py index 2c45e4f89..c50e2d1ed 100644 --- a/libs/langgraph/tests/test_large_cases.py +++ b/libs/langgraph/tests/test_large_cases.py @@ -126,7 +126,6 @@ def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "loop", "step": 6, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[1].config, @@ -147,7 +146,6 @@ def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "loop", "step": 5, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[2].config, @@ -168,7 +166,6 @@ def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "input", "step": 4, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[3].config, @@ -189,7 +186,6 @@ def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "loop", "step": 3, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[4].config, @@ -210,7 +206,6 @@ def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "input", "step": 2, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[5].config, @@ -231,7 +226,6 @@ def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "loop", "step": 1, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[6].config, @@ -252,7 +246,6 @@ def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "loop", "step": 0, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[7].config, @@ -273,7 +266,6 @@ def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "input", "step": -1, - "thread_id": "1", }, created_at=AnyStr(), parent_config=None, @@ -342,7 +334,6 @@ def test_fork_always_re_runs_nodes( "parents": {}, "source": "loop", "step": 5, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[1].config, @@ -363,7 +354,6 @@ def test_fork_always_re_runs_nodes( "parents": {}, "source": "loop", "step": 4, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[2].config, @@ -384,7 +374,6 @@ def test_fork_always_re_runs_nodes( "parents": {}, "source": "loop", "step": 3, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[3].config, @@ -405,7 +394,6 @@ def test_fork_always_re_runs_nodes( "parents": {}, "source": "loop", "step": 2, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[4].config, @@ -426,7 +414,6 @@ def test_fork_always_re_runs_nodes( "parents": {}, "source": "loop", "step": 1, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[5].config, @@ -447,7 +434,6 @@ def test_fork_always_re_runs_nodes( "parents": {}, "source": "loop", "step": 0, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[6].config, @@ -468,7 +454,6 @@ def test_fork_always_re_runs_nodes( "parents": {}, "source": "input", "step": -1, - "thread_id": "1", }, created_at=AnyStr(), parent_config=None, @@ -714,7 +699,6 @@ def test_conditional_state_graph( "parents": {}, "source": "loop", "step": 1, - "thread_id": "1", }, parent_config=None, interrupts=(), @@ -754,7 +738,6 @@ def test_conditional_state_graph( "parents": {}, "source": "update", "step": 2, - "thread_id": "1", }, parent_config=( list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config @@ -830,7 +813,6 @@ def test_conditional_state_graph( "parents": {}, "source": "update", "step": 5, - "thread_id": "1", }, parent_config=( list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config @@ -882,7 +864,6 @@ def test_conditional_state_graph( "parents": {}, "source": "loop", "step": 1, - "thread_id": "2", }, parent_config=None, interrupts=(), @@ -922,7 +903,6 @@ def test_conditional_state_graph( "parents": {}, "source": "update", "step": 2, - "thread_id": "2", }, parent_config=( list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config @@ -998,7 +978,6 @@ def test_conditional_state_graph( "parents": {}, "source": "update", "step": 5, - "thread_id": "2", }, parent_config=( list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config @@ -1039,7 +1018,6 @@ def test_conditional_state_graph( "parents": {}, "source": "loop", "step": 0, - "thread_id": "3", }, parent_config=None, interrupts=(), @@ -1077,7 +1055,6 @@ def test_conditional_state_graph( "parents": {}, "source": "loop", "step": 1, - "thread_id": "3", }, parent_config=( list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config @@ -1133,7 +1110,6 @@ def test_conditional_state_graph( "parents": {}, "source": "loop", "step": 2, - "thread_id": "3", }, parent_config=( list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config @@ -1196,7 +1172,6 @@ def test_conditional_state_graph( "parents": {}, "source": "loop", "step": 1, - "thread_id": "4", }, parent_config=None, interrupts=(), @@ -1250,7 +1225,6 @@ def test_conditional_state_graph( "parents": {}, "source": "loop", "step": 2, - "thread_id": "4", }, parent_config=( list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config @@ -1915,7 +1889,6 @@ def test_state_graph_packets( "parents": {}, "source": "loop", "step": 1, - "thread_id": "1", }, parent_config=None, interrupts=(), @@ -1960,7 +1933,6 @@ def test_state_graph_packets( "parents": {}, "source": "update", "step": 2, - "thread_id": "1", }, parent_config=( [*app_w_interrupt.checkpointer.list(config, limit=2)][-1].config @@ -2056,7 +2028,6 @@ def test_state_graph_packets( "parents": {}, "source": "loop", "step": 4, - "thread_id": "1", }, parent_config=( [*app_w_interrupt.checkpointer.list(config, limit=2)][-1].config @@ -2110,7 +2081,6 @@ def test_state_graph_packets( "parents": {}, "source": "update", "step": 5, - "thread_id": "1", }, parent_config=( [*app_w_interrupt.checkpointer.list(config, limit=2)][-1].config @@ -2182,7 +2152,6 @@ def test_state_graph_packets( "parents": {}, "source": "loop", "step": 1, - "thread_id": "2", }, parent_config=None, interrupts=(), @@ -2221,7 +2190,6 @@ def test_state_graph_packets( "parents": {}, "source": "update", "step": 2, - "thread_id": "2", }, parent_config=( [*app_w_interrupt.checkpointer.list(config, limit=2)][-1].config @@ -2317,7 +2285,6 @@ def test_state_graph_packets( "parents": {}, "source": "loop", "step": 4, - "thread_id": "2", }, parent_config=( [*app_w_interrupt.checkpointer.list(config, limit=2)][-1].config @@ -2371,7 +2338,6 @@ def test_state_graph_packets( "parents": {}, "source": "update", "step": 5, - "thread_id": "2", }, parent_config=( [*app_w_interrupt.checkpointer.list(config, limit=2)][-1].config @@ -2647,7 +2613,6 @@ def test_message_graph( "parents": {}, "source": "loop", "step": 1, - "thread_id": "1", }, parent_config=None, interrupts=(), @@ -2682,7 +2647,6 @@ def test_message_graph( "parents": {}, "source": "update", "step": 2, - "thread_id": "1", }, parent_config=( list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config @@ -2761,7 +2725,6 @@ def test_message_graph( "parents": {}, "source": "loop", "step": 4, - "thread_id": "1", }, parent_config=( list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config @@ -2810,7 +2773,6 @@ def test_message_graph( "parents": {}, "source": "update", "step": 5, - "thread_id": "1", }, parent_config=( list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config @@ -2871,7 +2833,6 @@ def test_message_graph( "parents": {}, "source": "loop", "step": 1, - "thread_id": "2", }, parent_config=None, interrupts=(), @@ -2912,7 +2873,6 @@ def test_message_graph( "parents": {}, "source": "update", "step": 2, - "thread_id": "2", }, parent_config=( list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config @@ -2991,7 +2951,6 @@ def test_message_graph( "parents": {}, "source": "loop", "step": 4, - "thread_id": "2", }, parent_config=( list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config @@ -3041,7 +3000,6 @@ def test_message_graph( "parents": {}, "source": "update", "step": 5, - "thread_id": "2", }, parent_config=( list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config @@ -3091,7 +3049,6 @@ def test_message_graph( "parents": {}, "source": "update", "step": 6, - "thread_id": "2", }, parent_config=( list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config @@ -3370,7 +3327,6 @@ def test_root_graph( "parents": {}, "source": "loop", "step": 1, - "thread_id": "1", }, parent_config=None, interrupts=(), @@ -3405,7 +3361,6 @@ def test_root_graph( "parents": {}, "source": "update", "step": 2, - "thread_id": "1", }, parent_config=( list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config @@ -3485,7 +3440,6 @@ def test_root_graph( "parents": {}, "source": "loop", "step": 4, - "thread_id": "1", }, parent_config=( list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config @@ -3535,7 +3489,6 @@ def test_root_graph( "parents": {}, "source": "update", "step": 5, - "thread_id": "1", }, parent_config=( list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config @@ -3596,7 +3549,6 @@ def test_root_graph( "parents": {}, "source": "loop", "step": 1, - "thread_id": "2", }, parent_config=None, interrupts=(), @@ -3637,7 +3589,6 @@ def test_root_graph( "parents": {}, "source": "update", "step": 2, - "thread_id": "2", }, parent_config=( list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config @@ -3717,7 +3668,6 @@ def test_root_graph( "parents": {}, "source": "loop", "step": 4, - "thread_id": "2", }, parent_config=( list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config @@ -3766,7 +3716,6 @@ def test_root_graph( "parents": {}, "source": "update", "step": 5, - "thread_id": "2", }, parent_config=( list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config @@ -3816,7 +3765,6 @@ def test_root_graph( "parents": {}, "source": "update", "step": 6, - "thread_id": "2", }, parent_config=( list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config @@ -3897,7 +3845,6 @@ def test_root_graph( "parents": {}, "source": "update", "step": 6, - "thread_id": "2", }, parent_config=(list(new_app.checkpointer.list(config, limit=2))[-1].config), interrupts=(), @@ -4253,7 +4200,6 @@ def test_dynamic_interrupt(sync_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 0, - "thread_id": "1", }, ] @@ -4286,7 +4232,6 @@ def test_dynamic_interrupt(sync_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 0, - "thread_id": "1", }, parent_config=None, interrupts=( @@ -4316,7 +4261,6 @@ def test_dynamic_interrupt(sync_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "update", "step": 1, - "thread_id": "1", }, parent_config=(list(tool_two.checkpointer.list(thread1, limit=2))[-1].config), interrupts=(), @@ -4420,7 +4364,6 @@ def test_copy_checkpoint(sync_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 0, - "thread_id": "1", }, ] @@ -4459,7 +4402,6 @@ def test_copy_checkpoint(sync_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 0, - "thread_id": "1", }, parent_config=None, interrupts=( @@ -4505,7 +4447,6 @@ def test_copy_checkpoint(sync_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "fork", "step": 1, - "thread_id": "1", }, parent_config=([*tool_two.checkpointer.list(thread1, limit=2)][-1].config), interrupts=(), @@ -4619,7 +4560,6 @@ def test_dynamic_interrupt_subgraph(sync_checkpointer: BaseCheckpointSaver) -> N "parents": {}, "source": "loop", "step": 0, - "thread_id": "1", }, ] @@ -4658,7 +4598,6 @@ def test_dynamic_interrupt_subgraph(sync_checkpointer: BaseCheckpointSaver) -> N "parents": {}, "source": "loop", "step": 0, - "thread_id": "1", }, parent_config=None, interrupts=( @@ -4688,7 +4627,6 @@ def test_dynamic_interrupt_subgraph(sync_checkpointer: BaseCheckpointSaver) -> N "parents": {}, "source": "update", "step": 1, - "thread_id": "1", }, parent_config=( list( @@ -4819,7 +4757,6 @@ def test_send_dedupe_on_resume( }, metadata={ "source": "loop", - "thread_id": "1", "step": 4, "parents": {}, }, @@ -4855,7 +4792,6 @@ def test_send_dedupe_on_resume( }, metadata={ "source": "loop", - "thread_id": "1", "step": 3, "parents": {}, }, @@ -4898,7 +4834,6 @@ def test_send_dedupe_on_resume( }, metadata={ "source": "loop", - "thread_id": "1", "step": 2, "parents": {}, }, @@ -4953,7 +4888,6 @@ def test_send_dedupe_on_resume( }, metadata={ "source": "loop", - "thread_id": "1", "step": 1, "parents": {}, }, @@ -5008,7 +4942,6 @@ def test_send_dedupe_on_resume( }, metadata={ "source": "loop", - "thread_id": "1", "step": 0, "parents": {}, }, @@ -5045,7 +4978,6 @@ def test_send_dedupe_on_resume( }, metadata={ "source": "input", - "thread_id": "1", "step": -1, "parents": {}, }, @@ -5148,7 +5080,6 @@ def test_nested_graph_state(sync_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 1, - "thread_id": "1", }, created_at=AnyStr(), parent_config=None, @@ -5193,12 +5124,6 @@ def test_nested_graph_state(sync_checkpointer: BaseCheckpointSaver) -> None: }, "source": "loop", "step": 1, - "thread_id": "1", - "langgraph_node": "inner", - "langgraph_path": [PULL, "inner"], - "langgraph_step": 2, - "langgraph_triggers": ["branch:to:inner"], - "langgraph_checkpoint_ns": AnyStr("inner:"), }, created_at=AnyStr(), parent_config=None, @@ -5218,7 +5143,6 @@ def test_nested_graph_state(sync_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 1, - "thread_id": "1", }, created_at=AnyStr(), parent_config=None, @@ -5245,12 +5169,6 @@ def test_nested_graph_state(sync_checkpointer: BaseCheckpointSaver) -> None: "source": "loop", "step": 1, "parents": {"": AnyStr()}, - "thread_id": "1", - "langgraph_node": "inner", - "langgraph_path": [PULL, "inner"], - "langgraph_step": 2, - "langgraph_triggers": ["branch:to:inner"], - "langgraph_checkpoint_ns": AnyStr("inner:"), }, created_at=AnyStr(), parent_config=None, @@ -5278,7 +5196,6 @@ def test_nested_graph_state(sync_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 3, - "thread_id": "1", }, created_at=AnyStr(), parent_config=( @@ -5310,7 +5227,6 @@ def test_nested_graph_state(sync_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 3, - "thread_id": "1", }, created_at=AnyStr(), parent_config=( @@ -5349,7 +5265,6 @@ def test_nested_graph_state(sync_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 1, - "thread_id": "1", }, created_at=AnyStr(), parent_config=None, @@ -5454,7 +5369,6 @@ def test_doubly_nested_graph_state( "parents": {}, "source": "loop", "step": 1, - "thread_id": "1", }, created_at=AnyStr(), parent_config=None, @@ -5491,15 +5405,9 @@ def test_doubly_nested_graph_state( } }, metadata={ - "langgraph_checkpoint_ns": AnyStr("child:"), - "langgraph_node": "child", - "langgraph_path": ["__pregel_pull", "child"], - "langgraph_step": 2, - "langgraph_triggers": ["branch:to:child"], "parents": {"": AnyStr()}, "source": "loop", "step": 0, - "thread_id": "1", }, created_at=AnyStr(), parent_config=None, @@ -5539,12 +5447,6 @@ def test_doubly_nested_graph_state( ), "source": "loop", "step": 1, - "thread_id": "1", - "langgraph_checkpoint_ns": AnyStr("child:"), - "langgraph_node": "child_1", - "langgraph_path": [PULL, AnyStr("child_1")], - "langgraph_step": 1, - "langgraph_triggers": ["branch:to:child_1"], }, created_at=AnyStr(), parent_config=None, @@ -5600,17 +5502,6 @@ def test_doubly_nested_graph_state( ), "source": "loop", "step": 1, - "thread_id": "1", - "langgraph_checkpoint_ns": AnyStr("child:"), - "langgraph_node": "child_1", - "langgraph_path": [ - PULL, - AnyStr("child_1"), - ], - "langgraph_step": 1, - "langgraph_triggers": [ - "branch:to:child_1", - ], }, created_at=AnyStr(), parent_config=None, @@ -5633,12 +5524,6 @@ def test_doubly_nested_graph_state( "parents": {"": AnyStr()}, "source": "loop", "step": 0, - "thread_id": "1", - "langgraph_node": "child", - "langgraph_path": [PULL, AnyStr("child")], - "langgraph_step": 2, - "langgraph_triggers": ["branch:to:child"], - "langgraph_checkpoint_ns": AnyStr("child:"), }, created_at=AnyStr(), parent_config=None, @@ -5658,7 +5543,6 @@ def test_doubly_nested_graph_state( "parents": {}, "source": "loop", "step": 1, - "thread_id": "1", }, created_at=AnyStr(), parent_config=None, @@ -5693,7 +5577,6 @@ def test_doubly_nested_graph_state( "parents": {}, "source": "loop", "step": 3, - "thread_id": "1", }, created_at=AnyStr(), parent_config=( @@ -5727,7 +5610,6 @@ def test_doubly_nested_graph_state( "parents": {}, "source": "loop", "step": 3, - "thread_id": "1", }, created_at=AnyStr(), parent_config={ @@ -5767,7 +5649,6 @@ def test_doubly_nested_graph_state( "parents": {}, "source": "loop", "step": 1, - "thread_id": "1", }, created_at=AnyStr(), parent_config=None, @@ -5794,12 +5675,6 @@ def test_doubly_nested_graph_state( "source": "loop", "step": 0, "parents": {"": AnyStr()}, - "thread_id": "1", - "langgraph_node": "child", - "langgraph_path": [PULL, AnyStr("child")], - "langgraph_step": 2, - "langgraph_triggers": ["branch:to:child"], - "langgraph_checkpoint_ns": AnyStr("child:"), }, created_at=AnyStr(), parent_config=None, @@ -5849,15 +5724,6 @@ def test_doubly_nested_graph_state( AnyStr("child:"): AnyStr(), } ), - "thread_id": "1", - "langgraph_checkpoint_ns": AnyStr("child:"), - "langgraph_node": "child_1", - "langgraph_path": [ - PULL, - AnyStr("child_1"), - ], - "langgraph_step": 1, - "langgraph_triggers": ["branch:to:child_1"], }, created_at=AnyStr(), parent_config=None, @@ -6089,7 +5955,6 @@ def test_send_react_interrupt( "step": 1, "source": "loop", "parents": {}, - "thread_id": "2", }, created_at=AnyStr(), parent_config=None, @@ -6135,7 +6000,6 @@ def test_send_react_interrupt( "step": 2, "source": "update", "parents": {}, - "thread_id": "2", }, created_at=AnyStr(), parent_config=( @@ -6213,7 +6077,6 @@ def test_send_react_interrupt( "step": 1, "source": "loop", "parents": {}, - "thread_id": "3", }, created_at=AnyStr(), parent_config=None, @@ -6280,7 +6143,6 @@ def test_send_react_interrupt( "step": 2, "source": "update", "parents": {}, - "thread_id": "3", }, created_at=AnyStr(), parent_config=( @@ -6479,7 +6341,6 @@ def test_send_react_interrupt_control( "step": 1, "source": "loop", "parents": {}, - "thread_id": "2", }, created_at=AnyStr(), parent_config=None, @@ -6525,7 +6386,6 @@ def test_send_react_interrupt_control( "step": 2, "source": "update", "parents": {}, - "thread_id": "2", }, created_at=AnyStr(), parent_config=( @@ -6713,7 +6573,6 @@ def test_weather_subgraph( "source": "loop", "step": 1, "parents": {}, - "thread_id": "1", }, created_at=AnyStr(), parent_config=None, @@ -6795,7 +6654,6 @@ def test_weather_subgraph( "source": "loop", "step": 1, "parents": {}, - "thread_id": "14", }, created_at=AnyStr(), parent_config=None, @@ -6829,12 +6687,6 @@ def test_weather_subgraph( "source": "loop", "step": 1, "parents": {"": AnyStr()}, - "thread_id": "14", - "langgraph_node": "weather_graph", - "langgraph_path": [PULL, "weather_graph"], - "langgraph_step": 2, - "langgraph_triggers": ["branch:to:weather_graph"], - "langgraph_checkpoint_ns": AnyStr("weather_graph:"), }, created_at=AnyStr(), parent_config=None, @@ -6874,7 +6726,6 @@ def test_weather_subgraph( "source": "loop", "step": 1, "parents": {}, - "thread_id": "14", }, created_at=AnyStr(), parent_config=None, @@ -6909,14 +6760,6 @@ def test_weather_subgraph( "step": 2, "source": "update", "parents": {"": AnyStr()}, - "thread_id": "14", - "checkpoint_id": AnyStr(), - "checkpoint_ns": AnyStr("weather_graph:"), - "langgraph_node": "weather_graph", - "langgraph_path": [PULL, "weather_graph"], - "langgraph_step": 2, - "langgraph_triggers": ["branch:to:weather_graph"], - "langgraph_checkpoint_ns": AnyStr("weather_graph:"), }, created_at=AnyStr(), parent_config=( diff --git a/libs/langgraph/tests/test_large_cases_async.py b/libs/langgraph/tests/test_large_cases_async.py index 9537d50a6..624ab0f49 100644 --- a/libs/langgraph/tests/test_large_cases_async.py +++ b/libs/langgraph/tests/test_large_cases_async.py @@ -119,7 +119,6 @@ async def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "loop", "step": 6, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[1].config, @@ -140,7 +139,6 @@ async def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "loop", "step": 5, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[2].config, @@ -161,7 +159,6 @@ async def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "input", "step": 4, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[3].config, @@ -182,7 +179,6 @@ async def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "loop", "step": 3, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[4].config, @@ -203,7 +199,6 @@ async def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "input", "step": 2, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[5].config, @@ -224,7 +219,6 @@ async def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "loop", "step": 1, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[6].config, @@ -245,7 +239,6 @@ async def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "loop", "step": 0, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[7].config, @@ -266,7 +259,6 @@ async def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "input", "step": -1, - "thread_id": "1", }, created_at=AnyStr(), parent_config=None, @@ -342,7 +334,6 @@ async def test_fork_always_re_runs_nodes( "parents": {}, "source": "loop", "step": 5, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[1].config, @@ -363,7 +354,6 @@ async def test_fork_always_re_runs_nodes( "parents": {}, "source": "loop", "step": 4, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[2].config, @@ -384,7 +374,6 @@ async def test_fork_always_re_runs_nodes( "parents": {}, "source": "loop", "step": 3, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[3].config, @@ -405,7 +394,6 @@ async def test_fork_always_re_runs_nodes( "parents": {}, "source": "loop", "step": 2, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[4].config, @@ -426,7 +414,6 @@ async def test_fork_always_re_runs_nodes( "parents": {}, "source": "loop", "step": 1, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[5].config, @@ -447,7 +434,6 @@ async def test_fork_always_re_runs_nodes( "parents": {}, "source": "loop", "step": 0, - "thread_id": "1", }, created_at=AnyStr(), parent_config=history[6].config, @@ -468,7 +454,6 @@ async def test_fork_always_re_runs_nodes( "parents": {}, "source": "input", "step": -1, - "thread_id": "1", }, created_at=AnyStr(), parent_config=None, @@ -736,7 +721,6 @@ async def test_conditional_graph_state(async_checkpointer: BaseCheckpointSaver) "parents": {}, "source": "loop", "step": 1, - "thread_id": "1", }, parent_config=None, interrupts=(), @@ -776,7 +760,6 @@ async def test_conditional_graph_state(async_checkpointer: BaseCheckpointSaver) "parents": {}, "source": "update", "step": 2, - "thread_id": "1", }, parent_config=( [c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)][ @@ -854,7 +837,6 @@ async def test_conditional_graph_state(async_checkpointer: BaseCheckpointSaver) "parents": {}, "source": "update", "step": 5, - "thread_id": "1", }, parent_config=( [c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)][ @@ -912,7 +894,6 @@ async def test_conditional_graph_state(async_checkpointer: BaseCheckpointSaver) "parents": {}, "source": "loop", "step": 1, - "thread_id": "2", }, parent_config=None, interrupts=(), @@ -952,7 +933,6 @@ async def test_conditional_graph_state(async_checkpointer: BaseCheckpointSaver) "parents": {}, "source": "update", "step": 2, - "thread_id": "2", }, parent_config=[ c async for c in app_w_interrupt.checkpointer.alist(config, limit=2) @@ -1028,7 +1008,6 @@ async def test_conditional_graph_state(async_checkpointer: BaseCheckpointSaver) "parents": {}, "source": "update", "step": 5, - "thread_id": "2", }, parent_config=[ c async for c in app_w_interrupt.checkpointer.alist(config, limit=2) @@ -1647,7 +1626,6 @@ async def test_state_graph_packets(async_checkpointer: BaseCheckpointSaver) -> N "parents": {}, "source": "loop", "step": 1, - "thread_id": "1", }, parent_config=None, interrupts=(), @@ -1685,7 +1663,6 @@ async def test_state_graph_packets(async_checkpointer: BaseCheckpointSaver) -> N "parents": {}, "source": "update", "step": 2, - "thread_id": "1", }, parent_config=( [c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)][ @@ -1778,7 +1755,6 @@ async def test_state_graph_packets(async_checkpointer: BaseCheckpointSaver) -> N "parents": {}, "source": "loop", "step": 4, - "thread_id": "1", }, parent_config=( [c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)][ @@ -1826,7 +1802,6 @@ async def test_state_graph_packets(async_checkpointer: BaseCheckpointSaver) -> N "parents": {}, "source": "update", "step": 5, - "thread_id": "1", }, parent_config=( [c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)][ @@ -1894,7 +1869,6 @@ async def test_state_graph_packets(async_checkpointer: BaseCheckpointSaver) -> N "parents": {}, "source": "loop", "step": 1, - "thread_id": "2", }, parent_config=None, interrupts=(), @@ -1932,7 +1906,6 @@ async def test_state_graph_packets(async_checkpointer: BaseCheckpointSaver) -> N "parents": {}, "source": "update", "step": 2, - "thread_id": "2", }, parent_config=( [c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)][ @@ -2025,7 +1998,6 @@ async def test_state_graph_packets(async_checkpointer: BaseCheckpointSaver) -> N "parents": {}, "source": "loop", "step": 4, - "thread_id": "2", }, parent_config=( [c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)][ @@ -2073,7 +2045,6 @@ async def test_state_graph_packets(async_checkpointer: BaseCheckpointSaver) -> N "parents": {}, "source": "update", "step": 5, - "thread_id": "2", }, parent_config=( [c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)][ @@ -2322,7 +2293,6 @@ async def test_message_graph(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 1, - "thread_id": "1", }, parent_config=None, interrupts=(), @@ -2358,7 +2328,6 @@ async def test_message_graph(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "update", "step": 2, - "thread_id": "1", }, parent_config=( [c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)][ @@ -2434,7 +2403,6 @@ async def test_message_graph(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 4, - "thread_id": "1", }, parent_config=( [c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)][ @@ -2480,7 +2448,6 @@ async def test_message_graph(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "update", "step": 5, - "thread_id": "1", }, parent_config=( [c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)][ @@ -2791,7 +2758,6 @@ async def test_nested_graph_state(async_checkpointer: BaseCheckpointSaver) -> No "parents": {}, "source": "loop", "step": 1, - "thread_id": "1", }, created_at=AnyStr(), parent_config=None, @@ -2835,12 +2801,6 @@ async def test_nested_graph_state(async_checkpointer: BaseCheckpointSaver) -> No }, "source": "loop", "step": 1, - "thread_id": "1", - "langgraph_node": "inner", - "langgraph_path": [PULL, "inner"], - "langgraph_step": 2, - "langgraph_triggers": ["branch:to:inner"], - "langgraph_checkpoint_ns": AnyStr("inner:"), }, created_at=AnyStr(), parent_config=None, @@ -2860,7 +2820,6 @@ async def test_nested_graph_state(async_checkpointer: BaseCheckpointSaver) -> No "parents": {}, "source": "loop", "step": 1, - "thread_id": "1", }, created_at=AnyStr(), parent_config=None, @@ -2894,12 +2853,6 @@ async def test_nested_graph_state(async_checkpointer: BaseCheckpointSaver) -> No "source": "loop", "step": 1, "parents": {"": AnyStr()}, - "thread_id": "1", - "langgraph_node": "inner", - "langgraph_path": [PULL, "inner"], - "langgraph_step": 2, - "langgraph_triggers": ["branch:to:inner"], - "langgraph_checkpoint_ns": AnyStr("inner:"), }, created_at=AnyStr(), parent_config=None, @@ -2928,7 +2881,6 @@ async def test_nested_graph_state(async_checkpointer: BaseCheckpointSaver) -> No "parents": {}, "source": "loop", "step": 3, - "thread_id": "1", }, created_at=AnyStr(), parent_config=( @@ -2960,7 +2912,6 @@ async def test_nested_graph_state(async_checkpointer: BaseCheckpointSaver) -> No "parents": {}, "source": "loop", "step": 3, - "thread_id": "1", }, created_at=AnyStr(), parent_config=( @@ -3002,7 +2953,6 @@ async def test_nested_graph_state(async_checkpointer: BaseCheckpointSaver) -> No "parents": {}, "source": "loop", "step": 1, - "thread_id": "1", }, created_at=AnyStr(), parent_config=None, @@ -3109,7 +3059,6 @@ async def test_doubly_nested_graph_state( "parents": {}, "source": "loop", "step": 1, - "thread_id": "1", }, created_at=AnyStr(), parent_config=None, @@ -3146,15 +3095,9 @@ async def test_doubly_nested_graph_state( } }, metadata={ - "langgraph_checkpoint_ns": AnyStr("child:"), - "langgraph_node": "child", - "langgraph_path": ["__pregel_pull", "child"], - "langgraph_step": 2, - "langgraph_triggers": ["branch:to:child"], "parents": {"": AnyStr()}, "source": "loop", "step": 0, - "thread_id": "1", }, created_at=AnyStr(), parent_config=None, @@ -3194,14 +3137,6 @@ async def test_doubly_nested_graph_state( ), "source": "loop", "step": 1, - "thread_id": "1", - "langgraph_checkpoint_ns": AnyStr("child:"), - "langgraph_node": "child_1", - "langgraph_path": [PULL, AnyStr("child_1")], - "langgraph_step": 1, - "langgraph_triggers": [ - "branch:to:child_1", - ], }, created_at=AnyStr(), parent_config=None, @@ -3257,17 +3192,6 @@ async def test_doubly_nested_graph_state( ), "source": "loop", "step": 1, - "thread_id": "1", - "langgraph_checkpoint_ns": AnyStr("child:"), - "langgraph_node": "child_1", - "langgraph_path": [ - PULL, - AnyStr("child_1"), - ], - "langgraph_step": 1, - "langgraph_triggers": [ - "branch:to:child_1", - ], }, created_at=AnyStr(), parent_config=None, @@ -3290,14 +3214,6 @@ async def test_doubly_nested_graph_state( "parents": {"": AnyStr()}, "source": "loop", "step": 0, - "thread_id": "1", - "langgraph_node": "child", - "langgraph_path": [PULL, AnyStr("child")], - "langgraph_step": 2, - "langgraph_triggers": [ - "branch:to:child", - ], - "langgraph_checkpoint_ns": AnyStr("child:"), }, created_at=AnyStr(), parent_config=None, @@ -3317,7 +3233,6 @@ async def test_doubly_nested_graph_state( "parents": {}, "source": "loop", "step": 1, - "thread_id": "1", }, created_at=AnyStr(), parent_config=None, @@ -3355,7 +3270,6 @@ async def test_doubly_nested_graph_state( "parents": {}, "source": "loop", "step": 3, - "thread_id": "1", }, created_at=AnyStr(), parent_config=( @@ -3389,7 +3303,6 @@ async def test_doubly_nested_graph_state( "parents": {}, "source": "loop", "step": 3, - "thread_id": "1", }, created_at=AnyStr(), parent_config={ @@ -3428,7 +3341,6 @@ async def test_doubly_nested_graph_state( "parents": {}, "source": "loop", "step": 1, - "thread_id": "1", }, created_at=AnyStr(), parent_config=None, @@ -3457,12 +3369,6 @@ async def test_doubly_nested_graph_state( "source": "loop", "step": 0, "parents": {"": AnyStr()}, - "thread_id": "1", - "langgraph_node": "child", - "langgraph_path": [PULL, AnyStr("child")], - "langgraph_step": 2, - "langgraph_triggers": ["branch:to:child"], - "langgraph_checkpoint_ns": AnyStr("child:"), }, created_at=AnyStr(), parent_config=None, @@ -3514,17 +3420,6 @@ async def test_doubly_nested_graph_state( AnyStr("child:"): AnyStr(), } ), - "thread_id": "1", - "langgraph_checkpoint_ns": AnyStr("child:"), - "langgraph_node": "child_1", - "langgraph_path": [ - PULL, - AnyStr("child_1"), - ], - "langgraph_step": 1, - "langgraph_triggers": [ - "branch:to:child_1", - ], }, created_at=AnyStr(), parent_config=None, @@ -3775,7 +3670,6 @@ async def test_weather_subgraph( "source": "loop", "step": 1, "parents": {}, - "thread_id": "1", }, created_at=AnyStr(), parent_config=None, @@ -3859,7 +3753,6 @@ async def test_weather_subgraph( "source": "loop", "step": 1, "parents": {}, - "thread_id": "14", }, created_at=AnyStr(), parent_config=None, @@ -3893,12 +3786,6 @@ async def test_weather_subgraph( "source": "loop", "step": 1, "parents": {"": AnyStr()}, - "thread_id": "14", - "langgraph_node": "weather_graph", - "langgraph_path": [PULL, "weather_graph"], - "langgraph_step": 2, - "langgraph_triggers": ["branch:to:weather_graph"], - "langgraph_checkpoint_ns": AnyStr("weather_graph:"), }, created_at=AnyStr(), parent_config=None, @@ -3938,7 +3825,6 @@ async def test_weather_subgraph( "source": "loop", "step": 1, "parents": {}, - "thread_id": "14", }, created_at=AnyStr(), parent_config=None, @@ -3974,14 +3860,6 @@ async def test_weather_subgraph( "step": 2, "source": "update", "parents": {"": AnyStr()}, - "thread_id": "14", - "checkpoint_id": AnyStr(), - "checkpoint_ns": AnyStr("weather_graph:"), - "langgraph_node": "weather_graph", - "langgraph_path": [PULL, "weather_graph"], - "langgraph_step": 2, - "langgraph_triggers": ["branch:to:weather_graph"], - "langgraph_checkpoint_ns": AnyStr("weather_graph:"), }, created_at=AnyStr(), parent_config=( diff --git a/libs/langgraph/tests/test_pregel.py b/libs/langgraph/tests/test_pregel.py index 3d38558ab..1ecc18466 100644 --- a/libs/langgraph/tests/test_pregel.py +++ b/libs/langgraph/tests/test_pregel.py @@ -904,7 +904,6 @@ def test_pending_writes_resume( "parents": {}, "source": "loop", "step": 0, - "thread_id": "1", } # get_state with checkpoint_id should not apply any pending writes state = graph.get_state(state.config) @@ -994,7 +993,6 @@ def test_pending_writes_resume( "parents": {}, "step": 1, "source": "loop", - "thread_id": "1", }, parent_config={ "configurable": { @@ -1042,7 +1040,6 @@ def test_pending_writes_resume( "parents": {}, "step": 0, "source": "loop", - "thread_id": "1", }, parent_config={ "configurable": { @@ -1094,7 +1091,6 @@ def test_pending_writes_resume( "parents": {}, "step": -1, "source": "input", - "thread_id": "1", }, parent_config=None, pending_writes=UnsortedSequence( @@ -2058,7 +2054,6 @@ def test_in_one_fan_out_state_graph_waiting_edge( "parents": {}, "source": "update", "step": 4, - "thread_id": "2", }, parent_config=expected_parent_config, interrupts=(), @@ -2328,7 +2323,6 @@ def test_in_one_fan_out_state_graph_defer_node( "parents": {}, "source": "update", "step": 4, - "thread_id": "2", }, parent_config=expected_parent_config, interrupts=(), @@ -3930,7 +3924,6 @@ def test_checkpoint_metadata(sync_checkpointer: BaseCheckpointSaver) -> None: # assert that checkpoint metadata contains the run's configurable fields chkpnt_metadata_1 = sync_checkpointer.get_tuple(config).metadata - assert chkpnt_metadata_1["thread_id"] == "1" assert chkpnt_metadata_1["test_config_1"] == "foo" assert chkpnt_metadata_1["test_config_2"] == "bar" @@ -3939,7 +3932,6 @@ def test_checkpoint_metadata(sync_checkpointer: BaseCheckpointSaver) -> None: # on how the graph is constructed. chkpnt_tuples_1 = sync_checkpointer.list(config) for chkpnt_tuple in chkpnt_tuples_1: - assert chkpnt_tuple.metadata["thread_id"] == "1" assert chkpnt_tuple.metadata["test_config_1"] == "foo" assert chkpnt_tuple.metadata["test_config_2"] == "bar" @@ -3959,7 +3951,6 @@ def test_checkpoint_metadata(sync_checkpointer: BaseCheckpointSaver) -> None: # assert that checkpoint metadata contains the run's configurable fields chkpnt_metadata_2 = sync_checkpointer.get_tuple(config).metadata - assert chkpnt_metadata_2["thread_id"] == "2" assert chkpnt_metadata_2["test_config_3"] == "foo" assert chkpnt_metadata_2["test_config_4"] == "bar" @@ -3977,7 +3968,6 @@ def test_checkpoint_metadata(sync_checkpointer: BaseCheckpointSaver) -> None: # assert that checkpoint metadata contains the run's configurable fields chkpnt_metadata_3 = sync_checkpointer.get_tuple(config).metadata - assert chkpnt_metadata_3["thread_id"] == "2" assert chkpnt_metadata_3["test_config_3"] == "foo" assert chkpnt_metadata_3["test_config_4"] == "bar" @@ -3986,7 +3976,6 @@ def test_checkpoint_metadata(sync_checkpointer: BaseCheckpointSaver) -> None: # on how the graph is constructed. chkpnt_tuples_2 = sync_checkpointer.list(config) for chkpnt_tuple in chkpnt_tuples_2: - assert chkpnt_tuple.metadata["thread_id"] == "2" assert chkpnt_tuple.metadata["test_config_3"] == "foo" assert chkpnt_tuple.metadata["test_config_4"] == "bar" @@ -4849,7 +4838,6 @@ def test_parent_command( }, metadata={ "source": "loop", - "thread_id": "1", "step": 1, "parents": {}, }, @@ -5662,7 +5650,6 @@ def test_falsy_return_from_task(sync_checkpointer: BaseCheckpointSaver): "parents": {}, "source": "input", "step": -1, - "thread_id": AnyStr(), }, "next": [ "graph", diff --git a/libs/langgraph/tests/test_pregel_async.py b/libs/langgraph/tests/test_pregel_async.py index ff5e8496d..c09c2d1be 100644 --- a/libs/langgraph/tests/test_pregel_async.py +++ b/libs/langgraph/tests/test_pregel_async.py @@ -612,7 +612,6 @@ async def test_dynamic_interrupt(async_checkpointer: BaseCheckpointSaver) -> Non "parents": {}, "source": "loop", "step": 0, - "thread_id": "1", }, ] tup = await tool_two.checkpointer.aget_tuple(thread1) @@ -639,7 +638,6 @@ async def test_dynamic_interrupt(async_checkpointer: BaseCheckpointSaver) -> Non "parents": {}, "source": "loop", "step": 0, - "thread_id": "1", }, parent_config=None, interrupts=( @@ -665,7 +663,6 @@ async def test_dynamic_interrupt(async_checkpointer: BaseCheckpointSaver) -> Non "parents": {}, "source": "update", "step": 1, - "thread_id": "1", }, parent_config=( [c async for c in tool_two.checkpointer.alist(thread1, limit=2)][-1].config @@ -785,7 +782,6 @@ async def test_dynamic_interrupt_subgraph( "parents": {}, "source": "loop", "step": 0, - "thread_id": "1", }, ] tup = await tool_two.checkpointer.aget_tuple(thread1) @@ -818,7 +814,6 @@ async def test_dynamic_interrupt_subgraph( "parents": {}, "source": "loop", "step": 0, - "thread_id": "1", }, parent_config=None, interrupts=( @@ -844,7 +839,6 @@ async def test_dynamic_interrupt_subgraph( "parents": {}, "source": "update", "step": 1, - "thread_id": "1", }, parent_config=( [c async for c in tool_two.checkpointer.alist(thread1root, limit=2)][ @@ -963,7 +957,6 @@ async def test_copy_checkpoint(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 0, - "thread_id": "1", }, ] @@ -1000,7 +993,6 @@ async def test_copy_checkpoint(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 0, - "thread_id": "1", }, parent_config=None, interrupts=( @@ -1039,7 +1031,6 @@ async def test_copy_checkpoint(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "fork", "step": 1, - "thread_id": "1", }, parent_config=( [c async for c in tool_two.checkpointer.alist(thread1, limit=2)][-1].config @@ -1217,7 +1208,6 @@ async def test_cancel_graph_astream(async_checkpointer: BaseCheckpointSaver) -> "parents": {}, "source": "loop", "step": 0, - "thread_id": "1", } @@ -1292,7 +1282,6 @@ async def test_cancel_graph_astream_events_v2( "parents": {}, "source": "loop", "step": 1, - "thread_id": "2", } @@ -1815,7 +1804,6 @@ async def test_pending_writes_resume( "parents": {}, "source": "loop", "step": 0, - "thread_id": "1", } # get_state with checkpoint_id should not apply any pending writes state = await graph.aget_state(state.config) @@ -1905,7 +1893,6 @@ async def test_pending_writes_resume( "parents": {}, "step": 1, "source": "loop", - "thread_id": "1", }, parent_config={ "configurable": { @@ -1953,7 +1940,6 @@ async def test_pending_writes_resume( "parents": {}, "step": 0, "source": "loop", - "thread_id": "1", }, parent_config={ "configurable": { @@ -2001,7 +1987,6 @@ async def test_pending_writes_resume( "parents": {}, "step": -1, "source": "input", - "thread_id": "1", }, parent_config=None, pending_writes=UnsortedSequence( @@ -2601,7 +2586,6 @@ async def test_send_dedupe_on_resume( }, metadata={ "source": "loop", - "thread_id": "1", "step": 4, "parents": {}, }, @@ -2637,7 +2621,6 @@ async def test_send_dedupe_on_resume( }, metadata={ "source": "loop", - "thread_id": "1", "step": 3, "parents": {}, }, @@ -2680,7 +2663,6 @@ async def test_send_dedupe_on_resume( }, metadata={ "source": "loop", - "thread_id": "1", "step": 2, "parents": {}, }, @@ -2735,7 +2717,6 @@ async def test_send_dedupe_on_resume( }, metadata={ "source": "loop", - "thread_id": "1", "step": 1, "parents": {}, }, @@ -2790,7 +2771,6 @@ async def test_send_dedupe_on_resume( }, metadata={ "source": "loop", - "thread_id": "1", "step": 0, "parents": {}, }, @@ -2827,7 +2807,6 @@ async def test_send_dedupe_on_resume( }, metadata={ "source": "input", - "thread_id": "1", "step": -1, "parents": {}, }, @@ -3006,7 +2985,6 @@ async def test_send_react_interrupt(async_checkpointer: BaseCheckpointSaver) -> "step": 1, "source": "loop", "parents": {}, - "thread_id": "2", }, created_at=AnyStr(), parent_config=None, @@ -3052,7 +3030,6 @@ async def test_send_react_interrupt(async_checkpointer: BaseCheckpointSaver) -> "step": 2, "source": "update", "parents": {}, - "thread_id": "2", }, created_at=AnyStr(), parent_config=( @@ -3130,7 +3107,6 @@ async def test_send_react_interrupt(async_checkpointer: BaseCheckpointSaver) -> "step": 1, "source": "loop", "parents": {}, - "thread_id": "3", }, created_at=AnyStr(), parent_config=None, @@ -3197,7 +3173,6 @@ async def test_send_react_interrupt(async_checkpointer: BaseCheckpointSaver) -> "step": 2, "source": "update", "parents": {}, - "thread_id": "3", }, created_at=AnyStr(), parent_config=( @@ -3395,7 +3370,6 @@ async def test_send_react_interrupt_control( "step": 1, "source": "loop", "parents": {}, - "thread_id": "2", }, created_at=AnyStr(), parent_config=None, @@ -3441,7 +3415,6 @@ async def test_send_react_interrupt_control( "step": 2, "source": "update", "parents": {}, - "thread_id": "2", }, created_at=AnyStr(), parent_config=( @@ -4387,7 +4360,6 @@ async def test_in_one_fan_out_state_graph_waiting_edge_custom_state_class( "parents": {}, "source": "loop", "step": 4, - "thread_id": "1", }, created_at=AnyStr(), parent_config=( @@ -5646,7 +5618,6 @@ async def test_checkpoint_metadata(async_checkpointer: BaseCheckpointSaver) -> N # assert that checkpoint metadata contains the run's configurable fields chkpnt_metadata_1 = (await async_checkpointer.aget_tuple(config)).metadata - assert chkpnt_metadata_1["thread_id"] == "1" assert chkpnt_metadata_1["test_config_1"] == "foo" assert chkpnt_metadata_1["test_config_2"] == "bar" @@ -5655,7 +5626,6 @@ async def test_checkpoint_metadata(async_checkpointer: BaseCheckpointSaver) -> N # on how the graph is constructed. chkpnt_tuples_1 = async_checkpointer.alist(config) async for chkpnt_tuple in chkpnt_tuples_1: - assert chkpnt_tuple.metadata["thread_id"] == "1" assert chkpnt_tuple.metadata["test_config_1"] == "foo" assert chkpnt_tuple.metadata["test_config_2"] == "bar" @@ -5675,7 +5645,6 @@ async def test_checkpoint_metadata(async_checkpointer: BaseCheckpointSaver) -> N # assert that checkpoint metadata contains the run's configurable fields chkpnt_metadata_2 = (await async_checkpointer.aget_tuple(config)).metadata - assert chkpnt_metadata_2["thread_id"] == "2" assert chkpnt_metadata_2["test_config_3"] == "foo" assert chkpnt_metadata_2["test_config_4"] == "bar" @@ -5693,7 +5662,6 @@ async def test_checkpoint_metadata(async_checkpointer: BaseCheckpointSaver) -> N # assert that checkpoint metadata contains the run's configurable fields chkpnt_metadata_3 = (await async_checkpointer.aget_tuple(config)).metadata - assert chkpnt_metadata_3["thread_id"] == "2" assert chkpnt_metadata_3["test_config_3"] == "foo" assert chkpnt_metadata_3["test_config_4"] == "bar" @@ -5702,7 +5670,6 @@ async def test_checkpoint_metadata(async_checkpointer: BaseCheckpointSaver) -> N # on how the graph is constructed. chkpnt_tuples_2 = async_checkpointer.alist(config) async for chkpnt_tuple in chkpnt_tuples_2: - assert chkpnt_tuple.metadata["thread_id"] == "2" assert chkpnt_tuple.metadata["test_config_3"] == "foo" assert chkpnt_tuple.metadata["test_config_4"] == "bar" @@ -6139,7 +6106,6 @@ async def test_parent_command( }, metadata={ "source": "loop", - "thread_id": "1", "step": 1, "parents": {}, }, diff --git a/libs/prebuilt/tests/test_react_agent.py b/libs/prebuilt/tests/test_react_agent.py index fc0436a3a..0c8764798 100644 --- a/libs/prebuilt/tests/test_react_agent.py +++ b/libs/prebuilt/tests/test_react_agent.py @@ -91,7 +91,6 @@ def test_no_prompt(sync_checkpointer: BaseCheckpointSaver, version: str) -> None "parents": {}, "source": "loop", "step": 1, - "thread_id": "123", } assert saved.pending_writes == [] @@ -118,7 +117,6 @@ async def test_no_prompt_async(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 1, - "thread_id": "123", } assert saved.pending_writes == []