From 1377e3b6ba3cd4f07827b95f8ca55a79532a639c Mon Sep 17 00:00:00 2001 From: Vadym Barda Date: Wed, 12 Feb 2025 19:24:41 -0800 Subject: [PATCH] checkpoint: combine metadata when writing checkpoints (#3404) --- .../langgraph/checkpoint/postgres/__init__.py | 12 +- .../langgraph/checkpoint/postgres/aio.py | 12 +- .../langgraph/checkpoint/postgres/shallow.py | 24 +- libs/checkpoint-postgres/tests/test_async.py | 42 ++- libs/checkpoint-postgres/tests/test_sync.py | 38 ++- .../langgraph/checkpoint/sqlite/__init__.py | 12 +- .../langgraph/checkpoint/sqlite/aio.py | 12 +- .../checkpoint-sqlite/tests/test_aiosqlite.py | 29 +- libs/checkpoint-sqlite/tests/test_sqlite.py | 29 +- .../langgraph/checkpoint/memory/__init__.py | 12 +- libs/checkpoint/tests/test_memory.py | 38 ++- libs/langgraph/tests/test_large_cases.py | 280 ++++++++++++++++++ .../langgraph/tests/test_large_cases_async.py | 198 +++++++++++++ libs/langgraph/tests/test_prebuilt.py | 5 + libs/langgraph/tests/test_pregel.py | 11 + libs/langgraph/tests/test_pregel_async.py | 59 ++++ 16 files changed, 792 insertions(+), 21 deletions(-) diff --git a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/__init__.py b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/__init__.py index 8ea9618d6..3b33e0a9f 100644 --- a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/__init__.py +++ b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/__init__.py @@ -317,7 +317,17 @@ class PostgresSaver(BasePostgresSaver): checkpoint["id"], checkpoint_id, Jsonb(self._dump_checkpoint(copy)), - self._dump_metadata(metadata), + self._dump_metadata( + { + **{ + k: v + for k, v in config["configurable"].items() + if not k.startswith("__") + }, + **config.get("metadata", {}), + **metadata, + } + ), ), ) return next_config diff --git a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/aio.py b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/aio.py index e03330593..596ce1de5 100644 --- a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/aio.py +++ b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/aio.py @@ -275,7 +275,17 @@ class AsyncPostgresSaver(BasePostgresSaver): checkpoint["id"], checkpoint_id, Jsonb(self._dump_checkpoint(copy)), - self._dump_metadata(metadata), + self._dump_metadata( + { + **{ + k: v + for k, v in config["configurable"].items() + if not k.startswith("__") + }, + **config.get("metadata", {}), + **metadata, + } + ), ), ) return next_config diff --git a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/shallow.py b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/shallow.py index dd8de76ef..decf25bfd 100644 --- a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/shallow.py +++ b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/shallow.py @@ -423,7 +423,17 @@ class ShallowPostgresSaver(BasePostgresSaver): thread_id, checkpoint_ns, Jsonb(self._dump_checkpoint(copy)), - self._dump_metadata(metadata), + self._dump_metadata( + { + **{ + k: v + for k, v in config["configurable"].items() + if not k.startswith("__") + }, + **config.get("metadata", {}), + **metadata, + } + ), ), ) return next_config @@ -742,7 +752,17 @@ class AsyncShallowPostgresSaver(BasePostgresSaver): thread_id, checkpoint_ns, Jsonb(self._dump_checkpoint(copy)), - self._dump_metadata(metadata), + self._dump_metadata( + { + **{ + k: v + for k, v in config["configurable"].items() + if not k.startswith("__") + }, + **config.get("metadata", {}), + **metadata, + } + ), ), ) return next_config diff --git a/libs/checkpoint-postgres/tests/test_async.py b/libs/checkpoint-postgres/tests/test_async.py index 7590012dd..8c54e5787 100644 --- a/libs/checkpoint-postgres/tests/test_async.py +++ b/libs/checkpoint-postgres/tests/test_async.py @@ -201,7 +201,35 @@ def test_data(): @pytest.mark.parametrize("saver_name", ["base", "pool", "pipe", "shallow"]) -async def test_asearch(request, saver_name: str, test_data) -> None: +async def test_combined_metadata(saver_name: str, test_data) -> None: + async with _saver(saver_name) as saver: + config = { + "configurable": { + "thread_id": "thread-2", + "checkpoint_ns": "", + "__super_private_key": "super_private_value", + }, + "metadata": {"run_id": "my_run_id"}, + } + chkpnt: Checkpoint = create_checkpoint(empty_checkpoint(), {}, 1) + metadata: CheckpointMetadata = { + "source": "loop", + "step": 1, + "writes": {"foo": "bar"}, + "score": None, + } + await saver.aput(config, chkpnt, metadata, {}) + checkpoint = await saver.aget_tuple(config) + assert checkpoint.metadata == { + **metadata, + "thread_id": "thread-2", + "checkpoint_ns": "", + "run_id": "my_run_id", + } + + +@pytest.mark.parametrize("saver_name", ["base", "pool", "pipe", "shallow"]) +async def test_asearch(saver_name: str, test_data) -> None: async with _saver(saver_name) as saver: configs = test_data["configs"] checkpoints = test_data["checkpoints"] @@ -222,11 +250,17 @@ async def test_asearch(request, saver_name: str, test_data) -> None: 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 == metadata[0] + assert search_results_1[0].metadata == { + **configs[0]["configurable"], + **metadata[0], + } 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 == metadata[1] + assert search_results_2[0].metadata == { + **configs[1]["configurable"], + **metadata[1], + } search_results_3 = [c async for c in saver.alist(None, filter=query_3)] assert len(search_results_3) == 3 @@ -246,7 +280,7 @@ async def test_asearch(request, saver_name: str, test_data) -> None: @pytest.mark.parametrize("saver_name", ["base", "pool", "pipe", "shallow"]) -async def test_null_chars(request, saver_name: str, test_data) -> None: +async def test_null_chars(saver_name: str, test_data) -> None: async with _saver(saver_name) as saver: config = await saver.aput( test_data["configs"][0], diff --git a/libs/checkpoint-postgres/tests/test_sync.py b/libs/checkpoint-postgres/tests/test_sync.py index 3cc00ee28..e0e60a938 100644 --- a/libs/checkpoint-postgres/tests/test_sync.py +++ b/libs/checkpoint-postgres/tests/test_sync.py @@ -182,6 +182,34 @@ def test_data(): } +@pytest.mark.parametrize("saver_name", ["base", "pool", "pipe", "shallow"]) +def test_combined_metadata(saver_name: str, test_data) -> None: + with _saver(saver_name) as saver: + config = { + "configurable": { + "thread_id": "thread-2", + "checkpoint_ns": "", + "__super_private_key": "super_private_value", + }, + "metadata": {"run_id": "my_run_id"}, + } + chkpnt: Checkpoint = create_checkpoint(empty_checkpoint(), {}, 1) + metadata: CheckpointMetadata = { + "source": "loop", + "step": 1, + "writes": {"foo": "bar"}, + "score": None, + } + saver.put(config, chkpnt, metadata, {}) + checkpoint = saver.get_tuple(config) + assert checkpoint.metadata == { + **metadata, + "thread_id": "thread-2", + "checkpoint_ns": "", + "run_id": "my_run_id", + } + + @pytest.mark.parametrize("saver_name", ["base", "pool", "pipe", "shallow"]) def test_search(saver_name: str, test_data) -> None: with _saver(saver_name) as saver: @@ -204,11 +232,17 @@ def test_search(saver_name: str, test_data) -> None: search_results_1 = list(saver.list(None, filter=query_1)) assert len(search_results_1) == 1 - assert search_results_1[0].metadata == metadata[0] + assert search_results_1[0].metadata == { + **configs[0]["configurable"], + **metadata[0], + } search_results_2 = list(saver.list(None, filter=query_2)) assert len(search_results_2) == 1 - assert search_results_2[0].metadata == metadata[1] + assert search_results_2[0].metadata == { + **configs[1]["configurable"], + **metadata[1], + } search_results_3 = list(saver.list(None, filter=query_3)) assert len(search_results_3) == 3 diff --git a/libs/checkpoint-sqlite/langgraph/checkpoint/sqlite/__init__.py b/libs/checkpoint-sqlite/langgraph/checkpoint/sqlite/__init__.py index a41d9320e..2587a70b4 100644 --- a/libs/checkpoint-sqlite/langgraph/checkpoint/sqlite/__init__.py +++ b/libs/checkpoint-sqlite/langgraph/checkpoint/sqlite/__init__.py @@ -397,7 +397,17 @@ class SqliteSaver(BaseCheckpointSaver[str]): thread_id = config["configurable"]["thread_id"] checkpoint_ns = config["configurable"]["checkpoint_ns"] type_, serialized_checkpoint = self.serde.dumps_typed(checkpoint) - serialized_metadata = self.jsonplus_serde.dumps(metadata) + serialized_metadata = self.jsonplus_serde.dumps( + { + **{ + k: v + for k, v in config["configurable"].items() + if not k.startswith("__") + }, + **config.get("metadata", {}), + **metadata, + } + ) with self.cursor() as cur: cur.execute( "INSERT OR REPLACE INTO checkpoints (thread_id, checkpoint_ns, checkpoint_id, parent_checkpoint_id, type, checkpoint, metadata) VALUES (?, ?, ?, ?, ?, ?, ?)", diff --git a/libs/checkpoint-sqlite/langgraph/checkpoint/sqlite/aio.py b/libs/checkpoint-sqlite/langgraph/checkpoint/sqlite/aio.py index 432262565..338ce0e47 100644 --- a/libs/checkpoint-sqlite/langgraph/checkpoint/sqlite/aio.py +++ b/libs/checkpoint-sqlite/langgraph/checkpoint/sqlite/aio.py @@ -463,7 +463,17 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]): thread_id = config["configurable"]["thread_id"] checkpoint_ns = config["configurable"]["checkpoint_ns"] type_, serialized_checkpoint = self.serde.dumps_typed(checkpoint) - serialized_metadata = self.jsonplus_serde.dumps(metadata) + serialized_metadata = self.jsonplus_serde.dumps( + { + **{ + k: v + for k, v in config["configurable"].items() + if not k.startswith("__") + }, + **config.get("metadata", {}), + **metadata, + } + ) async with ( self.lock, self.conn.execute( diff --git a/libs/checkpoint-sqlite/tests/test_aiosqlite.py b/libs/checkpoint-sqlite/tests/test_aiosqlite.py index 89adb26a7..dbb6e327d 100644 --- a/libs/checkpoint-sqlite/tests/test_aiosqlite.py +++ b/libs/checkpoint-sqlite/tests/test_aiosqlite.py @@ -57,6 +57,25 @@ class TestAsyncSqliteSaver: } self.metadata_3: CheckpointMetadata = {} + async def test_combined_metadata(self) -> None: + async with AsyncSqliteSaver.from_conn_string(":memory:") as saver: + config = { + "configurable": { + "thread_id": "thread-2", + "checkpoint_ns": "", + "__super_private_key": "super_private_value", + }, + "metadata": {"run_id": "my_run_id"}, + } + await saver.aput(config, self.chkpnt_2, self.metadata_2, {}) + checkpoint = await saver.aget_tuple(config) + assert checkpoint.metadata == { + **self.metadata_2, + "thread_id": "thread-2", + "checkpoint_ns": "", + "run_id": "my_run_id", + } + async def test_asearch(self) -> None: async with AsyncSqliteSaver.from_conn_string(":memory:") as saver: await saver.aput(self.config_1, self.chkpnt_1, self.metadata_1, {}) @@ -74,11 +93,17 @@ 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 == self.metadata_1 + assert search_results_1[0].metadata == { + **self.config_1["configurable"], + **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 == self.metadata_2 + assert search_results_2[0].metadata == { + **self.config_2["configurable"], + **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 d88377f3a..39371c764 100644 --- a/libs/checkpoint-sqlite/tests/test_sqlite.py +++ b/libs/checkpoint-sqlite/tests/test_sqlite.py @@ -58,6 +58,25 @@ class TestSqliteSaver: } self.metadata_3: CheckpointMetadata = {} + def test_combined_metadata(self) -> None: + with SqliteSaver.from_conn_string(":memory:") as saver: + config = { + "configurable": { + "thread_id": "thread-2", + "checkpoint_ns": "", + "__super_private_key": "super_private_value", + }, + "metadata": {"run_id": "my_run_id"}, + } + saver.put(config, self.chkpnt_2, self.metadata_2, {}) + checkpoint = saver.get_tuple(config) + assert checkpoint.metadata == { + **self.metadata_2, + "thread_id": "thread-2", + "checkpoint_ns": "", + "run_id": "my_run_id", + } + def test_search(self) -> None: with SqliteSaver.from_conn_string(":memory:") as saver: # set up test @@ -77,11 +96,17 @@ class TestSqliteSaver: search_results_1 = list(saver.list(None, filter=query_1)) assert len(search_results_1) == 1 - assert search_results_1[0].metadata == self.metadata_1 + assert search_results_1[0].metadata == { + **self.config_1["configurable"], + **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 == self.metadata_2 + assert search_results_2[0].metadata == { + **self.config_2["configurable"], + **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/memory/__init__.py b/libs/checkpoint/langgraph/checkpoint/memory/__init__.py index e16754d6e..855ced952 100644 --- a/libs/checkpoint/langgraph/checkpoint/memory/__init__.py +++ b/libs/checkpoint/langgraph/checkpoint/memory/__init__.py @@ -356,7 +356,17 @@ class InMemorySaver( { checkpoint["id"]: ( self.serde.dumps_typed(c), - self.serde.dumps_typed(metadata), + self.serde.dumps_typed( + { + **{ + k: v + for k, v in config["configurable"].items() + if not k.startswith("__") + }, + **config.get("metadata", {}), + **metadata, + } + ), config["configurable"].get("checkpoint_id"), # parent ) } diff --git a/libs/checkpoint/tests/test_memory.py b/libs/checkpoint/tests/test_memory.py index 847cf931f..c69872389 100644 --- a/libs/checkpoint/tests/test_memory.py +++ b/libs/checkpoint/tests/test_memory.py @@ -59,6 +59,24 @@ class TestMemorySaver: } self.metadata_3: CheckpointMetadata = {} + def test_combined_metadata(self) -> None: + config = { + "configurable": { + "thread_id": "thread-2", + "checkpoint_ns": "", + "__super_private_key": "super_private_value", + }, + "metadata": {"run_id": "my_run_id"}, + } + self.memory_saver.put(config, self.chkpnt_2, self.metadata_2, {}) + checkpoint = self.memory_saver.get_tuple(config) + assert checkpoint.metadata == { + **self.metadata_2, + "thread_id": "thread-2", + "checkpoint_ns": "", + "run_id": "my_run_id", + } + async def test_search(self) -> None: # set up test # save checkpoints @@ -77,11 +95,17 @@ 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 == self.metadata_1 + assert search_results_1[0].metadata == { + **self.config_1["configurable"], + **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 == self.metadata_2 + assert search_results_2[0].metadata == { + **self.config_2["configurable"], + **self.metadata_2, + } search_results_3 = list(self.memory_saver.list(None, filter=query_3)) assert len(search_results_3) == 3 @@ -121,13 +145,19 @@ 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 == self.metadata_1 + assert search_results_1[0].metadata == { + **self.config_1["configurable"], + **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 == self.metadata_2 + assert search_results_2[0].metadata == { + **self.config_2["configurable"], + **self.metadata_2, + } search_results_3 = [ c async for c in self.memory_saver.alist(None, filter=query_3) diff --git a/libs/langgraph/tests/test_large_cases.py b/libs/langgraph/tests/test_large_cases.py index f562720b8..d0fda301d 100644 --- a/libs/langgraph/tests/test_large_cases.py +++ b/libs/langgraph/tests/test_large_cases.py @@ -135,6 +135,8 @@ def test_invoke_two_processes_in_out_interrupt( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 6, @@ -156,6 +158,8 @@ def test_invoke_two_processes_in_out_interrupt( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 5, @@ -177,6 +181,8 @@ def test_invoke_two_processes_in_out_interrupt( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "input", "step": 4, @@ -198,6 +204,8 @@ def test_invoke_two_processes_in_out_interrupt( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 3, @@ -219,6 +227,8 @@ def test_invoke_two_processes_in_out_interrupt( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "input", "step": 2, @@ -240,6 +250,8 @@ def test_invoke_two_processes_in_out_interrupt( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -261,6 +273,8 @@ def test_invoke_two_processes_in_out_interrupt( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -282,6 +296,7 @@ def test_invoke_two_processes_in_out_interrupt( } }, metadata={ + "checkpoint_ns": "", "parents": {}, "source": "input", "step": -1, @@ -349,6 +364,8 @@ def test_fork_always_re_runs_nodes( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 5, @@ -370,6 +387,8 @@ def test_fork_always_re_runs_nodes( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 4, @@ -391,6 +410,8 @@ def test_fork_always_re_runs_nodes( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 3, @@ -412,6 +433,8 @@ def test_fork_always_re_runs_nodes( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 2, @@ -433,6 +456,8 @@ def test_fork_always_re_runs_nodes( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -454,6 +479,8 @@ def test_fork_always_re_runs_nodes( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -475,6 +502,7 @@ def test_fork_always_re_runs_nodes( } }, metadata={ + "checkpoint_ns": "", "parents": {}, "source": "input", "step": -1, @@ -759,6 +787,8 @@ def test_conditional_graph( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -823,6 +853,8 @@ def test_conditional_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 1, @@ -945,6 +977,8 @@ def test_conditional_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 4, @@ -1018,6 +1052,8 @@ def test_conditional_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -1076,6 +1112,8 @@ def test_conditional_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 1, @@ -1198,6 +1236,8 @@ def test_conditional_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 4, @@ -1271,6 +1311,8 @@ def test_conditional_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -1670,6 +1712,8 @@ def test_conditional_state_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -1723,6 +1767,8 @@ def test_conditional_state_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 2, @@ -1811,6 +1857,8 @@ def test_conditional_state_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 5, @@ -1872,6 +1920,8 @@ def test_conditional_state_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -1924,6 +1974,8 @@ def test_conditional_state_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 2, @@ -2010,6 +2062,8 @@ def test_conditional_state_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 5, @@ -2060,6 +2114,8 @@ def test_conditional_state_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -2102,6 +2158,8 @@ def test_conditional_state_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -2168,6 +2226,8 @@ def test_conditional_state_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 2, @@ -2246,6 +2306,8 @@ def test_conditional_state_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -2312,6 +2374,8 @@ def test_conditional_state_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 2, @@ -3050,6 +3114,8 @@ def test_state_graph_packets( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -3114,6 +3180,8 @@ def test_state_graph_packets( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 2, @@ -3227,6 +3295,8 @@ def test_state_graph_packets( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 4, @@ -3304,6 +3374,8 @@ def test_state_graph_packets( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 5, @@ -3383,6 +3455,8 @@ def test_state_graph_packets( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -3441,6 +3515,8 @@ def test_state_graph_packets( config=app_w_interrupt.checkpointer.get_tuple(config).config, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 2, @@ -3554,6 +3630,8 @@ def test_state_graph_packets( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 4, @@ -3629,6 +3707,8 @@ def test_state_graph_packets( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 5, @@ -3918,6 +3998,8 @@ def test_message_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -3969,6 +4051,8 @@ def test_message_graph( config=next_config, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 2, @@ -4062,6 +4146,8 @@ def test_message_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 4, @@ -4125,6 +4211,8 @@ def test_message_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 5, @@ -4188,6 +4276,8 @@ def test_message_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -4245,6 +4335,8 @@ def test_message_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 2, @@ -4338,6 +4430,8 @@ def test_message_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 4, @@ -4402,6 +4496,8 @@ def test_message_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 5, @@ -4454,6 +4550,8 @@ def test_message_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 6, @@ -4741,6 +4839,8 @@ def test_root_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -4792,6 +4892,8 @@ def test_root_graph( config=next_config, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 2, @@ -4886,6 +4988,8 @@ def test_root_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 4, @@ -4950,6 +5054,8 @@ def test_root_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 5, @@ -5013,6 +5119,8 @@ def test_root_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -5070,6 +5178,8 @@ def test_root_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 2, @@ -5164,6 +5274,8 @@ def test_root_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 4, @@ -5227,6 +5339,8 @@ def test_root_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 5, @@ -5279,6 +5393,8 @@ def test_root_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 6, @@ -5362,6 +5478,8 @@ def test_root_graph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 6, @@ -5722,6 +5840,8 @@ def test_dynamic_interrupt( if "shallow" not in checkpointer_name: assert [c.metadata for c in tool_two.checkpointer.list(thread1)] == [ { + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -5729,6 +5849,7 @@ def test_dynamic_interrupt( "thread_id": "1", }, { + "checkpoint_ns": "", "parents": {}, "source": "input", "step": -1, @@ -5763,6 +5884,8 @@ def test_dynamic_interrupt( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -5791,6 +5914,8 @@ def test_dynamic_interrupt( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 1, @@ -5899,6 +6024,8 @@ def test_copy_checkpoint( if "shallow" not in checkpointer_name: assert [c.metadata for c in tool_two.checkpointer.list(thread1)] == [ { + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -5906,6 +6033,7 @@ def test_copy_checkpoint( "thread_id": "1", }, { + "checkpoint_ns": "", "parents": {}, "source": "input", "step": -1, @@ -5946,6 +6074,8 @@ def test_copy_checkpoint( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -5993,6 +6123,8 @@ def test_copy_checkpoint( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "fork", "step": 1, @@ -6101,6 +6233,8 @@ def test_dynamic_interrupt_subgraph( ) ] == [ { + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -6108,6 +6242,7 @@ def test_dynamic_interrupt_subgraph( "thread_id": "1", }, { + "checkpoint_ns": "", "parents": {}, "source": "input", "step": -1, @@ -6148,6 +6283,8 @@ def test_dynamic_interrupt_subgraph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -6180,6 +6317,8 @@ def test_dynamic_interrupt_subgraph( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 1, @@ -6268,6 +6407,8 @@ def test_start_branch_then( if "shallow" not in checkpointer_name: assert [c.metadata for c in tool_two.checkpointer.list(thread1)] == [ { + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -6276,6 +6417,7 @@ def test_start_branch_then( "thread_id": "1", }, { + "checkpoint_ns": "", "parents": {}, "source": "input", "step": -1, @@ -6298,6 +6440,8 @@ def test_start_branch_then( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -6329,6 +6473,8 @@ def test_start_branch_then( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -6362,6 +6508,8 @@ def test_start_branch_then( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -6393,6 +6541,8 @@ def test_start_branch_then( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -6426,6 +6576,8 @@ def test_start_branch_then( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -6454,6 +6606,8 @@ def test_start_branch_then( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 1, @@ -6485,6 +6639,8 @@ def test_start_branch_then( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 2, @@ -6859,6 +7015,8 @@ def test_branch_then( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -6889,6 +7047,8 @@ def test_branch_then( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 3, @@ -6921,6 +7081,8 @@ def test_branch_then( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -6951,6 +7113,8 @@ def test_branch_then( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 3, @@ -6991,6 +7155,8 @@ def test_branch_then( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 2, @@ -7022,6 +7188,8 @@ def test_branch_then( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 3, @@ -7062,6 +7230,8 @@ def test_branch_then( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -7092,6 +7262,8 @@ def test_branch_then( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 3, @@ -7124,6 +7296,8 @@ def test_branch_then( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -7154,6 +7328,8 @@ def test_branch_then( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 3, @@ -7184,6 +7360,7 @@ def test_branch_then( }, created_at=AnyStr(), metadata={ + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 0, @@ -7211,6 +7388,8 @@ def test_branch_then( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -7241,6 +7420,8 @@ def test_branch_then( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 3, @@ -7377,6 +7558,8 @@ def test_send_dedupe_on_resume( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "source": "loop", "writes": {"3": ["3"]}, "thread_id": "1", @@ -7413,6 +7596,8 @@ def test_send_dedupe_on_resume( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "source": "loop", "writes": {"2": ["2|3"], "3": ["3"], "flaky": ["flaky|4"]}, "thread_id": "1", @@ -7456,6 +7641,8 @@ def test_send_dedupe_on_resume( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "source": "loop", "writes": { "2": [ @@ -7521,6 +7708,8 @@ def test_send_dedupe_on_resume( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "source": "loop", "writes": {"1": ["1"]}, "thread_id": "1", @@ -7576,6 +7765,8 @@ def test_send_dedupe_on_resume( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "source": "loop", "writes": None, "thread_id": "1", @@ -7613,6 +7804,7 @@ def test_send_dedupe_on_resume( } }, metadata={ + "checkpoint_ns": "", "source": "input", "writes": {"__start__": ["0"]}, "thread_id": "1", @@ -7716,6 +7908,8 @@ def test_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": {"outer_1": {"my_key": "hi my value"}}, @@ -7767,6 +7961,8 @@ def test_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict({"": AnyStr()}), "parents": { "": AnyStr(), }, @@ -7813,6 +8009,8 @@ def test_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": {"outer_1": {"my_key": "hi my value"}}, @@ -7859,6 +8057,8 @@ def test_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": {"outer_1": {"my_key": "hi my value"}}, @@ -7897,6 +8097,8 @@ def test_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": None, @@ -7931,6 +8133,7 @@ def test_nested_graph_state( } }, metadata={ + "checkpoint_ns": "", "parents": {}, "source": "input", "writes": {"__start__": {"my_key": "my value"}}, @@ -7964,6 +8167,8 @@ def test_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict({"": AnyStr()}), "source": "loop", "writes": { "inner_1": { @@ -8012,6 +8217,8 @@ def test_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict({"": AnyStr()}), "source": "loop", "writes": None, "step": 0, @@ -8061,6 +8268,8 @@ def test_nested_graph_state( } }, metadata={ + "checkpoint_id": None, + "checkpoint_map": AnyDict({"": AnyStr()}), "source": "input", "writes": {"__start__": {"my_key": "hi my value"}}, "step": -1, @@ -8106,6 +8315,8 @@ def test_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": { @@ -8142,6 +8353,8 @@ def test_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": { @@ -8182,6 +8395,8 @@ def test_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": {"inner": {"my_key": "hi my value here and there"}}, @@ -8219,6 +8434,8 @@ def test_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": {"outer_1": {"my_key": "hi my value"}}, @@ -8253,6 +8470,8 @@ def test_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": None, @@ -8287,6 +8506,7 @@ def test_nested_graph_state( } }, metadata={ + "checkpoint_ns": "", "parents": {}, "source": "input", "writes": {"__start__": {"my_key": "my value"}}, @@ -8397,6 +8617,8 @@ def test_doubly_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": {"parent_1": {"my_key": "hi my value"}}, @@ -8443,6 +8665,8 @@ def test_doubly_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {"": AnyStr()}, "source": "loop", "writes": None, @@ -8489,6 +8713,8 @@ def test_doubly_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict({"": AnyStr(), AnyStr("child:"): AnyStr()}), "parents": AnyDict( { "": AnyStr(), @@ -8568,6 +8794,10 @@ def test_doubly_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict( + {"": AnyStr(), AnyStr("child:"): AnyStr()} + ), "parents": AnyDict( { "": AnyStr(), @@ -8626,6 +8856,8 @@ def test_doubly_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict({"": AnyStr()}), "parents": {"": AnyStr()}, "source": "loop", "writes": None, @@ -8665,6 +8897,8 @@ def test_doubly_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": {"parent_1": {"my_key": "hi my value"}}, @@ -8710,6 +8944,8 @@ def test_doubly_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": { @@ -8751,6 +8987,8 @@ def test_doubly_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": { @@ -8779,6 +9017,8 @@ def test_doubly_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "source": "loop", "writes": {"child": {"my_key": "hi my value here and there"}}, "step": 2, @@ -8827,6 +9067,8 @@ def test_doubly_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": {"parent_1": {"my_key": "hi my value"}}, @@ -8853,6 +9095,8 @@ def test_doubly_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "source": "loop", "writes": None, "step": 0, @@ -8887,6 +9131,7 @@ def test_doubly_nested_graph_state( } }, metadata={ + "checkpoint_ns": "", "source": "input", "writes": {"__start__": {"my_key": "my value"}}, "step": -1, @@ -8922,6 +9167,8 @@ def test_doubly_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict({"": AnyStr()}), "source": "loop", "writes": {"child_1": {"my_key": "hi my value here and there"}}, "step": 1, @@ -8961,6 +9208,8 @@ def test_doubly_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict({"": AnyStr()}), "source": "loop", "writes": None, "step": 0, @@ -9013,6 +9262,8 @@ def test_doubly_nested_graph_state( } }, metadata={ + "checkpoint_id": None, + "checkpoint_map": AnyDict({"": AnyStr()}), "source": "input", "writes": {"__start__": {"my_key": "hi my value"}}, "step": -1, @@ -9058,6 +9309,8 @@ def test_doubly_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict({"": AnyStr(), AnyStr("child1:"): AnyStr()}), "source": "loop", "writes": {"grandchild_2": {"my_key": "hi my value here and there"}}, "step": 2, @@ -9113,6 +9366,8 @@ def test_doubly_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict({"": AnyStr(), AnyStr("child1:"): AnyStr()}), "source": "loop", "writes": {"grandchild_1": {"my_key": "hi my value here"}}, "step": 1, @@ -9175,6 +9430,8 @@ def test_doubly_nested_graph_state( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict({"": AnyStr(), AnyStr("child1:"): AnyStr()}), "source": "loop", "writes": None, "step": 0, @@ -9237,6 +9494,8 @@ def test_doubly_nested_graph_state( } }, metadata={ + "checkpoint_id": None, + "checkpoint_map": AnyDict({"": AnyStr(), AnyStr("child1:"): AnyStr()}), "source": "input", "writes": {"__start__": {"my_key": "hi my value"}}, "step": -1, @@ -9502,6 +9761,8 @@ def test_send_react_interrupt( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "step": 1, "source": "loop", "writes": { @@ -9573,6 +9834,8 @@ def test_send_react_interrupt( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "step": 2, "source": "update", "writes": { @@ -9660,6 +9923,8 @@ def test_send_react_interrupt( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "step": 1, "source": "loop", "writes": { @@ -9754,6 +10019,8 @@ def test_send_react_interrupt( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "step": 2, "source": "update", "writes": { @@ -9970,6 +10237,8 @@ def test_send_react_interrupt_control( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "step": 1, "source": "loop", "writes": { @@ -10041,6 +10310,8 @@ def test_send_react_interrupt_control( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "step": 2, "source": "update", "writes": { @@ -10232,6 +10503,8 @@ def test_weather_subgraph( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "source": "loop", "writes": {"router_node": {"route": "weather"}}, "step": 1, @@ -10324,6 +10597,8 @@ def test_weather_subgraph( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "source": "loop", "writes": {"router_node": {"route": "weather"}}, "step": 1, @@ -10369,6 +10644,8 @@ def test_weather_subgraph( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict({"": AnyStr()}), "source": "loop", "writes": {"model_node": {"city": "San Francisco"}}, "step": 1, @@ -10432,6 +10709,8 @@ def test_weather_subgraph( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "source": "loop", "writes": {"router_node": {"route": "weather"}}, "step": 1, @@ -10478,6 +10757,7 @@ def test_weather_subgraph( } }, metadata={ + "checkpoint_map": AnyDict({"": AnyStr()}), "step": 2, "source": "update", "writes": { diff --git a/libs/langgraph/tests/test_large_cases_async.py b/libs/langgraph/tests/test_large_cases_async.py index 250cbfe72..28e76832c 100644 --- a/libs/langgraph/tests/test_large_cases_async.py +++ b/libs/langgraph/tests/test_large_cases_async.py @@ -133,6 +133,8 @@ async def test_invoke_two_processes_in_out_interrupt( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 6, @@ -156,6 +158,8 @@ async def test_invoke_two_processes_in_out_interrupt( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 5, @@ -179,6 +183,8 @@ async def test_invoke_two_processes_in_out_interrupt( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "input", "step": 4, @@ -200,6 +206,8 @@ async def test_invoke_two_processes_in_out_interrupt( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 3, @@ -223,6 +231,8 @@ async def test_invoke_two_processes_in_out_interrupt( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "input", "step": 2, @@ -244,6 +254,8 @@ async def test_invoke_two_processes_in_out_interrupt( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -267,6 +279,8 @@ async def test_invoke_two_processes_in_out_interrupt( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -290,6 +304,7 @@ async def test_invoke_two_processes_in_out_interrupt( } }, metadata={ + "checkpoint_ns": "", "parents": {}, "source": "input", "step": -1, @@ -366,6 +381,8 @@ async def test_fork_always_re_runs_nodes( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 5, @@ -387,6 +404,8 @@ async def test_fork_always_re_runs_nodes( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 4, @@ -408,6 +427,8 @@ async def test_fork_always_re_runs_nodes( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 3, @@ -429,6 +450,8 @@ async def test_fork_always_re_runs_nodes( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 2, @@ -450,6 +473,8 @@ async def test_fork_always_re_runs_nodes( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -471,6 +496,8 @@ async def test_fork_always_re_runs_nodes( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -494,6 +521,7 @@ async def test_fork_always_re_runs_nodes( } }, metadata={ + "checkpoint_ns": "", "parents": {}, "source": "input", "step": -1, @@ -834,6 +862,8 @@ async def test_conditional_graph(checkpointer_name: str) -> None: await app_w_interrupt.checkpointer.aget_tuple(config) ).checkpoint["ts"], metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -894,6 +924,8 @@ async def test_conditional_graph(checkpointer_name: str) -> None: }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 1, @@ -1018,6 +1050,8 @@ async def test_conditional_graph(checkpointer_name: str) -> None: }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 4, @@ -1100,6 +1134,8 @@ async def test_conditional_graph(checkpointer_name: str) -> None: }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -1160,6 +1196,8 @@ async def test_conditional_graph(checkpointer_name: str) -> None: }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 1, @@ -1284,6 +1322,8 @@ async def test_conditional_graph(checkpointer_name: str) -> None: }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 4, @@ -1366,6 +1406,8 @@ async def test_conditional_graph(checkpointer_name: str) -> None: }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -1798,6 +1840,8 @@ async def test_conditional_graph_state( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -1853,6 +1897,8 @@ async def test_conditional_graph_state( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 2, @@ -1943,6 +1989,8 @@ async def test_conditional_graph_state( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 5, @@ -2010,6 +2058,8 @@ async def test_conditional_graph_state( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -2064,6 +2114,8 @@ async def test_conditional_graph_state( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 2, @@ -2152,6 +2204,8 @@ async def test_conditional_graph_state( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 5, @@ -2768,6 +2822,8 @@ async def test_state_graph_packets(checkpointer_name: str) -> None: }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -2827,6 +2883,8 @@ async def test_state_graph_packets(checkpointer_name: str) -> None: config=tup.config, created_at=tup.checkpoint["ts"], metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 2, @@ -2936,6 +2994,8 @@ async def test_state_graph_packets(checkpointer_name: str) -> None: config=tup.config, created_at=tup.checkpoint["ts"], metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 4, @@ -3005,6 +3065,8 @@ async def test_state_graph_packets(checkpointer_name: str) -> None: config=tup.config, created_at=tup.checkpoint["ts"], metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 5, @@ -3079,6 +3141,8 @@ async def test_state_graph_packets(checkpointer_name: str) -> None: config=tup.config, created_at=tup.checkpoint["ts"], metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -3140,6 +3204,8 @@ async def test_state_graph_packets(checkpointer_name: str) -> None: config=tup.config, created_at=tup.checkpoint["ts"], metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 2, @@ -3249,6 +3315,8 @@ async def test_state_graph_packets(checkpointer_name: str) -> None: config=tup.config, created_at=tup.checkpoint["ts"], metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 4, @@ -3318,6 +3386,8 @@ async def test_state_graph_packets(checkpointer_name: str) -> None: config=tup.config, created_at=tup.checkpoint["ts"], metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 5, @@ -3575,6 +3645,8 @@ async def test_message_graph(checkpointer_name: str) -> None: config=tup.config, created_at=tup.checkpoint["ts"], metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -3629,6 +3701,8 @@ async def test_message_graph(checkpointer_name: str) -> None: config=tup.config, created_at=tup.checkpoint["ts"], metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 2, @@ -3719,6 +3793,8 @@ async def test_message_graph(checkpointer_name: str) -> None: config=tup.config, created_at=tup.checkpoint["ts"], metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 4, @@ -3779,6 +3855,8 @@ async def test_message_graph(checkpointer_name: str) -> None: config=tup.config, created_at=tup.checkpoint["ts"], metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 5, @@ -4087,6 +4165,8 @@ async def test_start_branch_then(checkpointer_name: str) -> None: if "shallow" not in checkpointer_name: assert [c.metadata async for c in tool_two.checkpointer.alist(thread1)] == [ { + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -4095,6 +4175,7 @@ async def test_start_branch_then(checkpointer_name: str) -> None: "thread_id": "1", }, { + "checkpoint_ns": "", "parents": {}, "source": "input", "step": -1, @@ -4117,6 +4198,8 @@ async def test_start_branch_then(checkpointer_name: str) -> None: }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -4150,6 +4233,8 @@ async def test_start_branch_then(checkpointer_name: str) -> None: }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -4185,6 +4270,8 @@ async def test_start_branch_then(checkpointer_name: str) -> None: }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -4218,6 +4305,8 @@ async def test_start_branch_then(checkpointer_name: str) -> None: }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -4253,6 +4342,8 @@ async def test_start_branch_then(checkpointer_name: str) -> None: }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -4283,6 +4374,8 @@ async def test_start_branch_then(checkpointer_name: str) -> None: }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 1, @@ -4316,6 +4409,8 @@ async def test_start_branch_then(checkpointer_name: str) -> None: }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 2, @@ -4856,6 +4951,8 @@ async def test_branch_then(checkpointer_name: str) -> None: }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -4888,6 +4985,8 @@ async def test_branch_then(checkpointer_name: str) -> None: }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 3, @@ -4922,6 +5021,8 @@ async def test_branch_then(checkpointer_name: str) -> None: }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -4954,6 +5055,8 @@ async def test_branch_then(checkpointer_name: str) -> None: }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 3, @@ -4996,6 +5099,8 @@ async def test_branch_then(checkpointer_name: str) -> None: }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -5028,6 +5133,8 @@ async def test_branch_then(checkpointer_name: str) -> None: }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 3, @@ -5062,6 +5169,8 @@ async def test_branch_then(checkpointer_name: str) -> None: }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -5094,6 +5203,8 @@ async def test_branch_then(checkpointer_name: str) -> None: }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 3, @@ -5122,6 +5233,7 @@ async def test_branch_then(checkpointer_name: str) -> None: config=uconfig, created_at=AnyStr(), metadata={ + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 0, @@ -5149,6 +5261,8 @@ async def test_branch_then(checkpointer_name: str) -> None: }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -5175,6 +5289,8 @@ async def test_branch_then(checkpointer_name: str) -> None: }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 3, @@ -5266,6 +5382,8 @@ async def test_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": {"outer_1": {"my_key": "hi my value"}}, @@ -5317,6 +5435,8 @@ async def test_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict({"": AnyStr()}), "parents": { "": AnyStr(), }, @@ -5363,6 +5483,8 @@ async def test_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": {"outer_1": {"my_key": "hi my value"}}, @@ -5409,6 +5531,8 @@ async def test_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": {"outer_1": {"my_key": "hi my value"}}, @@ -5447,6 +5571,8 @@ async def test_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": None, @@ -5481,6 +5607,7 @@ async def test_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_ns": "", "parents": {}, "source": "input", "writes": {"__start__": {"my_key": "my value"}}, @@ -5516,6 +5643,8 @@ async def test_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict({"": AnyStr()}), "source": "loop", "writes": { "inner_1": { @@ -5564,6 +5693,8 @@ async def test_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict({"": AnyStr()}), "source": "loop", "writes": None, "step": 0, @@ -5613,6 +5744,8 @@ async def test_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": None, + "checkpoint_map": AnyDict({"": AnyStr()}), "source": "input", "writes": {"__start__": {"my_key": "hi my value"}}, "step": -1, @@ -5658,6 +5791,8 @@ async def test_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": { @@ -5694,6 +5829,8 @@ async def test_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": { @@ -5736,6 +5873,8 @@ async def test_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": {"inner": {"my_key": "hi my value here and there"}}, @@ -5776,6 +5915,8 @@ async def test_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": {"outer_1": {"my_key": "hi my value"}}, @@ -5810,6 +5951,8 @@ async def test_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": None, @@ -5844,6 +5987,7 @@ async def test_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_ns": "", "parents": {}, "source": "input", "writes": {"__start__": {"my_key": "my value"}}, @@ -5953,6 +6097,8 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": {"parent_1": {"my_key": "hi my value"}}, @@ -5999,6 +6145,8 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {"": AnyStr()}, "source": "loop", "writes": None, @@ -6045,6 +6193,8 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict({"": AnyStr(), AnyStr("child:"): AnyStr()}), "parents": AnyDict( { "": AnyStr(), @@ -6124,6 +6274,10 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict( + {"": AnyStr(), AnyStr("child:"): AnyStr()} + ), "parents": AnyDict( { "": AnyStr(), @@ -6186,6 +6340,8 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict({"": AnyStr()}), "parents": {"": AnyStr()}, "source": "loop", "writes": None, @@ -6225,6 +6381,8 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": {"parent_1": {"my_key": "hi my value"}}, @@ -6273,6 +6431,8 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": { @@ -6318,6 +6478,8 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": { @@ -6348,6 +6510,8 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": {"child": {"my_key": "hi my value here and there"}}, @@ -6392,6 +6556,8 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": {"parent_1": {"my_key": "hi my value"}}, @@ -6449,6 +6615,7 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_ns": "", "parents": {}, "source": "input", "writes": {"my_key": "my value"}, @@ -6484,6 +6651,8 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict({"": AnyStr()}), "source": "loop", "writes": {"child_1": {"my_key": "hi my value here and there"}}, "step": 1, @@ -6523,6 +6692,8 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict({"": AnyStr()}), "source": "loop", "writes": None, "step": 0, @@ -6575,6 +6746,8 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": None, + "checkpoint_map": AnyDict({"": AnyStr()}), "source": "input", "writes": {"__start__": {"my_key": "hi my value"}}, "step": -1, @@ -6622,6 +6795,10 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict( + {"": AnyStr(), AnyStr("child:"): AnyStr()} + ), "source": "loop", "writes": { "grandchild_2": {"my_key": "hi my value here and there"} @@ -6679,6 +6856,10 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict( + {"": AnyStr(), AnyStr("child:"): AnyStr()} + ), "source": "loop", "writes": {"grandchild_1": {"my_key": "hi my value here"}}, "step": 1, @@ -6741,6 +6922,10 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict( + {"": AnyStr(), AnyStr("child:"): AnyStr()} + ), "source": "loop", "writes": None, "step": 0, @@ -6803,6 +6988,10 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": None, + "checkpoint_map": AnyDict( + {"": AnyStr(), AnyStr("child:"): AnyStr()} + ), "source": "input", "writes": {"__start__": {"my_key": "hi my value"}}, "step": -1, @@ -7081,6 +7270,8 @@ async def test_weather_subgraph( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "source": "loop", "writes": {"router_node": {"route": "weather"}}, "step": 1, @@ -7177,6 +7368,8 @@ async def test_weather_subgraph( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "source": "loop", "writes": {"router_node": {"route": "weather"}}, "step": 1, @@ -7222,6 +7415,8 @@ async def test_weather_subgraph( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_map": AnyDict({"": AnyStr()}), "source": "loop", "writes": {"model_node": {"city": "San Francisco"}}, "step": 1, @@ -7285,6 +7480,8 @@ async def test_weather_subgraph( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "source": "loop", "writes": {"router_node": {"route": "weather"}}, "step": 1, @@ -7331,6 +7528,7 @@ async def test_weather_subgraph( } }, metadata={ + "checkpoint_map": AnyDict({"": AnyStr()}), "step": 2, "source": "update", "writes": { diff --git a/libs/langgraph/tests/test_prebuilt.py b/libs/langgraph/tests/test_prebuilt.py index b0a19d530..9d662ce14 100644 --- a/libs/langgraph/tests/test_prebuilt.py +++ b/libs/langgraph/tests/test_prebuilt.py @@ -63,6 +63,7 @@ from langgraph.store.base import BaseStore from langgraph.store.memory import InMemoryStore from langgraph.types import Command, Interrupt, interrupt from langgraph.utils.config import get_stream_writer +from tests.any_str import AnyStr from tests.conftest import ( ALL_CHECKPOINTERS_ASYNC, ALL_CHECKPOINTERS_SYNC, @@ -182,6 +183,8 @@ def test_no_prompt( "agent": "agent", } assert saved.metadata == { + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": {"agent": {"messages": [AIMessage(content="hi?", id="0")]}}, @@ -214,6 +217,8 @@ async def test_no_prompt_async(checkpointer_name: str) -> None: "agent": "agent", } assert saved.metadata == { + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": {"agent": {"messages": [AIMessage(content="hi?", id="0")]}}, diff --git a/libs/langgraph/tests/test_pregel.py b/libs/langgraph/tests/test_pregel.py index ccd4fae94..6d0832944 100644 --- a/libs/langgraph/tests/test_pregel.py +++ b/libs/langgraph/tests/test_pregel.py @@ -1112,6 +1112,8 @@ def test_pending_writes_resume( PregelTask(AnyStr(), "two", (PULL, "two"), 'ConnectionError("I\'m not good")'), ) assert state.metadata == { + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -1210,6 +1212,8 @@ def test_pending_writes_resume( "channel_values": {"one": "one", "two": "two", "value": 6}, }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "step": 1, "source": "loop", @@ -1260,6 +1264,8 @@ def test_pending_writes_resume( }, }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "step": 0, "source": "loop", @@ -1301,6 +1307,7 @@ def test_pending_writes_resume( "channel_values": {"__start__": {"value": 1}}, }, metadata={ + "checkpoint_ns": "", "parents": {}, "step": -1, "source": "input", @@ -2391,6 +2398,8 @@ def test_in_one_fan_out_state_graph_waiting_edge( }, created_at=AnyStr(), metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 4, @@ -4826,6 +4835,8 @@ def test_parent_command(request: pytest.FixtureRequest, checkpointer_name: str) } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "source": "loop", "writes": { "alice": { diff --git a/libs/langgraph/tests/test_pregel_async.py b/libs/langgraph/tests/test_pregel_async.py index f369a7aa7..dc91fc2e9 100644 --- a/libs/langgraph/tests/test_pregel_async.py +++ b/libs/langgraph/tests/test_pregel_async.py @@ -606,6 +606,8 @@ async def test_dynamic_interrupt(checkpointer_name: str) -> None: if "shallow" not in checkpointer_name: assert [c.metadata async for c in tool_two.checkpointer.alist(thread1)] == [ { + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -613,6 +615,7 @@ async def test_dynamic_interrupt(checkpointer_name: str) -> None: "thread_id": "1", }, { + "checkpoint_ns": "", "parents": {}, "source": "input", "step": -1, @@ -641,6 +644,8 @@ async def test_dynamic_interrupt(checkpointer_name: str) -> None: config=tup.config, created_at=tup.checkpoint["ts"], metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -667,6 +672,8 @@ async def test_dynamic_interrupt(checkpointer_name: str) -> None: config=tup.config, created_at=tup.checkpoint["ts"], metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 1, @@ -791,6 +798,8 @@ async def test_dynamic_interrupt_subgraph(checkpointer_name: str) -> None: c.metadata async for c in tool_two.checkpointer.alist(thread1root) ] == [ { + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -798,6 +807,7 @@ async def test_dynamic_interrupt_subgraph(checkpointer_name: str) -> None: "thread_id": "1", }, { + "checkpoint_ns": "", "parents": {}, "source": "input", "step": -1, @@ -832,6 +842,8 @@ async def test_dynamic_interrupt_subgraph(checkpointer_name: str) -> None: config=tup.config, created_at=tup.checkpoint["ts"], metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -858,6 +870,8 @@ async def test_dynamic_interrupt_subgraph(checkpointer_name: str) -> None: config=tup.config, created_at=tup.checkpoint["ts"], metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "update", "step": 1, @@ -976,6 +990,8 @@ async def test_copy_checkpoint(checkpointer_name: str) -> None: if "shallow" not in checkpointer_name: assert [c.metadata async for c in tool_two.checkpointer.alist(thread1)] == [ { + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -983,6 +999,7 @@ async def test_copy_checkpoint(checkpointer_name: str) -> None: "thread_id": "1", }, { + "checkpoint_ns": "", "parents": {}, "source": "input", "step": -1, @@ -1021,6 +1038,8 @@ async def test_copy_checkpoint(checkpointer_name: str) -> None: config=tup.config, created_at=tup.checkpoint["ts"], metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -1064,6 +1083,8 @@ async def test_copy_checkpoint(checkpointer_name: str) -> None: config=tup.config, created_at=tup.checkpoint["ts"], metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "fork", "step": 1, @@ -1230,6 +1251,8 @@ async def test_cancel_graph_astream(checkpointer_name: str) -> None: assert state.values == {"value": 3} # 1 + 2 assert state.next == ("aparallelwhile",) assert state.metadata == { + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -1307,6 +1330,8 @@ async def test_cancel_graph_astream_events_v2(checkpointer_name: Optional[str]) assert state.values == {"value": 2} assert state.next == ("awhile",) assert state.metadata == { + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 1, @@ -2007,6 +2032,8 @@ async def test_pending_writes_resume( ), ) assert state.metadata == { + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "step": 0, @@ -2105,6 +2132,8 @@ async def test_pending_writes_resume( "channel_values": {"one": "one", "two": "two", "value": 6}, }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "step": 1, "source": "loop", @@ -2157,6 +2186,8 @@ async def test_pending_writes_resume( }, }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "step": 0, "source": "loop", @@ -2200,6 +2231,7 @@ async def test_pending_writes_resume( "channel_values": {"__start__": {"value": 1}}, }, metadata={ + "checkpoint_ns": "", "parents": {}, "step": -1, "source": "input", @@ -2778,6 +2810,8 @@ async def test_send_dedupe_on_resume(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "source": "loop", "writes": {"3": ["3"]}, "thread_id": "1", @@ -2814,6 +2848,8 @@ async def test_send_dedupe_on_resume(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "source": "loop", "writes": {"2": ["2|3"], "3": ["3"], "flaky": ["flaky|4"]}, "thread_id": "1", @@ -2857,6 +2893,8 @@ async def test_send_dedupe_on_resume(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "source": "loop", "writes": { "2": [ @@ -2922,6 +2960,8 @@ async def test_send_dedupe_on_resume(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "source": "loop", "writes": {"1": ["1"]}, "thread_id": "1", @@ -2977,6 +3017,8 @@ async def test_send_dedupe_on_resume(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "source": "loop", "writes": None, "thread_id": "1", @@ -3014,6 +3056,7 @@ async def test_send_dedupe_on_resume(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_ns": "", "source": "input", "writes": {"__start__": ["0"]}, "thread_id": "1", @@ -3186,6 +3229,8 @@ async def test_send_react_interrupt(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "step": 1, "source": "loop", "writes": { @@ -3257,6 +3302,8 @@ async def test_send_react_interrupt(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "step": 2, "source": "update", "writes": { @@ -3344,6 +3391,8 @@ async def test_send_react_interrupt(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "step": 1, "source": "loop", "writes": { @@ -3436,6 +3485,8 @@ async def test_send_react_interrupt(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "step": 2, "source": "update", "writes": { @@ -3651,6 +3702,8 @@ async def test_send_react_interrupt_control( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "step": 1, "source": "loop", "writes": { @@ -3722,6 +3775,8 @@ async def test_send_react_interrupt_control( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "step": 2, "source": "update", "writes": { @@ -4671,6 +4726,8 @@ async def test_in_one_fan_out_state_graph_waiting_edge_custom_state_class( } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "parents": {}, "source": "loop", "writes": {"qa": {"answer": "doc1,doc2,doc3,doc4"}}, @@ -6145,6 +6202,8 @@ async def test_parent_command(checkpointer_name: str) -> None: } }, metadata={ + "checkpoint_id": AnyStr(), + "checkpoint_ns": "", "source": "loop", "writes": { "alice": {