From 936176eb2145a78c110bf5a8697e12e8bbc800b7 Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Sun, 25 May 2025 10:57:58 -0700 Subject: [PATCH] Remove Checkpoint.writes - This has been superseded by saving the individual writes of each task through put_writes() - Removing this speeds up checkpoint operations as it was duplicating data saved elsewhere already --- .../langgraph/checkpoint/postgres/__init__.py | 24 +- .../langgraph/checkpoint/postgres/aio.py | 26 +- .../langgraph/checkpoint/postgres/base.py | 25 - .../langgraph/checkpoint/base/__init__.py | 16 +- libs/checkpoint/tests/test_memory.py | 2 +- libs/langgraph/langgraph/pregel/__init__.py | 8 - libs/langgraph/langgraph/pregel/io.py | 10 +- libs/langgraph/langgraph/pregel/loop.py | 15 +- .../tests/test_checkpoint_migration.py | 36 - libs/langgraph/tests/test_io.py | 18 - libs/langgraph/tests/test_large_cases.py | 684 ------------------ .../langgraph/tests/test_large_cases_async.py | 408 ----------- libs/langgraph/tests/test_pregel.py | 36 - libs/langgraph/tests/test_pregel_async.py | 125 ---- libs/prebuilt/tests/test_react_agent.py | 2 - 15 files changed, 36 insertions(+), 1399 deletions(-) delete mode 100644 libs/langgraph/tests/test_io.py diff --git a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/__init__.py b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/__init__.py index e4f42078a..41f06e869 100644 --- a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/__init__.py +++ b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/__init__.py @@ -181,11 +181,11 @@ class PostgresSaver(BasePostgresSaver): "checkpoint_id": value["checkpoint_id"], } }, - self._load_checkpoint( - value["checkpoint"], - value["channel_values"], - ), - self._load_metadata(value["metadata"]), + { + **value["checkpoint"], + "channel_values": self._load_blobs(value["channel_values"]), + }, + value["metadata"], ( { "configurable": { @@ -277,11 +277,11 @@ class PostgresSaver(BasePostgresSaver): "checkpoint_id": value["checkpoint_id"], } }, - self._load_checkpoint( - value["checkpoint"], - value["channel_values"], - ), - self._load_metadata(value["metadata"]), + { + **value["checkpoint"], + "channel_values": self._load_blobs(value["channel_values"]), + }, + value["metadata"], ( { "configurable": { @@ -361,8 +361,8 @@ class PostgresSaver(BasePostgresSaver): checkpoint_ns, checkpoint["id"], checkpoint_id, - Jsonb(self._dump_checkpoint(copy)), - self._dump_metadata(get_checkpoint_metadata(config, metadata)), + Jsonb(copy), + Jsonb(get_checkpoint_metadata(config, 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 4d96e8336..5e5660cb6 100644 --- a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/aio.py +++ b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/aio.py @@ -168,12 +168,11 @@ class AsyncPostgresSaver(BasePostgresSaver): "checkpoint_id": value["checkpoint_id"], } }, - await asyncio.to_thread( - self._load_checkpoint, - value["checkpoint"], - value["channel_values"], - ), - self._load_metadata(value["metadata"]), + { + **value["checkpoint"], + "channel_values": self._load_blobs(value["channel_values"]), + }, + value["metadata"], ( { "configurable": { @@ -245,12 +244,11 @@ class AsyncPostgresSaver(BasePostgresSaver): "checkpoint_id": value["checkpoint_id"], } }, - await asyncio.to_thread( - self._load_checkpoint, - value["checkpoint"], - value["channel_values"], - ), - self._load_metadata(value["metadata"]), + { + **value["checkpoint"], + "channel_values": self._load_blobs(value["channel_values"]), + }, + value["metadata"], ( { "configurable": { @@ -320,8 +318,8 @@ class AsyncPostgresSaver(BasePostgresSaver): checkpoint_ns, checkpoint["id"], checkpoint_id, - Jsonb(self._dump_checkpoint(copy)), - self._dump_metadata(get_checkpoint_metadata(config, metadata)), + Jsonb(copy), + Jsonb(get_checkpoint_metadata(config, metadata)), ), ) return next_config diff --git a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/base.py b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/base.py index 785f9989b..e4b9b2e65 100644 --- a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/base.py +++ b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/base.py @@ -9,11 +9,8 @@ from langgraph.checkpoint.base import ( WRITES_IDX_MAP, BaseCheckpointSaver, ChannelVersions, - Checkpoint, - CheckpointMetadata, get_checkpoint_id, ) -from langgraph.checkpoint.serde.jsonplus import JsonPlusSerializer from langgraph.checkpoint.serde.types import TASKS MetadataInput = Optional[dict[str, Any]] @@ -150,7 +147,6 @@ class BasePostgresSaver(BaseCheckpointSaver[str]): UPSERT_CHECKPOINT_WRITES_SQL = UPSERT_CHECKPOINT_WRITES_SQL INSERT_CHECKPOINT_WRITES_SQL = INSERT_CHECKPOINT_WRITES_SQL - jsonplus_serde = JsonPlusSerializer() supports_pipeline: bool def _migrate_pending_sends( @@ -173,19 +169,6 @@ class BasePostgresSaver(BaseCheckpointSaver[str]): else self.get_next_version(None) ) - def _load_checkpoint( - self, - checkpoint: dict[str, Any], - channel_values: list[tuple[bytes, bytes, bytes]], - ) -> Checkpoint: - return { - **checkpoint, - "channel_values": self._load_blobs(channel_values), - } - - def _dump_checkpoint(self, checkpoint: Checkpoint) -> dict[str, Any]: - return checkpoint - def _load_blobs( self, blob_values: list[tuple[bytes, bytes, bytes]] ) -> dict[str, Any]: @@ -261,14 +244,6 @@ class BasePostgresSaver(BaseCheckpointSaver[str]): for idx, (channel, value) in enumerate(writes) ] - def _load_metadata(self, metadata: dict[str, Any]) -> CheckpointMetadata: - return self.jsonplus_serde.loads(self.jsonplus_serde.dumps(metadata)) - - def _dump_metadata(self, metadata: CheckpointMetadata) -> str: - serialized_metadata = self.jsonplus_serde.dumps(metadata) - # NOTE: we're using JSON serializer (not msgpack), so we need to remove null characters before writing - return serialized_metadata.decode().replace("\\u0000", "") - def get_next_version(self, current: Optional[str]) -> str: if current is None: current_v = 0 diff --git a/libs/checkpoint/langgraph/checkpoint/base/__init__.py b/libs/checkpoint/langgraph/checkpoint/base/__init__.py index 35aa32fa1..4c57d033a 100644 --- a/libs/checkpoint/langgraph/checkpoint/base/__init__.py +++ b/libs/checkpoint/langgraph/checkpoint/base/__init__.py @@ -45,11 +45,6 @@ class CheckpointMetadata(TypedDict, total=False): 0 for the first "loop" checkpoint. ... for the nth checkpoint afterwards. """ - writes: dict[str, Any] - """The writes that were made between the previous checkpoint and this one. - - Mapping from node name to writes emitted by that node. - """ parents: dict[str, str] """The IDs of the parent checkpoints. @@ -377,7 +372,10 @@ def get_checkpoint_metadata( config: RunnableConfig, metadata: CheckpointMetadata ) -> CheckpointMetadata: """Get checkpoint metadata in a backwards-compatible manner.""" - metadata = metadata.copy() + metadata = { + k: v.replace("\u0000", "") if isinstance(v, str) else v + for k, v in metadata.items() + } for obj in (config.get("metadata"), config.get("configurable")): if not obj: continue @@ -385,8 +383,10 @@ def get_checkpoint_metadata( if key in metadata or key in EXCLUDED_METADATA_KEYS or key.startswith("__"): continue v = obj[key] - if isinstance(v, (str, int, bool, float)): - metadata[key] = v # type: ignore[literal-required] + if isinstance(v, str): + metadata[key] = v.replace("\u0000", "") + elif isinstance(v, (int, bool, float)): + metadata[key] = v return metadata diff --git a/libs/checkpoint/tests/test_memory.py b/libs/checkpoint/tests/test_memory.py index 975c1e02c..b0eeb319b 100644 --- a/libs/checkpoint/tests/test_memory.py +++ b/libs/checkpoint/tests/test_memory.py @@ -8,7 +8,7 @@ from langgraph.checkpoint.base import ( CheckpointMetadata, ) from langgraph.checkpoint.memory import InMemorySaver -from tests.checkpoint_utils import ( # type: ignore[import-untyped] +from tests.checkpoint_utils import ( create_checkpoint, empty_checkpoint, ) diff --git a/libs/langgraph/langgraph/pregel/__init__.py b/libs/langgraph/langgraph/pregel/__init__.py index 1fbbcb96c..dd60f0e76 100644 --- a/libs/langgraph/langgraph/pregel/__init__.py +++ b/libs/langgraph/langgraph/pregel/__init__.py @@ -1559,7 +1559,6 @@ class Pregel(PregelProtocol): **checkpoint_metadata, "source": "update", "step": step + 1, - "writes": {}, "parents": saved.metadata.get("parents", {}) if saved else {}, }, {}, @@ -1583,7 +1582,6 @@ class Pregel(PregelProtocol): **checkpoint_metadata, "source": "update", "step": step + 1, - "writes": {}, "parents": saved.metadata.get("parents", {}) if saved else {}, }, {}, @@ -1621,7 +1619,6 @@ class Pregel(PregelProtocol): **checkpoint_metadata, "source": "input", "step": next_step, - "writes": dict(input_writes), }, get_new_channel_versions( checkpoint_previous_versions, @@ -1813,7 +1810,6 @@ class Pregel(PregelProtocol): **checkpoint_metadata, "source": "update", "step": step + 1, - "writes": {as_node: values for as_node, values in valid_updates}, "parents": saved.metadata.get("parents", {}) if saved else {}, }, get_new_channel_versions( @@ -1974,7 +1970,6 @@ class Pregel(PregelProtocol): **checkpoint_metadata, "source": "update", "step": step + 1, - "writes": {}, "parents": saved.metadata.get("parents", {}) if saved else {}, }, {}, @@ -1998,7 +1993,6 @@ class Pregel(PregelProtocol): **checkpoint_metadata, "source": "update", "step": step + 1, - "writes": {}, "parents": saved.metadata.get("parents", {}) if saved else {}, }, {}, @@ -2036,7 +2030,6 @@ class Pregel(PregelProtocol): **checkpoint_metadata, "source": "input", "step": next_step, - "writes": dict(input_writes), }, get_new_channel_versions( checkpoint_previous_versions, @@ -2226,7 +2219,6 @@ class Pregel(PregelProtocol): **checkpoint_metadata, "source": "update", "step": step + 1, - "writes": {as_node: values for as_node, values in valid_updates}, "parents": saved.metadata.get("parents", {}) if saved else {}, }, get_new_channel_versions( diff --git a/libs/langgraph/langgraph/pregel/io.py b/libs/langgraph/langgraph/pregel/io.py index 7b2578dce..157be21f2 100644 --- a/libs/langgraph/langgraph/pregel/io.py +++ b/libs/langgraph/langgraph/pregel/io.py @@ -1,6 +1,6 @@ from collections import Counter from collections.abc import Iterator, Mapping, Sequence -from typing import Any, Literal, Optional, TypeVar, Union +from typing import Any, Literal, Optional, Union from langgraph.channels.base import BaseChannel, EmptyChannelError from langgraph.constants import ( @@ -172,11 +172,3 @@ def map_output_updates( if cached: grouped["__metadata__"] = {"cached": cached} yield grouped - - -T = TypeVar("T") - - -def single(iter: Iterator[T]) -> Optional[T]: - for item in iter: - return item diff --git a/libs/langgraph/langgraph/pregel/loop.py b/libs/langgraph/langgraph/pregel/loop.py index 872303cab..eb56d5885 100644 --- a/libs/langgraph/langgraph/pregel/loop.py +++ b/libs/langgraph/langgraph/pregel/loop.py @@ -112,7 +112,6 @@ from langgraph.pregel.io import ( map_output_updates, map_output_values, read_channels, - single, ) from langgraph.pregel.read import PregelNode from langgraph.pregel.utils import get_new_channel_versions, is_xxh3_128_hexdigest @@ -520,17 +519,7 @@ class PregelLoop: # "not skip_done_tasks" only applies to first tick after resuming self.skip_done_tasks = True # save checkpoint - self._put_checkpoint( - { - "source": "loop", - "writes": single( - map_output_updates( - self.output_keys, - [(t, t.writes) for t in self.tasks.values()], - ) - ), - } - ) + self._put_checkpoint({"source": "loop"}) # after execution, check if we should interrupt if self.interrupt_after and should_interrupt( self.checkpoint, self.interrupt_after, self.tasks.values() @@ -760,7 +749,7 @@ class PregelLoop: self.trigger_to_nodes, ) # save input checkpoint - self._put_checkpoint({"source": "input", "writes": dict(input_writes)}) + self._put_checkpoint({"source": "input"}) # set flag if ( self.input_model is not None diff --git a/libs/langgraph/tests/test_checkpoint_migration.py b/libs/langgraph/tests/test_checkpoint_migration.py index 4f4c406dd..307195924 100644 --- a/libs/langgraph/tests/test_checkpoint_migration.py +++ b/libs/langgraph/tests/test_checkpoint_migration.py @@ -44,7 +44,6 @@ def get_expected_history(*, exc_task_results: int = 0) -> list[StateSnapshot]: }, metadata={ "source": "loop", - "writes": {"qa": {"answer": "doc1,doc2,doc3,doc4"}}, "step": 4, "parents": {}, "thread_id": "1", @@ -75,7 +74,6 @@ def get_expected_history(*, exc_task_results: int = 0) -> list[StateSnapshot]: }, metadata={ "source": "loop", - "writes": {"retriever_one": {"docs": ["doc1", "doc2"]}}, "step": 3, "parents": {}, "thread_id": "1", @@ -134,10 +132,6 @@ def get_expected_history(*, exc_task_results: int = 0) -> list[StateSnapshot]: }, metadata={ "source": "loop", - "writes": { - "analyzer_one": {"query": "analyzed: query: what is weather in sf"}, - "retriever_two": {"docs": ["doc3", "doc4"]}, - }, "step": 2, "parents": {}, "thread_id": "1", @@ -175,7 +169,6 @@ def get_expected_history(*, exc_task_results: int = 0) -> list[StateSnapshot]: }, metadata={ "source": "loop", - "writes": {"rewrite_query": {"query": "query: what is weather in sf"}}, "step": 1, "parents": {}, "thread_id": "1", @@ -226,7 +219,6 @@ def get_expected_history(*, exc_task_results: int = 0) -> list[StateSnapshot]: }, metadata={ "source": "loop", - "writes": None, "step": 0, "parents": {}, "thread_id": "1", @@ -266,7 +258,6 @@ def get_expected_history(*, exc_task_results: int = 0) -> list[StateSnapshot]: }, metadata={ "source": "input", - "writes": {"__start__": {"query": "what is weather in sf"}}, "step": -1, "parents": {}, "thread_id": "1", @@ -353,7 +344,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "writes": {"qa": {"answer": "doc1,doc2,doc3,doc4"}}, "step": 4, "parents": {}, "thread_id": "1", @@ -415,7 +405,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "writes": {"retriever_one": {"docs": ["doc1", "doc2"]}}, "step": 3, "parents": {}, "thread_id": "1", @@ -492,10 +481,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "writes": { - "analyzer_one": {"query": "analyzed: query: what is weather in sf"}, - "retriever_two": {"docs": ["doc3", "doc4"]}, - }, "step": 2, "parents": {}, "thread_id": "1", @@ -548,7 +533,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "writes": {"rewrite_query": {"query": "query: what is weather in sf"}}, "step": 1, "parents": {}, "thread_id": "1", @@ -604,7 +588,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "writes": None, "step": 0, "parents": {}, "thread_id": "1", @@ -654,7 +637,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "input", - "writes": {"__start__": {"query": "what is weather in sf"}}, "step": -1, "parents": {}, "thread_id": "1", @@ -741,7 +723,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "writes": {"qa": {"answer": "doc1,doc2,doc3,doc4"}}, "thread_id": "1", "step": 4, "parents": {}, @@ -804,7 +785,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "writes": {"retriever_one": {"docs": ["doc1", "doc2"]}}, "thread_id": "1", "step": 3, "parents": {}, @@ -884,10 +864,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "writes": { - "analyzer_one": {"query": "analyzed: query: what is weather in sf"}, - "retriever_two": {"docs": ["doc3", "doc4"]}, - }, "thread_id": "1", "step": 2, "parents": {}, @@ -944,7 +920,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "writes": {"rewrite_query": {"query": "query: what is weather in sf"}}, "thread_id": "1", "step": 1, "parents": {}, @@ -1005,7 +980,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "writes": None, "thread_id": "1", "step": 0, "parents": {}, @@ -1055,7 +1029,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "input", - "writes": {"__start__": {"query": "what is weather in sf"}}, "thread_id": "1", "step": -1, "parents": {}, @@ -1142,7 +1115,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "writes": {"qa": {"answer": "doc1,doc2,doc3,doc4"}}, "thread_id": "1", "step": 4, "parents": {}, @@ -1205,7 +1177,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "writes": {"retriever_one": {"docs": ["doc1", "doc2"]}}, "thread_id": "1", "step": 3, "parents": {}, @@ -1285,10 +1256,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "writes": { - "analyzer_one": {"query": "analyzed: query: what is weather in sf"}, - "retriever_two": {"docs": ["doc3", "doc4"]}, - }, "thread_id": "1", "step": 2, "parents": {}, @@ -1345,7 +1312,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "writes": {"rewrite_query": {"query": "query: what is weather in sf"}}, "thread_id": "1", "step": 1, "parents": {}, @@ -1406,7 +1372,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "loop", - "writes": None, "thread_id": "1", "step": 0, "parents": {}, @@ -1456,7 +1421,6 @@ SAVED_CHECKPOINTS = { }, metadata={ "source": "input", - "writes": {"__start__": {"query": "what is weather in sf"}}, "thread_id": "1", "step": -1, "parents": {}, diff --git a/libs/langgraph/tests/test_io.py b/libs/langgraph/tests/test_io.py deleted file mode 100644 index 40fd18e60..000000000 --- a/libs/langgraph/tests/test_io.py +++ /dev/null @@ -1,18 +0,0 @@ -from collections.abc import Iterator - -from langgraph.pregel.io import single - - -def test_single() -> None: - closed = False - - def myiter() -> Iterator[int]: - try: - yield 1 - yield 2 - finally: - nonlocal closed - closed = True - - assert single(myiter()) == 1 - assert closed diff --git a/libs/langgraph/tests/test_large_cases.py b/libs/langgraph/tests/test_large_cases.py index 8d6ba1909..2a58fccbc 100644 --- a/libs/langgraph/tests/test_large_cases.py +++ b/libs/langgraph/tests/test_large_cases.py @@ -128,7 +128,6 @@ def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "loop", "step": 6, - "writes": {"two": 5}, "thread_id": "1", }, created_at=AnyStr(), @@ -150,7 +149,6 @@ def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "loop", "step": 5, - "writes": {"one": None}, "thread_id": "1", }, created_at=AnyStr(), @@ -172,7 +170,6 @@ def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "input", "step": 4, - "writes": {"input": 3}, "thread_id": "1", }, created_at=AnyStr(), @@ -194,7 +191,6 @@ def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "loop", "step": 3, - "writes": {"one": None}, "thread_id": "1", }, created_at=AnyStr(), @@ -216,7 +212,6 @@ def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "input", "step": 2, - "writes": {"input": 20}, "thread_id": "1", }, created_at=AnyStr(), @@ -238,7 +233,6 @@ def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "loop", "step": 1, - "writes": {"two": 4}, "thread_id": "1", }, created_at=AnyStr(), @@ -260,7 +254,6 @@ def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "loop", "step": 0, - "writes": {"one": None}, "thread_id": "1", }, created_at=AnyStr(), @@ -282,7 +275,6 @@ def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "input", "step": -1, - "writes": {"input": 2}, "thread_id": "1", }, created_at=AnyStr(), @@ -348,7 +340,6 @@ def test_fork_always_re_runs_nodes( "parents": {}, "source": "loop", "step": 5, - "writes": {"add_one": 1}, "thread_id": "1", }, created_at=AnyStr(), @@ -370,7 +361,6 @@ def test_fork_always_re_runs_nodes( "parents": {}, "source": "loop", "step": 4, - "writes": {"add_one": 1}, "thread_id": "1", }, created_at=AnyStr(), @@ -392,7 +382,6 @@ def test_fork_always_re_runs_nodes( "parents": {}, "source": "loop", "step": 3, - "writes": {"add_one": 1}, "thread_id": "1", }, created_at=AnyStr(), @@ -414,7 +403,6 @@ def test_fork_always_re_runs_nodes( "parents": {}, "source": "loop", "step": 2, - "writes": {"add_one": 1}, "thread_id": "1", }, created_at=AnyStr(), @@ -436,7 +424,6 @@ def test_fork_always_re_runs_nodes( "parents": {}, "source": "loop", "step": 1, - "writes": {"add_one": 1}, "thread_id": "1", }, created_at=AnyStr(), @@ -458,7 +445,6 @@ def test_fork_always_re_runs_nodes( "parents": {}, "source": "loop", "step": 0, - "writes": None, "thread_id": "1", }, created_at=AnyStr(), @@ -480,7 +466,6 @@ def test_fork_always_re_runs_nodes( "parents": {}, "source": "input", "step": -1, - "writes": {"__start__": 1}, "thread_id": "1", }, created_at=AnyStr(), @@ -754,18 +739,6 @@ def test_conditional_graph( "parents": {}, "source": "loop", "step": 0, - "writes": { - "agent": { - "agent": { - "input": "what is weather in sf", - "agent_outcome": AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:query", - ), - } - }, - }, "thread_id": "1", }, parent_config=( @@ -817,16 +790,6 @@ def test_conditional_graph( "parents": {}, "source": "update", "step": 1, - "writes": { - "agent": { - "agent_outcome": AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:a different query", - ), - "input": "what is weather in sf", - }, - }, "thread_id": "1", }, parent_config=( @@ -938,25 +901,6 @@ def test_conditional_graph( "parents": {}, "source": "update", "step": 4, - "writes": { - "agent": { - "input": "what is weather in sf", - "intermediate_steps": [ - [ - AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:a different query", - ), - "result for query", - ] - ], - "agent_outcome": AgentFinish( - return_values={"answer": "a really nice answer"}, - log="finish:a really nice answer", - ), - } - }, "thread_id": "1", }, parent_config=( @@ -1010,18 +954,6 @@ def test_conditional_graph( "parents": {}, "source": "loop", "step": 0, - "writes": { - "agent": { - "agent": { - "input": "what is weather in sf", - "agent_outcome": AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:query", - ), - } - } - }, "thread_id": "2", }, parent_config=( @@ -1067,16 +999,6 @@ def test_conditional_graph( "parents": {}, "source": "update", "step": 1, - "writes": { - "agent": { - "agent_outcome": AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:a different query", - ), - "input": "what is weather in sf", - } - }, "thread_id": "2", }, parent_config=( @@ -1188,25 +1110,6 @@ def test_conditional_graph( "parents": {}, "source": "update", "step": 4, - "writes": { - "agent": { - "input": "what is weather in sf", - "intermediate_steps": [ - [ - AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:a different query", - ), - "result for query", - ] - ], - "agent_outcome": AgentFinish( - return_values={"answer": "a really nice answer"}, - log="finish:a really nice answer", - ), - } - }, "thread_id": "2", }, parent_config=( @@ -1260,18 +1163,6 @@ def test_conditional_graph( "parents": {}, "source": "loop", "step": 0, - "writes": { - "agent": { - "agent": { - "input": "what is weather in sf", - "agent_outcome": AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:query", - ), - } - } - }, "thread_id": "3", }, parent_config=( @@ -1620,15 +1511,6 @@ def test_conditional_state_graph( "parents": {}, "source": "loop", "step": 1, - "writes": { - "agent": { - "agent_outcome": AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:query", - ), - } - }, "thread_id": "1", }, parent_config=( @@ -1671,15 +1553,6 @@ def test_conditional_state_graph( "parents": {}, "source": "update", "step": 2, - "writes": { - "agent": { - "agent_outcome": AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:a different query", - ) - }, - }, "thread_id": "1", }, parent_config=( @@ -1756,14 +1629,6 @@ def test_conditional_state_graph( "parents": {}, "source": "update", "step": 5, - "writes": { - "agent": { - "agent_outcome": AgentFinish( - return_values={"answer": "a really nice answer"}, - log="finish:a really nice answer", - ) - } - }, "thread_id": "1", }, parent_config=( @@ -1816,15 +1681,6 @@ def test_conditional_state_graph( "parents": {}, "source": "loop", "step": 1, - "writes": { - "agent": { - "agent_outcome": AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:query", - ), - } - }, "thread_id": "2", }, parent_config=( @@ -1867,15 +1723,6 @@ def test_conditional_state_graph( "parents": {}, "source": "update", "step": 2, - "writes": { - "agent": { - "agent_outcome": AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:a different query", - ) - } - }, "thread_id": "2", }, parent_config=( @@ -1952,14 +1799,6 @@ def test_conditional_state_graph( "parents": {}, "source": "update", "step": 5, - "writes": { - "agent": { - "agent_outcome": AgentFinish( - return_values={"answer": "a really nice answer"}, - log="finish:a really nice answer", - ) - } - }, "thread_id": "2", }, parent_config=( @@ -2001,7 +1840,6 @@ def test_conditional_state_graph( "parents": {}, "source": "loop", "step": 0, - "writes": None, "thread_id": "3", }, parent_config=( @@ -2042,15 +1880,6 @@ def test_conditional_state_graph( "parents": {}, "source": "loop", "step": 1, - "writes": { - "agent": { - "agent_outcome": AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:query", - ), - } - }, "thread_id": "3", }, parent_config=( @@ -2107,20 +1936,6 @@ def test_conditional_state_graph( "parents": {}, "source": "loop", "step": 2, - "writes": { - "tools": { - "intermediate_steps": [ - [ - AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:query", - ), - "result for query", - ] - ], - } - }, "thread_id": "3", }, parent_config=( @@ -2184,15 +1999,6 @@ def test_conditional_state_graph( "parents": {}, "source": "loop", "step": 1, - "writes": { - "agent": { - "agent_outcome": AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:query", - ), - } - }, "thread_id": "4", }, parent_config=( @@ -2249,20 +2055,6 @@ def test_conditional_state_graph( "parents": {}, "source": "loop", "step": 2, - "writes": { - "tools": { - "intermediate_steps": [ - [ - AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:query", - ), - "result for query", - ] - ], - } - }, "thread_id": "4", }, parent_config=( @@ -2928,22 +2720,6 @@ def test_state_graph_packets( "parents": {}, "source": "loop", "step": 1, - "writes": { - "agent": { - "messages": AIMessage( - content="", - id="ai1", - tool_calls=[ - { - "name": "search_api", - "args": {"query": "query"}, - "id": "tool_call123", - "type": "tool_call", - } - ], - ) - } - }, "thread_id": "1", }, parent_config=( @@ -2991,22 +2767,6 @@ def test_state_graph_packets( "parents": {}, "source": "update", "step": 2, - "writes": { - "agent": { - "messages": AIMessage( - id="ai1", - content="", - tool_calls=[ - { - "id": "tool_call123", - "name": "search_api", - "args": {"query": "a different query"}, - }, - ], - ), - "something_extra": "hi there", - } - }, "thread_id": "1", }, parent_config=( @@ -3103,28 +2863,6 @@ def test_state_graph_packets( "parents": {}, "source": "loop", "step": 4, - "writes": { - "agent": { - "messages": AIMessage( - content="", - id="ai2", - tool_calls=[ - { - "name": "search_api", - "args": {"query": "another", "idx": 0}, - "id": "tool_call234", - "type": "tool_call", - }, - { - "name": "search_api", - "args": {"query": "a third one", "idx": 1}, - "id": "tool_call567", - "type": "tool_call", - }, - ], - ) - }, - }, "thread_id": "1", }, parent_config=( @@ -3179,12 +2917,6 @@ def test_state_graph_packets( "parents": {}, "source": "update", "step": 5, - "writes": { - "agent": { - "messages": AIMessage(content="answer", id="ai2"), - "something_extra": "hi there", - } - }, "thread_id": "1", }, parent_config=( @@ -3257,22 +2989,6 @@ def test_state_graph_packets( "parents": {}, "source": "loop", "step": 1, - "writes": { - "agent": { - "messages": AIMessage( - content="", - id="ai1", - tool_calls=[ - { - "name": "search_api", - "args": {"query": "query"}, - "id": "tool_call123", - "type": "tool_call", - } - ], - ) - } - }, "thread_id": "2", }, parent_config=( @@ -3314,22 +3030,6 @@ def test_state_graph_packets( "parents": {}, "source": "update", "step": 2, - "writes": { - "agent": { - "messages": AIMessage( - id="ai1", - content="", - tool_calls=[ - { - "id": "tool_call123", - "name": "search_api", - "args": {"query": "a different query"}, - }, - ], - ), - "something_extra": "hi there", - } - }, "thread_id": "2", }, parent_config=( @@ -3426,26 +3126,6 @@ def test_state_graph_packets( "parents": {}, "source": "loop", "step": 4, - "writes": { - "agent": { - "messages": AIMessage( - id="ai2", - content="", - tool_calls=[ - { - "id": "tool_call234", - "name": "search_api", - "args": {"query": "another", "idx": 0}, - }, - { - "id": "tool_call567", - "name": "search_api", - "args": {"query": "a third one", "idx": 1}, - }, - ], - ) - }, - }, "thread_id": "2", }, parent_config=( @@ -3500,12 +3180,6 @@ def test_state_graph_packets( "parents": {}, "source": "update", "step": 5, - "writes": { - "agent": { - "messages": AIMessage(content="answer", id="ai2"), - "something_extra": "hi there", - } - }, "thread_id": "2", }, parent_config=( @@ -3782,19 +3456,6 @@ def test_message_graph( "parents": {}, "source": "loop", "step": 1, - "writes": { - "agent": AIMessage( - content="", - tool_calls=[ - { - "id": "tool_call123", - "name": "search_api", - "args": {"query": "query"}, - } - ], - id="ai1", - ) - }, "thread_id": "1", }, parent_config=( @@ -3832,19 +3493,6 @@ def test_message_graph( "parents": {}, "source": "update", "step": 2, - "writes": { - "agent": AIMessage( - content="", - tool_calls=[ - { - "id": "tool_call123", - "name": "search_api", - "args": {"query": "a different query"}, - } - ], - id="ai1", - ) - }, "thread_id": "1", }, parent_config=( @@ -3924,19 +3572,6 @@ def test_message_graph( "parents": {}, "source": "loop", "step": 4, - "writes": { - "agent": AIMessage( - content="", - tool_calls=[ - { - "id": "tool_call456", - "name": "search_api", - "args": {"query": "another"}, - } - ], - id="ai2", - ) - }, "thread_id": "1", }, parent_config=( @@ -3986,7 +3621,6 @@ def test_message_graph( "parents": {}, "source": "update", "step": 5, - "writes": {"agent": AIMessage(content="answer", id="ai2")}, "thread_id": "1", }, parent_config=( @@ -4048,19 +3682,6 @@ def test_message_graph( "parents": {}, "source": "loop", "step": 1, - "writes": { - "agent": AIMessage( - content="", - tool_calls=[ - { - "id": "tool_call123", - "name": "search_api", - "args": {"query": "query"}, - } - ], - id="ai1", - ) - }, "thread_id": "2", }, parent_config=( @@ -4104,19 +3725,6 @@ def test_message_graph( "parents": {}, "source": "update", "step": 2, - "writes": { - "agent": AIMessage( - content="", - tool_calls=[ - { - "id": "tool_call123", - "name": "search_api", - "args": {"query": "a different query"}, - } - ], - id="ai1", - ) - }, "thread_id": "2", }, parent_config=( @@ -4196,19 +3804,6 @@ def test_message_graph( "parents": {}, "source": "loop", "step": 4, - "writes": { - "agent": AIMessage( - content="", - tool_calls=[ - { - "id": "tool_call456", - "name": "search_api", - "args": {"query": "another"}, - } - ], - id="ai2", - ) - }, "thread_id": "2", }, parent_config=( @@ -4259,7 +3854,6 @@ def test_message_graph( "parents": {}, "source": "update", "step": 5, - "writes": {"agent": AIMessage(content="answer", id="ai2")}, "thread_id": "2", }, parent_config=( @@ -4310,7 +3904,6 @@ def test_message_graph( "parents": {}, "source": "update", "step": 6, - "writes": {"tools": UnsortedSequence("ai", "an extra message")}, "thread_id": "2", }, parent_config=( @@ -4590,19 +4183,6 @@ def test_root_graph( "parents": {}, "source": "loop", "step": 1, - "writes": { - "agent": AIMessage( - content="", - tool_calls=[ - { - "id": "tool_call123", - "name": "search_api", - "args": {"query": "query"}, - } - ], - id="ai1", - ) - }, "thread_id": "1", }, parent_config=( @@ -4640,19 +4220,6 @@ def test_root_graph( "parents": {}, "source": "update", "step": 2, - "writes": { - "agent": AIMessage( - content="", - tool_calls=[ - { - "id": "tool_call123", - "name": "search_api", - "args": {"query": "a different query"}, - } - ], - id="ai1", - ) - }, "thread_id": "1", }, parent_config=( @@ -4733,19 +4300,6 @@ def test_root_graph( "parents": {}, "source": "loop", "step": 4, - "writes": { - "agent": AIMessage( - content="", - tool_calls=[ - { - "id": "tool_call456", - "name": "search_api", - "args": {"query": "another"}, - } - ], - id="ai2", - ) - }, "thread_id": "1", }, parent_config=( @@ -4796,7 +4350,6 @@ def test_root_graph( "parents": {}, "source": "update", "step": 5, - "writes": {"agent": AIMessage(content="answer", id="ai2")}, "thread_id": "1", }, parent_config=( @@ -4858,19 +4411,6 @@ def test_root_graph( "parents": {}, "source": "loop", "step": 1, - "writes": { - "agent": AIMessage( - content="", - tool_calls=[ - { - "id": "tool_call123", - "name": "search_api", - "args": {"query": "query"}, - } - ], - id="ai1", - ) - }, "thread_id": "2", }, parent_config=( @@ -4914,19 +4454,6 @@ def test_root_graph( "parents": {}, "source": "update", "step": 2, - "writes": { - "agent": AIMessage( - content="", - tool_calls=[ - { - "id": "tool_call123", - "name": "search_api", - "args": {"query": "a different query"}, - } - ], - id="ai1", - ) - }, "thread_id": "2", }, parent_config=( @@ -5007,19 +4534,6 @@ def test_root_graph( "parents": {}, "source": "loop", "step": 4, - "writes": { - "agent": AIMessage( - content="", - tool_calls=[ - { - "id": "tool_call456", - "name": "search_api", - "args": {"query": "another"}, - } - ], - id="ai2", - ) - }, "thread_id": "2", }, parent_config=( @@ -5069,7 +4583,6 @@ def test_root_graph( "parents": {}, "source": "update", "step": 5, - "writes": {"agent": AIMessage(content="answer", id="ai2")}, "thread_id": "2", }, parent_config=( @@ -5120,7 +4633,6 @@ def test_root_graph( "parents": {}, "source": "update", "step": 6, - "writes": {"tools": UnsortedSequence("ai", "an extra message")}, "thread_id": "2", }, parent_config=( @@ -5202,7 +4714,6 @@ def test_root_graph( "parents": {}, "source": "update", "step": 6, - "writes": {"tools": UnsortedSequence("ai", "an extra message")}, "thread_id": "2", }, parent_config=(list(new_app.checkpointer.list(config, limit=2))[-1].config), @@ -5559,14 +5070,12 @@ def test_dynamic_interrupt(sync_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 0, - "writes": None, "thread_id": "1", }, { "parents": {}, "source": "input", "step": -1, - "writes": {"__start__": {"my_key": "value ⛰️", "market": "DE"}}, "thread_id": "1", }, ] @@ -5600,7 +5109,6 @@ def test_dynamic_interrupt(sync_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 0, - "writes": None, "thread_id": "1", }, parent_config=(list(tool_two.checkpointer.list(thread1, limit=2))[-1].config), @@ -5631,7 +5139,6 @@ def test_dynamic_interrupt(sync_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "update", "step": 1, - "writes": {}, "thread_id": "1", }, parent_config=(list(tool_two.checkpointer.list(thread1, limit=2))[-1].config), @@ -5736,14 +5243,12 @@ def test_copy_checkpoint(sync_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 0, - "writes": None, "thread_id": "1", }, { "parents": {}, "source": "input", "step": -1, - "writes": {"__start__": {"my_key": "value ⛰️", "market": "DE"}}, "thread_id": "1", }, ] @@ -5783,7 +5288,6 @@ def test_copy_checkpoint(sync_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 0, - "writes": None, "thread_id": "1", }, parent_config=([*tool_two.checkpointer.list(thread1, limit=2)][-1].config), @@ -5830,7 +5334,6 @@ def test_copy_checkpoint(sync_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "fork", "step": 1, - "writes": None, "thread_id": "1", }, parent_config=( @@ -5947,14 +5450,12 @@ def test_dynamic_interrupt_subgraph(sync_checkpointer: BaseCheckpointSaver) -> N "parents": {}, "source": "loop", "step": 0, - "writes": None, "thread_id": "1", }, { "parents": {}, "source": "input", "step": -1, - "writes": {"__start__": {"my_key": "value ⛰️", "market": "DE"}}, "thread_id": "1", }, ] @@ -5994,7 +5495,6 @@ def test_dynamic_interrupt_subgraph(sync_checkpointer: BaseCheckpointSaver) -> N "parents": {}, "source": "loop", "step": 0, - "writes": None, "thread_id": "1", }, parent_config=( @@ -6031,7 +5531,6 @@ def test_dynamic_interrupt_subgraph(sync_checkpointer: BaseCheckpointSaver) -> N "parents": {}, "source": "update", "step": 1, - "writes": {}, "thread_id": "1", }, parent_config=( @@ -6105,7 +5604,6 @@ def test_start_branch_then( "parents": {}, "source": "loop", "step": 0, - "writes": None, "assistant_id": "a", "thread_id": "1", }, @@ -6113,7 +5611,6 @@ def test_start_branch_then( "parents": {}, "source": "input", "step": -1, - "writes": {"__start__": {"my_key": "value ⛰️", "market": "DE"}}, "assistant_id": "a", "thread_id": "1", }, @@ -6135,7 +5632,6 @@ def test_start_branch_then( "parents": {}, "source": "loop", "step": 0, - "writes": None, "assistant_id": "a", "thread_id": "1", }, @@ -6163,7 +5659,6 @@ def test_start_branch_then( "parents": {}, "source": "loop", "step": 1, - "writes": {"tool_two_slow": {"my_key": " slow"}}, "assistant_id": "a", "thread_id": "1", }, @@ -6193,7 +5688,6 @@ def test_start_branch_then( "parents": {}, "source": "loop", "step": 0, - "writes": None, "assistant_id": "a", "thread_id": "2", }, @@ -6221,7 +5715,6 @@ def test_start_branch_then( "parents": {}, "source": "loop", "step": 1, - "writes": {"tool_two_fast": {"my_key": " fast"}}, "assistant_id": "a", "thread_id": "2", }, @@ -6251,7 +5744,6 @@ def test_start_branch_then( "parents": {}, "source": "loop", "step": 0, - "writes": None, "assistant_id": "b", "thread_id": "3", }, @@ -6276,7 +5768,6 @@ def test_start_branch_then( "parents": {}, "source": "update", "step": 1, - "writes": {START: {"my_key": "key"}}, "assistant_id": "b", "thread_id": "3", }, @@ -6304,7 +5795,6 @@ def test_start_branch_then( "parents": {}, "source": "loop", "step": 2, - "writes": {"tool_two_fast": {"my_key": " fast"}}, "assistant_id": "b", "thread_id": "3", }, @@ -6380,7 +5870,6 @@ def test_branch_then( "parents": {}, "source": "input", "step": -1, - "writes": {"__start__": {"my_key": "value", "market": "DE"}}, "thread_id": "10", }, "parent_config": None, @@ -6419,7 +5908,6 @@ def test_branch_then( "parents": {}, "source": "loop", "step": 0, - "writes": None, "thread_id": "10", }, "parent_config": { @@ -6486,7 +5974,6 @@ def test_branch_then( "parents": {}, "source": "loop", "step": 1, - "writes": {"prepare": {"my_key": " prepared"}}, "thread_id": "10", }, "parent_config": { @@ -6558,7 +6045,6 @@ def test_branch_then( "parents": {}, "source": "loop", "step": 2, - "writes": {"tool_two_slow": {"my_key": " slow"}}, "thread_id": "10", }, "parent_config": { @@ -6628,7 +6114,6 @@ def test_branch_then( "parents": {}, "source": "loop", "step": 3, - "writes": {"finish": {"my_key": " finished"}}, "thread_id": "10", }, "parent_config": { @@ -6679,7 +6164,6 @@ def test_branch_then( "parents": {}, "source": "loop", "step": 1, - "writes": {"prepare": {"my_key": " prepared"}}, "thread_id": "1", }, parent_config=(list(tool_two.checkpointer.list(thread1, limit=2))[-1].config), @@ -6706,7 +6190,6 @@ def test_branch_then( "parents": {}, "source": "loop", "step": 3, - "writes": {"finish": {"my_key": " finished"}}, "thread_id": "1", }, parent_config=(list(tool_two.checkpointer.list(thread1, limit=2))[-1].config), @@ -6735,7 +6218,6 @@ def test_branch_then( "parents": {}, "source": "loop", "step": 1, - "writes": {"prepare": {"my_key": " prepared"}}, "thread_id": "2", }, parent_config=(list(tool_two.checkpointer.list(thread2, limit=2))[-1].config), @@ -6762,7 +6244,6 @@ def test_branch_then( "parents": {}, "source": "loop", "step": 3, - "writes": {"finish": {"my_key": " finished"}}, "thread_id": "2", }, parent_config=(list(tool_two.checkpointer.list(thread2, limit=2))[-1].config), @@ -6799,7 +6280,6 @@ def test_branch_then( "parents": {}, "source": "loop", "step": 2, - "writes": {"tool_two_slow": {"my_key": " slow"}}, "thread_id": "11", }, parent_config=(list(tool_two.checkpointer.list(thread1, limit=2))[-1].config), @@ -6827,7 +6307,6 @@ def test_branch_then( "parents": {}, "source": "update", "step": 3, - "writes": {"tool_two_slow": {"my_key": "er"}}, "thread_id": "11", }, parent_config=(list(tool_two.checkpointer.list(thread1, limit=2))[-1].config), @@ -6864,7 +6343,6 @@ def test_branch_then( "parents": {}, "source": "loop", "step": 1, - "writes": {"prepare": {"my_key": " prepared"}}, "thread_id": "21", }, parent_config=(list(tool_two.checkpointer.list(thread1, limit=2))[-1].config), @@ -6891,7 +6369,6 @@ def test_branch_then( "parents": {}, "source": "loop", "step": 3, - "writes": {"finish": {"my_key": " finished"}}, "thread_id": "21", }, parent_config=(list(tool_two.checkpointer.list(thread1, limit=2))[-1].config), @@ -6920,7 +6397,6 @@ def test_branch_then( "parents": {}, "source": "loop", "step": 1, - "writes": {"prepare": {"my_key": " prepared"}}, "thread_id": "22", }, parent_config=(list(tool_two.checkpointer.list(thread2, limit=2))[-1].config), @@ -6947,7 +6423,6 @@ def test_branch_then( "parents": {}, "source": "loop", "step": 3, - "writes": {"finish": {"my_key": " finished"}}, "thread_id": "22", }, parent_config=(list(tool_two.checkpointer.list(thread2, limit=2))[-1].config), @@ -6974,7 +6449,6 @@ def test_branch_then( "parents": {}, "source": "update", "step": 0, - "writes": {START: {"my_key": "key", "market": "DE"}}, "thread_id": "23", }, parent_config=None, @@ -7002,7 +6476,6 @@ def test_branch_then( "parents": {}, "source": "loop", "step": 1, - "writes": {"prepare": {"my_key": " prepared"}}, "thread_id": "23", }, parent_config=(list(tool_two.checkpointer.list(thread3, limit=2))[-1].config), @@ -7029,7 +6502,6 @@ def test_branch_then( "parents": {}, "source": "loop", "step": 3, - "writes": {"finish": {"my_key": " finished"}}, "thread_id": "23", }, parent_config=(list(tool_two.checkpointer.list(thread3, limit=2))[-1].config), @@ -7155,7 +6627,6 @@ def test_send_dedupe_on_resume( }, metadata={ "source": "loop", - "writes": {"3": ["3"]}, "thread_id": "1", "step": 4, "parents": {}, @@ -7192,7 +6663,6 @@ def test_send_dedupe_on_resume( }, metadata={ "source": "loop", - "writes": {"2": ["2|3"], "3": ["3"], "flaky": ["flaky|4"]}, "thread_id": "1", "step": 3, "parents": {}, @@ -7236,13 +6706,6 @@ def test_send_dedupe_on_resume( }, metadata={ "source": "loop", - "writes": { - "2": [ - ["2|Command(goto=Send(node='2', arg=3))"], - ["2|Command(goto=Send(node='flaky', arg=4))"], - ], - "3.1": ["3.1"], - }, "thread_id": "1", "step": 2, "parents": {}, @@ -7298,7 +6761,6 @@ def test_send_dedupe_on_resume( }, metadata={ "source": "loop", - "writes": {"1": ["1"]}, "thread_id": "1", "step": 1, "parents": {}, @@ -7354,7 +6816,6 @@ def test_send_dedupe_on_resume( }, metadata={ "source": "loop", - "writes": None, "thread_id": "1", "step": 0, "parents": {}, @@ -7392,7 +6853,6 @@ def test_send_dedupe_on_resume( }, metadata={ "source": "input", - "writes": {"__start__": ["0"]}, "thread_id": "1", "step": -1, "parents": {}, @@ -7495,7 +6955,6 @@ def test_nested_graph_state(sync_checkpointer: BaseCheckpointSaver) -> None: metadata={ "parents": {}, "source": "loop", - "writes": {"outer_1": {"my_key": "hi my value"}}, "step": 1, "thread_id": "1", }, @@ -7547,12 +7006,6 @@ def test_nested_graph_state(sync_checkpointer: BaseCheckpointSaver) -> None: "": AnyStr(), }, "source": "loop", - "writes": { - "inner_1": { - "my_key": "hi my value here", - "my_other_key": "hi my value", - } - }, "step": 1, "thread_id": "1", "langgraph_node": "inner", @@ -7589,7 +7042,6 @@ def test_nested_graph_state(sync_checkpointer: BaseCheckpointSaver) -> None: metadata={ "parents": {}, "source": "loop", - "writes": {"outer_1": {"my_key": "hi my value"}}, "step": 1, "thread_id": "1", }, @@ -7634,7 +7086,6 @@ def test_nested_graph_state(sync_checkpointer: BaseCheckpointSaver) -> None: metadata={ "parents": {}, "source": "loop", - "writes": {"outer_1": {"my_key": "hi my value"}}, "step": 1, "thread_id": "1", }, @@ -7671,7 +7122,6 @@ def test_nested_graph_state(sync_checkpointer: BaseCheckpointSaver) -> None: metadata={ "parents": {}, "source": "loop", - "writes": None, "step": 0, "thread_id": "1", }, @@ -7706,7 +7156,6 @@ def test_nested_graph_state(sync_checkpointer: BaseCheckpointSaver) -> None: metadata={ "parents": {}, "source": "input", - "writes": {"__start__": {"my_key": "my value"}}, "step": -1, "thread_id": "1", }, @@ -7736,12 +7185,6 @@ def test_nested_graph_state(sync_checkpointer: BaseCheckpointSaver) -> None: }, metadata={ "source": "loop", - "writes": { - "inner_1": { - "my_key": "hi my value here", - "my_other_key": "hi my value", - } - }, "step": 1, "parents": {"": AnyStr()}, "thread_id": "1", @@ -7782,7 +7225,6 @@ def test_nested_graph_state(sync_checkpointer: BaseCheckpointSaver) -> None: }, metadata={ "source": "loop", - "writes": None, "step": 0, "parents": {"": AnyStr()}, "thread_id": "1", @@ -7831,7 +7273,6 @@ def test_nested_graph_state(sync_checkpointer: BaseCheckpointSaver) -> None: }, metadata={ "source": "input", - "writes": {"__start__": {"my_key": "hi my value"}}, "step": -1, "parents": {"": AnyStr()}, "thread_id": "1", @@ -7874,9 +7315,6 @@ def test_nested_graph_state(sync_checkpointer: BaseCheckpointSaver) -> None: metadata={ "parents": {}, "source": "loop", - "writes": { - "outer_2": {"my_key": "hi my value here and there and back again"} - }, "step": 3, "thread_id": "1", }, @@ -7909,9 +7347,6 @@ def test_nested_graph_state(sync_checkpointer: BaseCheckpointSaver) -> None: metadata={ "parents": {}, "source": "loop", - "writes": { - "outer_2": {"my_key": "hi my value here and there and back again"} - }, "step": 3, "thread_id": "1", }, @@ -7948,7 +7383,6 @@ def test_nested_graph_state(sync_checkpointer: BaseCheckpointSaver) -> None: metadata={ "parents": {}, "source": "loop", - "writes": {"inner": {"my_key": "hi my value here and there"}}, "step": 2, "thread_id": "1", }, @@ -7986,7 +7420,6 @@ def test_nested_graph_state(sync_checkpointer: BaseCheckpointSaver) -> None: metadata={ "parents": {}, "source": "loop", - "writes": {"outer_1": {"my_key": "hi my value"}}, "step": 1, "thread_id": "1", }, @@ -8021,7 +7454,6 @@ def test_nested_graph_state(sync_checkpointer: BaseCheckpointSaver) -> None: metadata={ "parents": {}, "source": "loop", - "writes": None, "step": 0, "thread_id": "1", }, @@ -8056,7 +7488,6 @@ def test_nested_graph_state(sync_checkpointer: BaseCheckpointSaver) -> None: metadata={ "parents": {}, "source": "input", - "writes": {"__start__": {"my_key": "my value"}}, "step": -1, "thread_id": "1", }, @@ -8162,7 +7593,6 @@ def test_doubly_nested_graph_state( metadata={ "parents": {}, "source": "loop", - "writes": {"parent_1": {"my_key": "hi my value"}}, "step": 1, "thread_id": "1", }, @@ -8216,7 +7646,6 @@ def test_doubly_nested_graph_state( "langgraph_triggers": ["branch:to:child"], "parents": {"": AnyStr()}, "source": "loop", - "writes": None, "step": 0, "thread_id": "1", }, @@ -8271,7 +7700,6 @@ def test_doubly_nested_graph_state( } ), "source": "loop", - "writes": {"grandchild_1": {"my_key": "hi my value here"}}, "step": 1, "thread_id": "1", "langgraph_checkpoint_ns": AnyStr("child:"), @@ -8348,9 +7776,6 @@ def test_doubly_nested_graph_state( } ), "source": "loop", - "writes": { - "grandchild_1": {"my_key": "hi my value here"} - }, "step": 1, "thread_id": "1", "langgraph_checkpoint_ns": AnyStr("child:"), @@ -8401,7 +7826,6 @@ def test_doubly_nested_graph_state( metadata={ "parents": {"": AnyStr()}, "source": "loop", - "writes": None, "step": 0, "thread_id": "1", "langgraph_node": "child", @@ -8438,7 +7862,6 @@ def test_doubly_nested_graph_state( metadata={ "parents": {}, "source": "loop", - "writes": {"parent_1": {"my_key": "hi my value"}}, "step": 1, "thread_id": "1", }, @@ -8482,9 +7905,6 @@ def test_doubly_nested_graph_state( metadata={ "parents": {}, "source": "loop", - "writes": { - "parent_2": {"my_key": "hi my value here and there and back again"} - }, "step": 3, "thread_id": "1", }, @@ -8519,9 +7939,6 @@ def test_doubly_nested_graph_state( metadata={ "parents": {}, "source": "loop", - "writes": { - "parent_2": {"my_key": "hi my value here and there and back again"} - }, "step": 3, "thread_id": "1", }, @@ -8547,7 +7964,6 @@ def test_doubly_nested_graph_state( }, metadata={ "source": "loop", - "writes": {"child": {"my_key": "hi my value here and there"}}, "step": 2, "parents": {}, "thread_id": "1", @@ -8597,7 +8013,6 @@ def test_doubly_nested_graph_state( metadata={ "parents": {}, "source": "loop", - "writes": {"parent_1": {"my_key": "hi my value"}}, "step": 1, "thread_id": "1", }, @@ -8623,7 +8038,6 @@ def test_doubly_nested_graph_state( }, metadata={ "source": "loop", - "writes": None, "step": 0, "parents": {}, "thread_id": "1", @@ -8658,7 +8072,6 @@ def test_doubly_nested_graph_state( }, metadata={ "source": "input", - "writes": {"__start__": {"my_key": "my value"}}, "step": -1, "parents": {}, "thread_id": "1", @@ -8694,7 +8107,6 @@ def test_doubly_nested_graph_state( }, metadata={ "source": "loop", - "writes": {"child_1": {"my_key": "hi my value here and there"}}, "step": 1, "parents": {"": AnyStr()}, "thread_id": "1", @@ -8733,7 +8145,6 @@ def test_doubly_nested_graph_state( }, metadata={ "source": "loop", - "writes": None, "step": 0, "parents": {"": AnyStr()}, "thread_id": "1", @@ -8785,7 +8196,6 @@ def test_doubly_nested_graph_state( }, metadata={ "source": "input", - "writes": {"__start__": {"my_key": "hi my value"}}, "step": -1, "parents": {"": AnyStr()}, "thread_id": "1", @@ -8830,7 +8240,6 @@ def test_doubly_nested_graph_state( }, metadata={ "source": "loop", - "writes": {"grandchild_2": {"my_key": "hi my value here and there"}}, "step": 2, "parents": AnyDict( { @@ -8885,7 +8294,6 @@ def test_doubly_nested_graph_state( }, metadata={ "source": "loop", - "writes": {"grandchild_1": {"my_key": "hi my value here"}}, "step": 1, "parents": AnyDict( { @@ -8947,7 +8355,6 @@ def test_doubly_nested_graph_state( }, metadata={ "source": "loop", - "writes": None, "step": 0, "parents": AnyDict( { @@ -9009,7 +8416,6 @@ def test_doubly_nested_graph_state( }, metadata={ "source": "input", - "writes": {"__start__": {"my_key": "hi my value"}}, "step": -1, "parents": AnyDict( { @@ -9267,22 +8673,6 @@ def test_send_react_interrupt( metadata={ "step": 1, "source": "loop", - "writes": { - "agent": { - "messages": AIMessage( - content="", - id="ai1", - tool_calls=[ - { - "name": "foo", - "args": {"hi": [1, 2, 3]}, - "id": "", - "type": "tool_call", - } - ], - ) - } - }, "parents": {}, "thread_id": "2", }, @@ -9337,14 +8727,6 @@ def test_send_react_interrupt( metadata={ "step": 2, "source": "update", - "writes": { - "agent": { - "messages": _AnyIdAIMessage( - content="Bye now", - tool_calls=[], - ) - } - }, "parents": {}, "thread_id": "2", }, @@ -9423,24 +8805,6 @@ def test_send_react_interrupt( metadata={ "step": 1, "source": "loop", - "writes": { - "agent": { - "messages": AIMessage( - content="", - additional_kwargs={}, - response_metadata={}, - id="ai1", - tool_calls=[ - { - "name": "foo", - "args": {"hi": [1, 2, 3]}, - "id": "", - "type": "tool_call", - } - ], - ) - } - }, "parents": {}, "thread_id": "3", }, @@ -9516,21 +8880,6 @@ def test_send_react_interrupt( metadata={ "step": 2, "source": "update", - "writes": { - "agent": { - "messages": _AnyIdAIMessage( - content="", - tool_calls=[ - { - "name": "foo", - "args": {"hi": [4, 5, 6]}, - "id": "tool1", - "type": "tool_call", - } - ], - ) - } - }, "parents": {}, "thread_id": "3", }, @@ -9730,22 +9079,6 @@ def test_send_react_interrupt_control( metadata={ "step": 1, "source": "loop", - "writes": { - "agent": { - "messages": AIMessage( - content="", - id="ai1", - tool_calls=[ - { - "name": "foo", - "args": {"hi": [1, 2, 3]}, - "id": "", - "type": "tool_call", - } - ], - ) - } - }, "parents": {}, "thread_id": "2", }, @@ -9800,14 +9133,6 @@ def test_send_react_interrupt_control( metadata={ "step": 2, "source": "update", - "writes": { - "agent": { - "messages": _AnyIdAIMessage( - content="Bye now", - tool_calls=[], - ) - } - }, "parents": {}, "thread_id": "2", }, @@ -9991,7 +9316,6 @@ def test_weather_subgraph( }, metadata={ "source": "loop", - "writes": {"router_node": {"route": "weather"}}, "step": 1, "parents": {}, "thread_id": "1", @@ -10082,7 +9406,6 @@ def test_weather_subgraph( }, metadata={ "source": "loop", - "writes": {"router_node": {"route": "weather"}}, "step": 1, "parents": {}, "thread_id": "14", @@ -10125,7 +9448,6 @@ def test_weather_subgraph( }, metadata={ "source": "loop", - "writes": {"model_node": {"city": "San Francisco"}}, "step": 1, "parents": {"": AnyStr()}, "thread_id": "14", @@ -10185,7 +9507,6 @@ def test_weather_subgraph( }, metadata={ "source": "loop", - "writes": {"router_node": {"route": "weather"}}, "step": 1, "parents": {}, "thread_id": "14", @@ -10230,11 +9551,6 @@ def test_weather_subgraph( metadata={ "step": 2, "source": "update", - "writes": { - "weather_node": { - "messages": [{"role": "assistant", "content": "rainy"}] - } - }, "parents": {"": AnyStr()}, "thread_id": "14", "checkpoint_id": AnyStr(), diff --git a/libs/langgraph/tests/test_large_cases_async.py b/libs/langgraph/tests/test_large_cases_async.py index 1de6a2442..b73483f0a 100644 --- a/libs/langgraph/tests/test_large_cases_async.py +++ b/libs/langgraph/tests/test_large_cases_async.py @@ -120,7 +120,6 @@ async def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "loop", "step": 6, - "writes": {"two": 5}, "thread_id": "1", }, created_at=AnyStr(), @@ -142,7 +141,6 @@ async def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "loop", "step": 5, - "writes": {"one": None}, "thread_id": "1", }, created_at=AnyStr(), @@ -164,7 +162,6 @@ async def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "input", "step": 4, - "writes": {"input": 3}, "thread_id": "1", }, created_at=AnyStr(), @@ -186,7 +183,6 @@ async def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "loop", "step": 3, - "writes": {"one": None}, "thread_id": "1", }, created_at=AnyStr(), @@ -208,7 +204,6 @@ async def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "input", "step": 2, - "writes": {"input": 20}, "thread_id": "1", }, created_at=AnyStr(), @@ -230,7 +225,6 @@ async def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "loop", "step": 1, - "writes": {"two": 4}, "thread_id": "1", }, created_at=AnyStr(), @@ -252,7 +246,6 @@ async def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "loop", "step": 0, - "writes": {"one": None}, "thread_id": "1", }, created_at=AnyStr(), @@ -274,7 +267,6 @@ async def test_invoke_two_processes_in_out_interrupt( "parents": {}, "source": "input", "step": -1, - "writes": {"input": 2}, "thread_id": "1", }, created_at=AnyStr(), @@ -348,7 +340,6 @@ async def test_fork_always_re_runs_nodes( "parents": {}, "source": "loop", "step": 5, - "writes": {"add_one": 1}, "thread_id": "1", }, created_at=AnyStr(), @@ -370,7 +361,6 @@ async def test_fork_always_re_runs_nodes( "parents": {}, "source": "loop", "step": 4, - "writes": {"add_one": 1}, "thread_id": "1", }, created_at=AnyStr(), @@ -392,7 +382,6 @@ async def test_fork_always_re_runs_nodes( "parents": {}, "source": "loop", "step": 3, - "writes": {"add_one": 1}, "thread_id": "1", }, created_at=AnyStr(), @@ -414,7 +403,6 @@ async def test_fork_always_re_runs_nodes( "parents": {}, "source": "loop", "step": 2, - "writes": {"add_one": 1}, "thread_id": "1", }, created_at=AnyStr(), @@ -436,7 +424,6 @@ async def test_fork_always_re_runs_nodes( "parents": {}, "source": "loop", "step": 1, - "writes": {"add_one": 1}, "thread_id": "1", }, created_at=AnyStr(), @@ -458,7 +445,6 @@ async def test_fork_always_re_runs_nodes( "parents": {}, "source": "loop", "step": 0, - "writes": None, "thread_id": "1", }, created_at=AnyStr(), @@ -480,7 +466,6 @@ async def test_fork_always_re_runs_nodes( "parents": {}, "source": "input", "step": -1, - "writes": {"__start__": 1}, "thread_id": "1", }, created_at=AnyStr(), @@ -816,18 +801,6 @@ async def test_conditional_graph(async_checkpointer: BaseCheckpointSaver) -> Non "parents": {}, "source": "loop", "step": 0, - "writes": { - "agent": { - "agent": { - "input": "what is weather in sf", - "agent_outcome": AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:query", - ), - } - } - }, "thread_id": "1", }, parent_config=[ @@ -873,16 +846,6 @@ async def test_conditional_graph(async_checkpointer: BaseCheckpointSaver) -> Non "parents": {}, "source": "update", "step": 1, - "writes": { - "agent": { - "agent_outcome": AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:a different query", - ), - "input": "what is weather in sf", - } - }, "thread_id": "1", }, parent_config=[ @@ -994,25 +957,6 @@ async def test_conditional_graph(async_checkpointer: BaseCheckpointSaver) -> Non "parents": {}, "source": "update", "step": 4, - "writes": { - "agent": { - "input": "what is weather in sf", - "intermediate_steps": [ - [ - AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:a different query", - ), - "result for query", - ] - ], - "agent_outcome": AgentFinish( - return_values={"answer": "a really nice answer"}, - log="finish:a really nice answer", - ), - } - }, "thread_id": "1", }, parent_config=[ @@ -1073,18 +1017,6 @@ async def test_conditional_graph(async_checkpointer: BaseCheckpointSaver) -> Non "parents": {}, "source": "loop", "step": 0, - "writes": { - "agent": { - "agent": { - "input": "what is weather in sf", - "agent_outcome": AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:query", - ), - } - } - }, "thread_id": "2", }, parent_config=[ @@ -1130,16 +1062,6 @@ async def test_conditional_graph(async_checkpointer: BaseCheckpointSaver) -> Non "parents": {}, "source": "update", "step": 1, - "writes": { - "agent": { - "agent_outcome": AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:a different query", - ), - "input": "what is weather in sf", - } - }, "thread_id": "2", }, parent_config=[ @@ -1251,25 +1173,6 @@ async def test_conditional_graph(async_checkpointer: BaseCheckpointSaver) -> Non "parents": {}, "source": "update", "step": 4, - "writes": { - "agent": { - "input": "what is weather in sf", - "intermediate_steps": [ - [ - AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:a different query", - ), - "result for query", - ] - ], - "agent_outcome": AgentFinish( - return_values={"answer": "a really nice answer"}, - log="finish:a really nice answer", - ), - } - }, "thread_id": "2", }, parent_config=[ @@ -1330,18 +1233,6 @@ async def test_conditional_graph(async_checkpointer: BaseCheckpointSaver) -> Non "parents": {}, "source": "loop", "step": 0, - "writes": { - "agent": { - "agent": { - "input": "what is weather in sf", - "agent_outcome": AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:query", - ), - } - } - }, "thread_id": "3", }, parent_config=[ @@ -1714,15 +1605,6 @@ async def test_conditional_graph_state(async_checkpointer: BaseCheckpointSaver) "parents": {}, "source": "loop", "step": 1, - "writes": { - "agent": { - "agent_outcome": AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:query", - ), - } - }, "thread_id": "1", }, parent_config=[ @@ -1765,15 +1647,6 @@ async def test_conditional_graph_state(async_checkpointer: BaseCheckpointSaver) "parents": {}, "source": "update", "step": 2, - "writes": { - "agent": { - "agent_outcome": AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:a different query", - ) - } - }, "thread_id": "1", }, parent_config=( @@ -1852,14 +1725,6 @@ async def test_conditional_graph_state(async_checkpointer: BaseCheckpointSaver) "parents": {}, "source": "update", "step": 5, - "writes": { - "agent": { - "agent_outcome": AgentFinish( - return_values={"answer": "a really nice answer"}, - log="finish:a really nice answer", - ) - } - }, "thread_id": "1", }, parent_config=( @@ -1918,15 +1783,6 @@ async def test_conditional_graph_state(async_checkpointer: BaseCheckpointSaver) "parents": {}, "source": "loop", "step": 1, - "writes": { - "agent": { - "agent_outcome": AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:query", - ), - } - }, "thread_id": "2", }, parent_config=( @@ -1971,15 +1827,6 @@ async def test_conditional_graph_state(async_checkpointer: BaseCheckpointSaver) "parents": {}, "source": "update", "step": 2, - "writes": { - "agent": { - "agent_outcome": AgentAction( - tool="search_api", - tool_input="query", - log="tool:search_api:a different query", - ) - } - }, "thread_id": "2", }, parent_config=[ @@ -2056,14 +1903,6 @@ async def test_conditional_graph_state(async_checkpointer: BaseCheckpointSaver) "parents": {}, "source": "update", "step": 5, - "writes": { - "agent": { - "agent_outcome": AgentFinish( - return_values={"answer": "a really nice answer"}, - log="finish:a really nice answer", - ) - } - }, "thread_id": "2", }, parent_config=[ @@ -2683,22 +2522,6 @@ async def test_state_graph_packets(async_checkpointer: BaseCheckpointSaver) -> N "parents": {}, "source": "loop", "step": 1, - "writes": { - "agent": { - "messages": AIMessage( - content="", - id="ai1", - tool_calls=[ - { - "name": "search_api", - "args": {"query": "query"}, - "id": "tool_call123", - "type": "tool_call", - } - ], - ) - } - }, "thread_id": "1", }, parent_config=( @@ -2741,21 +2564,6 @@ async def test_state_graph_packets(async_checkpointer: BaseCheckpointSaver) -> N "parents": {}, "source": "update", "step": 2, - "writes": { - "agent": { - "messages": AIMessage( - id="ai1", - content="", - tool_calls=[ - { - "id": "tool_call123", - "name": "search_api", - "args": {"query": "a different query"}, - }, - ], - ) - } - }, "thread_id": "1", }, parent_config=( @@ -2849,26 +2657,6 @@ async def test_state_graph_packets(async_checkpointer: BaseCheckpointSaver) -> N "parents": {}, "source": "loop", "step": 4, - "writes": { - "agent": { - "messages": AIMessage( - id="ai2", - content="", - tool_calls=[ - { - "id": "tool_call234", - "name": "search_api", - "args": {"query": "another", "idx": 0}, - }, - { - "id": "tool_call567", - "name": "search_api", - "args": {"query": "a third one", "idx": 1}, - }, - ], - ), - }, - }, "thread_id": "1", }, parent_config=( @@ -2917,11 +2705,6 @@ async def test_state_graph_packets(async_checkpointer: BaseCheckpointSaver) -> N "parents": {}, "source": "update", "step": 5, - "writes": { - "agent": { - "messages": AIMessage(content="answer", id="ai2"), - } - }, "thread_id": "1", }, parent_config=( @@ -2990,24 +2773,6 @@ async def test_state_graph_packets(async_checkpointer: BaseCheckpointSaver) -> N "parents": {}, "source": "loop", "step": 1, - "writes": { - "agent": { - "messages": AIMessage( - content="", - additional_kwargs={}, - response_metadata={}, - id="ai1", - tool_calls=[ - { - "name": "search_api", - "args": {"query": "query"}, - "id": "tool_call123", - "type": "tool_call", - } - ], - ) - } - }, "thread_id": "2", }, parent_config=( @@ -3050,21 +2815,6 @@ async def test_state_graph_packets(async_checkpointer: BaseCheckpointSaver) -> N "parents": {}, "source": "update", "step": 2, - "writes": { - "agent": { - "messages": AIMessage( - id="ai1", - content="", - tool_calls=[ - { - "id": "tool_call123", - "name": "search_api", - "args": {"query": "a different query"}, - }, - ], - ) - } - }, "thread_id": "2", }, parent_config=( @@ -3158,26 +2908,6 @@ async def test_state_graph_packets(async_checkpointer: BaseCheckpointSaver) -> N "parents": {}, "source": "loop", "step": 4, - "writes": { - "agent": { - "messages": AIMessage( - id="ai2", - content="", - tool_calls=[ - { - "id": "tool_call234", - "name": "search_api", - "args": {"query": "another", "idx": 0}, - }, - { - "id": "tool_call567", - "name": "search_api", - "args": {"query": "a third one", "idx": 1}, - }, - ], - ), - }, - }, "thread_id": "2", }, parent_config=( @@ -3226,11 +2956,6 @@ async def test_state_graph_packets(async_checkpointer: BaseCheckpointSaver) -> N "parents": {}, "source": "update", "step": 5, - "writes": { - "agent": { - "messages": AIMessage(content="answer", id="ai2"), - } - }, "thread_id": "2", }, parent_config=( @@ -3480,19 +3205,6 @@ async def test_message_graph(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 1, - "writes": { - "agent": AIMessage( - content="", - tool_calls=[ - { - "id": "tool_call123", - "name": "search_api", - "args": {"query": "query"}, - } - ], - id="ai1", - ) - }, "thread_id": "1", }, parent_config=( @@ -3533,19 +3245,6 @@ async def test_message_graph(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "update", "step": 2, - "writes": { - "agent": AIMessage( - content="", - tool_calls=[ - { - "id": "tool_call123", - "name": "search_api", - "args": {"query": "a different query"}, - } - ], - id="ai1", - ) - }, "thread_id": "1", }, parent_config=( @@ -3622,19 +3321,6 @@ async def test_message_graph(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 4, - "writes": { - "agent": AIMessage( - content="", - tool_calls=[ - { - "id": "tool_call456", - "name": "search_api", - "args": {"query": "another"}, - } - ], - id="ai2", - ) - }, "thread_id": "1", }, parent_config=( @@ -3681,7 +3367,6 @@ async def test_message_graph(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "update", "step": 5, - "writes": {"agent": AIMessage(content="answer", id="ai2")}, "thread_id": "1", }, parent_config=( @@ -3970,7 +3655,6 @@ async def test_start_branch_then( "parents": {}, "source": "loop", "step": 0, - "writes": None, "assistant_id": "a", "thread_id": "1", }, @@ -3978,7 +3662,6 @@ async def test_start_branch_then( "parents": {}, "source": "input", "step": -1, - "writes": {"__start__": {"my_key": "value", "market": "DE"}}, "assistant_id": "a", "thread_id": "1", }, @@ -4000,7 +3683,6 @@ async def test_start_branch_then( "parents": {}, "source": "loop", "step": 0, - "writes": None, "assistant_id": "a", "thread_id": "1", }, @@ -4030,7 +3712,6 @@ async def test_start_branch_then( "parents": {}, "source": "loop", "step": 1, - "writes": {"tool_two_slow": {"my_key": " slow"}}, "assistant_id": "a", "thread_id": "1", }, @@ -4062,7 +3743,6 @@ async def test_start_branch_then( "parents": {}, "source": "loop", "step": 0, - "writes": None, "assistant_id": "a", "thread_id": "2", }, @@ -4092,7 +3772,6 @@ async def test_start_branch_then( "parents": {}, "source": "loop", "step": 1, - "writes": {"tool_two_fast": {"my_key": " fast"}}, "assistant_id": "a", "thread_id": "2", }, @@ -4124,7 +3803,6 @@ async def test_start_branch_then( "parents": {}, "source": "loop", "step": 0, - "writes": None, "assistant_id": "b", "thread_id": "3", }, @@ -4151,7 +3829,6 @@ async def test_start_branch_then( "parents": {}, "source": "update", "step": 1, - "writes": {START: {"my_key": "key"}}, "assistant_id": "b", "thread_id": "3", }, @@ -4181,7 +3858,6 @@ async def test_start_branch_then( "parents": {}, "source": "loop", "step": 2, - "writes": {"tool_two_fast": {"my_key": " fast"}}, "assistant_id": "b", "thread_id": "3", }, @@ -4250,7 +3926,6 @@ async def test_branch_then(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "input", "step": -1, - "writes": {"__start__": {"my_key": "value", "market": "DE"}}, "thread_id": "10", }, "parent_config": None, @@ -4289,7 +3964,6 @@ async def test_branch_then(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 0, - "writes": None, "thread_id": "10", }, "parent_config": { @@ -4361,7 +4035,6 @@ async def test_branch_then(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 1, - "writes": {"prepare": {"my_key": " prepared"}}, "thread_id": "10", }, "parent_config": { @@ -4433,7 +4106,6 @@ async def test_branch_then(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 2, - "writes": {"tool_two_slow": {"my_key": " slow"}}, "thread_id": "10", }, "parent_config": { @@ -4508,7 +4180,6 @@ async def test_branch_then(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 3, - "writes": {"finish": {"my_key": " finished"}}, "thread_id": "10", }, "parent_config": { @@ -4566,7 +4237,6 @@ async def test_branch_then(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "input", "step": -1, - "writes": {"__start__": {"my_key": "value", "market": "DE"}}, "thread_id": "11", }, "parent_config": None, @@ -4605,7 +4275,6 @@ async def test_branch_then(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 0, - "writes": None, "thread_id": "11", }, "parent_config": { @@ -4677,7 +4346,6 @@ async def test_branch_then(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 1, - "writes": {"prepare": {"my_key": " prepared"}}, "thread_id": "11", }, "parent_config": { @@ -4719,7 +4387,6 @@ async def test_branch_then(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 1, - "writes": {"prepare": {"my_key": " prepared"}}, "thread_id": "11", }, parent_config=( @@ -4748,7 +4415,6 @@ async def test_branch_then(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 3, - "writes": {"finish": {"my_key": " finished"}}, "thread_id": "11", }, parent_config=( @@ -4779,7 +4445,6 @@ async def test_branch_then(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 1, - "writes": {"prepare": {"my_key": " prepared"}}, "thread_id": "12", }, parent_config=( @@ -4808,7 +4473,6 @@ async def test_branch_then(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 3, - "writes": {"finish": {"my_key": " finished"}}, "thread_id": "12", }, parent_config=( @@ -4847,7 +4511,6 @@ async def test_branch_then(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 1, - "writes": {"prepare": {"my_key": " prepared"}}, "thread_id": "21", }, parent_config=( @@ -4876,7 +4539,6 @@ async def test_branch_then(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 3, - "writes": {"finish": {"my_key": " finished"}}, "thread_id": "21", }, parent_config=( @@ -4907,7 +4569,6 @@ async def test_branch_then(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 1, - "writes": {"prepare": {"my_key": " prepared"}}, "thread_id": "22", }, parent_config=( @@ -4936,7 +4597,6 @@ async def test_branch_then(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 3, - "writes": {"finish": {"my_key": " finished"}}, "thread_id": "22", }, parent_config=( @@ -4959,7 +4619,6 @@ async def test_branch_then(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "update", "step": 0, - "writes": {START: {"my_key": "key", "market": "DE"}}, "thread_id": "23", }, parent_config=None, @@ -4987,7 +4646,6 @@ async def test_branch_then(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 1, - "writes": {"prepare": {"my_key": " prepared"}}, "thread_id": "23", }, parent_config=(uconfig), @@ -5014,7 +4672,6 @@ async def test_branch_then(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 3, - "writes": {"finish": {"my_key": " finished"}}, "thread_id": "23", }, parent_config=( @@ -5097,7 +4754,6 @@ async def test_nested_graph_state(async_checkpointer: BaseCheckpointSaver) -> No metadata={ "parents": {}, "source": "loop", - "writes": {"outer_1": {"my_key": "hi my value"}}, "step": 1, "thread_id": "1", }, @@ -5149,12 +4805,6 @@ async def test_nested_graph_state(async_checkpointer: BaseCheckpointSaver) -> No "": AnyStr(), }, "source": "loop", - "writes": { - "inner_1": { - "my_key": "hi my value here", - "my_other_key": "hi my value", - } - }, "step": 1, "thread_id": "1", "langgraph_node": "inner", @@ -5189,7 +4839,6 @@ async def test_nested_graph_state(async_checkpointer: BaseCheckpointSaver) -> No metadata={ "parents": {}, "source": "loop", - "writes": {"outer_1": {"my_key": "hi my value"}}, "step": 1, "thread_id": "1", }, @@ -5234,7 +4883,6 @@ async def test_nested_graph_state(async_checkpointer: BaseCheckpointSaver) -> No metadata={ "parents": {}, "source": "loop", - "writes": {"outer_1": {"my_key": "hi my value"}}, "step": 1, "thread_id": "1", }, @@ -5271,7 +4919,6 @@ async def test_nested_graph_state(async_checkpointer: BaseCheckpointSaver) -> No metadata={ "parents": {}, "source": "loop", - "writes": None, "step": 0, "thread_id": "1", }, @@ -5306,7 +4953,6 @@ async def test_nested_graph_state(async_checkpointer: BaseCheckpointSaver) -> No metadata={ "parents": {}, "source": "input", - "writes": {"__start__": {"my_key": "my value"}}, "step": -1, "thread_id": "1", }, @@ -5336,12 +4982,6 @@ async def test_nested_graph_state(async_checkpointer: BaseCheckpointSaver) -> No }, metadata={ "source": "loop", - "writes": { - "inner_1": { - "my_key": "hi my value here", - "my_other_key": "hi my value", - } - }, "step": 1, "parents": {"": AnyStr()}, "thread_id": "1", @@ -5382,7 +5022,6 @@ async def test_nested_graph_state(async_checkpointer: BaseCheckpointSaver) -> No }, metadata={ "source": "loop", - "writes": None, "step": 0, "parents": {"": AnyStr()}, "thread_id": "1", @@ -5431,7 +5070,6 @@ async def test_nested_graph_state(async_checkpointer: BaseCheckpointSaver) -> No }, metadata={ "source": "input", - "writes": {"__start__": {"my_key": "hi my value"}}, "step": -1, "parents": {"": AnyStr()}, "thread_id": "1", @@ -5474,9 +5112,6 @@ async def test_nested_graph_state(async_checkpointer: BaseCheckpointSaver) -> No metadata={ "parents": {}, "source": "loop", - "writes": { - "outer_2": {"my_key": "hi my value here and there and back again"} - }, "step": 3, "thread_id": "1", }, @@ -5509,9 +5144,6 @@ async def test_nested_graph_state(async_checkpointer: BaseCheckpointSaver) -> No metadata={ "parents": {}, "source": "loop", - "writes": { - "outer_2": {"my_key": "hi my value here and there and back again"} - }, "step": 3, "thread_id": "1", }, @@ -5548,7 +5180,6 @@ async def test_nested_graph_state(async_checkpointer: BaseCheckpointSaver) -> No metadata={ "parents": {}, "source": "loop", - "writes": {"inner": {"my_key": "hi my value here and there"}}, "step": 2, "thread_id": "1", }, @@ -5589,7 +5220,6 @@ async def test_nested_graph_state(async_checkpointer: BaseCheckpointSaver) -> No metadata={ "parents": {}, "source": "loop", - "writes": {"outer_1": {"my_key": "hi my value"}}, "step": 1, "thread_id": "1", }, @@ -5624,7 +5254,6 @@ async def test_nested_graph_state(async_checkpointer: BaseCheckpointSaver) -> No metadata={ "parents": {}, "source": "loop", - "writes": None, "step": 0, "thread_id": "1", }, @@ -5659,7 +5288,6 @@ async def test_nested_graph_state(async_checkpointer: BaseCheckpointSaver) -> No metadata={ "parents": {}, "source": "input", - "writes": {"__start__": {"my_key": "my value"}}, "step": -1, "thread_id": "1", }, @@ -5767,7 +5395,6 @@ async def test_doubly_nested_graph_state( metadata={ "parents": {}, "source": "loop", - "writes": {"parent_1": {"my_key": "hi my value"}}, "step": 1, "thread_id": "1", }, @@ -5821,7 +5448,6 @@ async def test_doubly_nested_graph_state( "langgraph_triggers": ["branch:to:child"], "parents": {"": AnyStr()}, "source": "loop", - "writes": None, "step": 0, "thread_id": "1", }, @@ -5876,7 +5502,6 @@ async def test_doubly_nested_graph_state( } ), "source": "loop", - "writes": {"grandchild_1": {"my_key": "hi my value here"}}, "step": 1, "thread_id": "1", "langgraph_checkpoint_ns": AnyStr("child:"), @@ -5955,9 +5580,6 @@ async def test_doubly_nested_graph_state( } ), "source": "loop", - "writes": { - "grandchild_1": {"my_key": "hi my value here"} - }, "step": 1, "thread_id": "1", "langgraph_checkpoint_ns": AnyStr("child:"), @@ -6008,7 +5630,6 @@ async def test_doubly_nested_graph_state( metadata={ "parents": {"": AnyStr()}, "source": "loop", - "writes": None, "step": 0, "thread_id": "1", "langgraph_node": "child", @@ -6047,7 +5668,6 @@ async def test_doubly_nested_graph_state( metadata={ "parents": {}, "source": "loop", - "writes": {"parent_1": {"my_key": "hi my value"}}, "step": 1, "thread_id": "1", }, @@ -6094,9 +5714,6 @@ async def test_doubly_nested_graph_state( metadata={ "parents": {}, "source": "loop", - "writes": { - "parent_2": {"my_key": "hi my value here and there and back again"} - }, "step": 3, "thread_id": "1", }, @@ -6133,11 +5750,6 @@ async def test_doubly_nested_graph_state( metadata={ "parents": {}, "source": "loop", - "writes": { - "parent_2": { - "my_key": "hi my value here and there and back again" - } - }, "step": 3, "thread_id": "1", }, @@ -6164,7 +5776,6 @@ async def test_doubly_nested_graph_state( metadata={ "parents": {}, "source": "loop", - "writes": {"child": {"my_key": "hi my value here and there"}}, "step": 2, "thread_id": "1", }, @@ -6207,7 +5818,6 @@ async def test_doubly_nested_graph_state( metadata={ "parents": {}, "source": "loop", - "writes": {"parent_1": {"my_key": "hi my value"}}, "step": 1, "thread_id": "1", }, @@ -6234,7 +5844,6 @@ async def test_doubly_nested_graph_state( metadata={ "parents": {}, "source": "loop", - "writes": None, "step": 0, "thread_id": "1", }, @@ -6264,7 +5873,6 @@ async def test_doubly_nested_graph_state( metadata={ "parents": {}, "source": "input", - "writes": {"my_key": "my value"}, "step": -1, "thread_id": "1", }, @@ -6297,7 +5905,6 @@ async def test_doubly_nested_graph_state( }, metadata={ "source": "loop", - "writes": {"child_1": {"my_key": "hi my value here and there"}}, "step": 1, "parents": {"": AnyStr()}, "thread_id": "1", @@ -6336,7 +5943,6 @@ async def test_doubly_nested_graph_state( }, metadata={ "source": "loop", - "writes": None, "step": 0, "parents": {"": AnyStr()}, "thread_id": "1", @@ -6388,7 +5994,6 @@ async def test_doubly_nested_graph_state( }, metadata={ "source": "input", - "writes": {"__start__": {"my_key": "hi my value"}}, "step": -1, "parents": {"": AnyStr()}, "thread_id": "1", @@ -6435,7 +6040,6 @@ async def test_doubly_nested_graph_state( }, metadata={ "source": "loop", - "writes": {"grandchild_2": {"my_key": "hi my value here and there"}}, "step": 2, "parents": AnyDict( { @@ -6492,7 +6096,6 @@ async def test_doubly_nested_graph_state( }, metadata={ "source": "loop", - "writes": {"grandchild_1": {"my_key": "hi my value here"}}, "step": 1, "parents": AnyDict( { @@ -6556,7 +6159,6 @@ async def test_doubly_nested_graph_state( }, metadata={ "source": "loop", - "writes": None, "step": 0, "parents": AnyDict( { @@ -6620,7 +6222,6 @@ async def test_doubly_nested_graph_state( }, metadata={ "source": "input", - "writes": {"__start__": {"my_key": "hi my value"}}, "step": -1, "parents": AnyDict( { @@ -6888,7 +6489,6 @@ async def test_weather_subgraph( }, metadata={ "source": "loop", - "writes": {"router_node": {"route": "weather"}}, "step": 1, "parents": {}, "thread_id": "1", @@ -6981,7 +6581,6 @@ async def test_weather_subgraph( }, metadata={ "source": "loop", - "writes": {"router_node": {"route": "weather"}}, "step": 1, "parents": {}, "thread_id": "14", @@ -7024,7 +6623,6 @@ async def test_weather_subgraph( }, metadata={ "source": "loop", - "writes": {"model_node": {"city": "San Francisco"}}, "step": 1, "parents": {"": AnyStr()}, "thread_id": "14", @@ -7084,7 +6682,6 @@ async def test_weather_subgraph( }, metadata={ "source": "loop", - "writes": {"router_node": {"route": "weather"}}, "step": 1, "parents": {}, "thread_id": "14", @@ -7130,11 +6727,6 @@ async def test_weather_subgraph( metadata={ "step": 2, "source": "update", - "writes": { - "weather_node": { - "messages": [{"role": "assistant", "content": "rainy"}] - } - }, "parents": {"": AnyStr()}, "thread_id": "14", "checkpoint_id": AnyStr(), diff --git a/libs/langgraph/tests/test_pregel.py b/libs/langgraph/tests/test_pregel.py index 8c73daa1b..60bb05385 100644 --- a/libs/langgraph/tests/test_pregel.py +++ b/libs/langgraph/tests/test_pregel.py @@ -1071,7 +1071,6 @@ def test_pending_writes_resume( "parents": {}, "source": "loop", "step": 0, - "writes": None, "thread_id": "1", } # get_state with checkpoint_id should not apply any pending writes @@ -1162,7 +1161,6 @@ def test_pending_writes_resume( "parents": {}, "step": 1, "source": "loop", - "writes": {"one": {"value": 2}, "two": {"value": 3}}, "thread_id": "1", }, parent_config={ @@ -1211,7 +1209,6 @@ def test_pending_writes_resume( "parents": {}, "step": 0, "source": "loop", - "writes": None, "thread_id": "1", }, parent_config={ @@ -1264,7 +1261,6 @@ def test_pending_writes_resume( "parents": {}, "step": -1, "source": "input", - "writes": {"__start__": {"value": 1}}, "thread_id": "1", }, parent_config=None, @@ -2273,7 +2269,6 @@ def test_in_one_fan_out_state_graph_waiting_edge( "parents": {}, "source": "update", "step": 4, - "writes": {"retriever_one": {"docs": ["doc5"]}}, "thread_id": "2", }, parent_config=expected_parent_config, @@ -2544,7 +2539,6 @@ def test_in_one_fan_out_state_graph_defer_node( "parents": {}, "source": "update", "step": 4, - "writes": {"analyzer_one": {"docs": ["doc5"]}}, "thread_id": "2", }, parent_config=expected_parent_config, @@ -2814,7 +2808,6 @@ def test_in_one_fan_out_state_graph_then_defer_node( "parents": {}, "source": "update", "step": 4, - "writes": {"retriever_one": {"docs": ["doc5"]}}, "thread_id": "2", }, parent_config=expected_parent_config, @@ -5265,11 +5258,6 @@ def test_parent_command(sync_checkpointer: BaseCheckpointSaver) -> None: }, metadata={ "source": "loop", - "writes": { - "alice": { - "user_name": "Meow", - } - }, "thread_id": "1", "step": 1, "parents": {}, @@ -5984,11 +5972,6 @@ def test_falsy_return_from_task( "parents": {}, "source": "input", "step": -1, - "writes": { - "__start__": { - "a": 5, - }, - }, }, "next": [ "graph", @@ -6097,11 +6080,6 @@ def test_falsy_return_from_task( "source": "input", "step": -1, "thread_id": AnyStr(), - "writes": { - "__start__": { - "a": 5, - }, - }, }, "next": [ "graph", @@ -6191,10 +6169,6 @@ def test_falsy_return_from_task( "parents": {}, "source": "loop", "step": 0, - "writes": { - "falsy_task": False, - "graph": None, - }, }, "next": [], "parent_config": { @@ -8035,11 +8009,6 @@ def test_bulk_state_updates( # Check if there are only two checkpoints checkpoints = list(sync_checkpointer.list(config)) assert len(checkpoints) == 2 - assert checkpoints[0].metadata["writes"] == { - "node_a": {"foo": "updated"}, - "node_b": {"baz": "new"}, - } - assert checkpoints[1].metadata["writes"] == {"node_a": {"foo": "bar"}} # perform multiple steps at the same time config = {"configurable": {"thread_id": "2"}} @@ -8062,11 +8031,6 @@ def test_bulk_state_updates( checkpoints = list(sync_checkpointer.list(config)) assert len(checkpoints) == 2 - assert checkpoints[0].metadata["writes"] == { - "node_a": {"foo": "updated"}, - "node_b": {"baz": "new"}, - } - assert checkpoints[1].metadata["writes"] == {"node_a": {"foo": "bar"}} # Should raise error if updating without as_node with pytest.raises(InvalidUpdateError): diff --git a/libs/langgraph/tests/test_pregel_async.py b/libs/langgraph/tests/test_pregel_async.py index 54759ebf0..5577709e6 100644 --- a/libs/langgraph/tests/test_pregel_async.py +++ b/libs/langgraph/tests/test_pregel_async.py @@ -588,14 +588,12 @@ async def test_dynamic_interrupt(async_checkpointer: BaseCheckpointSaver) -> Non "parents": {}, "source": "loop", "step": 0, - "writes": None, "thread_id": "1", }, { "parents": {}, "source": "input", "step": -1, - "writes": {"__start__": {"my_key": "value ⛰️", "market": "DE"}}, "thread_id": "1", }, ] @@ -623,7 +621,6 @@ async def test_dynamic_interrupt(async_checkpointer: BaseCheckpointSaver) -> Non "parents": {}, "source": "loop", "step": 0, - "writes": None, "thread_id": "1", }, parent_config=( @@ -652,7 +649,6 @@ async def test_dynamic_interrupt(async_checkpointer: BaseCheckpointSaver) -> Non "parents": {}, "source": "update", "step": 1, - "writes": {}, "thread_id": "1", }, parent_config=( @@ -773,14 +769,12 @@ async def test_dynamic_interrupt_subgraph( "parents": {}, "source": "loop", "step": 0, - "writes": None, "thread_id": "1", }, { "parents": {}, "source": "input", "step": -1, - "writes": {"__start__": {"my_key": "value ⛰️", "market": "DE"}}, "thread_id": "1", }, ] @@ -814,7 +808,6 @@ async def test_dynamic_interrupt_subgraph( "parents": {}, "source": "loop", "step": 0, - "writes": None, "thread_id": "1", }, parent_config=( @@ -845,7 +838,6 @@ async def test_dynamic_interrupt_subgraph( "parents": {}, "source": "update", "step": 1, - "writes": {}, "thread_id": "1", }, parent_config=( @@ -965,14 +957,12 @@ async def test_copy_checkpoint(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 0, - "writes": None, "thread_id": "1", }, { "parents": {}, "source": "input", "step": -1, - "writes": {"__start__": {"my_key": "value ⛰️", "market": "DE"}}, "thread_id": "1", }, ] @@ -1010,7 +1000,6 @@ async def test_copy_checkpoint(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "loop", "step": 0, - "writes": None, "thread_id": "1", }, parent_config=( @@ -1052,7 +1041,6 @@ async def test_copy_checkpoint(async_checkpointer: BaseCheckpointSaver) -> None: "parents": {}, "source": "fork", "step": 1, - "writes": None, "thread_id": "1", }, parent_config=( @@ -1230,7 +1218,6 @@ async def test_cancel_graph_astream(async_checkpointer: BaseCheckpointSaver) -> "parents": {}, "source": "loop", "step": 0, - "writes": None, "thread_id": "1", } @@ -1306,7 +1293,6 @@ async def test_cancel_graph_astream_events_v2( "parents": {}, "source": "loop", "step": 1, - "writes": {"alittlewhile": {"value": 2}}, "thread_id": "2", } @@ -1881,7 +1867,6 @@ async def test_pending_writes_resume( "parents": {}, "source": "loop", "step": 0, - "writes": None, "thread_id": "1", } # get_state with checkpoint_id should not apply any pending writes @@ -1972,7 +1957,6 @@ async def test_pending_writes_resume( "parents": {}, "step": 1, "source": "loop", - "writes": {"one": {"value": 2}, "two": {"value": 3}}, "thread_id": "1", }, parent_config={ @@ -2021,7 +2005,6 @@ async def test_pending_writes_resume( "parents": {}, "step": 0, "source": "loop", - "writes": None, "thread_id": "1", }, parent_config={ @@ -2070,7 +2053,6 @@ async def test_pending_writes_resume( "parents": {}, "step": -1, "source": "input", - "writes": {"__start__": {"value": 1}}, "thread_id": "1", }, parent_config=None, @@ -2671,7 +2653,6 @@ async def test_send_dedupe_on_resume( }, metadata={ "source": "loop", - "writes": {"3": ["3"]}, "thread_id": "1", "step": 4, "parents": {}, @@ -2708,7 +2689,6 @@ async def test_send_dedupe_on_resume( }, metadata={ "source": "loop", - "writes": {"2": ["2|3"], "3": ["3"], "flaky": ["flaky|4"]}, "thread_id": "1", "step": 3, "parents": {}, @@ -2752,13 +2732,6 @@ async def test_send_dedupe_on_resume( }, metadata={ "source": "loop", - "writes": { - "2": [ - ["2|Command(goto=Send(node='2', arg=3))"], - ["2|Command(goto=Send(node='flaky', arg=4))"], - ], - "3.1": ["3.1"], - }, "thread_id": "1", "step": 2, "parents": {}, @@ -2814,7 +2787,6 @@ async def test_send_dedupe_on_resume( }, metadata={ "source": "loop", - "writes": {"1": ["1"]}, "thread_id": "1", "step": 1, "parents": {}, @@ -2870,7 +2842,6 @@ async def test_send_dedupe_on_resume( }, metadata={ "source": "loop", - "writes": None, "thread_id": "1", "step": 0, "parents": {}, @@ -2908,7 +2879,6 @@ async def test_send_dedupe_on_resume( }, metadata={ "source": "input", - "writes": {"__start__": ["0"]}, "thread_id": "1", "step": -1, "parents": {}, @@ -3087,22 +3057,6 @@ async def test_send_react_interrupt(async_checkpointer: BaseCheckpointSaver) -> metadata={ "step": 1, "source": "loop", - "writes": { - "agent": { - "messages": AIMessage( - content="", - id="ai1", - tool_calls=[ - { - "name": "foo", - "args": {"hi": [1, 2, 3]}, - "id": "", - "type": "tool_call", - } - ], - ) - } - }, "parents": {}, "thread_id": "2", }, @@ -3157,14 +3111,6 @@ async def test_send_react_interrupt(async_checkpointer: BaseCheckpointSaver) -> metadata={ "step": 2, "source": "update", - "writes": { - "agent": { - "messages": _AnyIdAIMessage( - content="Bye now", - tool_calls=[], - ) - } - }, "parents": {}, "thread_id": "2", }, @@ -3243,22 +3189,6 @@ async def test_send_react_interrupt(async_checkpointer: BaseCheckpointSaver) -> metadata={ "step": 1, "source": "loop", - "writes": { - "agent": { - "messages": AIMessage( - content="", - id="ai1", - tool_calls=[ - { - "name": "foo", - "args": {"hi": [1, 2, 3]}, - "id": "", - "type": "tool_call", - } - ], - ) - } - }, "parents": {}, "thread_id": "3", }, @@ -3334,21 +3264,6 @@ async def test_send_react_interrupt(async_checkpointer: BaseCheckpointSaver) -> metadata={ "step": 2, "source": "update", - "writes": { - "agent": { - "messages": _AnyIdAIMessage( - content="", - tool_calls=[ - { - "name": "foo", - "args": {"hi": [4, 5, 6]}, - "id": "tool1", - "type": "tool_call", - } - ], - ) - } - }, "parents": {}, "thread_id": "3", }, @@ -3547,22 +3462,6 @@ async def test_send_react_interrupt_control( metadata={ "step": 1, "source": "loop", - "writes": { - "agent": { - "messages": AIMessage( - content="", - id="ai1", - tool_calls=[ - { - "name": "foo", - "args": {"hi": [1, 2, 3]}, - "id": "", - "type": "tool_call", - } - ], - ) - } - }, "parents": {}, "thread_id": "2", }, @@ -3617,14 +3516,6 @@ async def test_send_react_interrupt_control( metadata={ "step": 2, "source": "update", - "writes": { - "agent": { - "messages": _AnyIdAIMessage( - content="Bye now", - tool_calls=[], - ) - } - }, "parents": {}, "thread_id": "2", }, @@ -4698,7 +4589,6 @@ async def test_in_one_fan_out_state_graph_waiting_edge_custom_state_class( metadata={ "parents": {}, "source": "loop", - "writes": {"qa": {"answer": "doc1,doc2,doc3,doc4"}}, "step": 4, "thread_id": "1", }, @@ -6386,11 +6276,6 @@ async def test_parent_command(async_checkpointer: BaseCheckpointSaver) -> None: }, metadata={ "source": "loop", - "writes": { - "alice": { - "user_name": "Meow", - } - }, "thread_id": "1", "step": 1, "parents": {}, @@ -8347,11 +8232,6 @@ async def test_bulk_state_updates(async_checkpointer: BaseCheckpointSaver) -> No c async for c in async_checkpointer.alist({"configurable": {"thread_id": "1"}}) ] assert len(checkpoints) == 2 - assert checkpoints[0].metadata["writes"] == { - "node_a": {"foo": "updated"}, - "node_b": {"baz": "new"}, - } - assert checkpoints[1].metadata["writes"] == {"node_a": {"foo": "bar"}} # perform multiple steps at the same time config = {"configurable": {"thread_id": "2"}} @@ -8376,11 +8256,6 @@ async def test_bulk_state_updates(async_checkpointer: BaseCheckpointSaver) -> No c async for c in async_checkpointer.alist({"configurable": {"thread_id": "1"}}) ] assert len(checkpoints) == 2 - assert checkpoints[0].metadata["writes"] == { - "node_a": {"foo": "updated"}, - "node_b": {"baz": "new"}, - } - assert checkpoints[1].metadata["writes"] == {"node_a": {"foo": "bar"}} # Should raise error if updating without as_node with pytest.raises(InvalidUpdateError): diff --git a/libs/prebuilt/tests/test_react_agent.py b/libs/prebuilt/tests/test_react_agent.py index 02581db22..534fd7216 100644 --- a/libs/prebuilt/tests/test_react_agent.py +++ b/libs/prebuilt/tests/test_react_agent.py @@ -90,7 +90,6 @@ def test_no_prompt(sync_checkpointer: BaseCheckpointSaver, version: str) -> None assert saved.metadata == { "parents": {}, "source": "loop", - "writes": {"agent": {"messages": [AIMessage(content="hi?", id="0")]}}, "step": 1, "thread_id": "123", } @@ -118,7 +117,6 @@ async def test_no_prompt_async(async_checkpointer: BaseCheckpointSaver) -> None: assert saved.metadata == { "parents": {}, "source": "loop", - "writes": {"agent": {"messages": [AIMessage(content="hi?", id="0")]}}, "step": 1, "thread_id": "123", }