mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-08 10:47:52 +02:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2bcd48f497 | ||
|
|
ed8c91c39a | ||
|
|
6ca126f94d |
@@ -17,58 +17,8 @@ Here's how to customize the included and excluded headers:
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
The `include` and `exclude` lists accept exact header names or patterns using `*` to match any number of characters. For your security, no other regex patterns are supported.
|
||||
|
||||
## Using within your graph
|
||||
|
||||
You can access the included headers in your graph using the `config` argument of any node.
|
||||
|
||||
```python
|
||||
def my_node(state, config):
|
||||
organization_id = config["configurable"].get("x-organization-id")
|
||||
...
|
||||
```
|
||||
|
||||
Or by fetching from context (useful in tools and or within other nested functions).
|
||||
|
||||
```python
|
||||
from langgraph.config import get_config
|
||||
|
||||
def search_everything(query: str):
|
||||
organization_id = get_config()["configurable"].get("x-organization-id")
|
||||
...
|
||||
```
|
||||
|
||||
|
||||
You can even use this to dynamically compile the graph.
|
||||
|
||||
```python
|
||||
# my_graph.py.
|
||||
import contextlib
|
||||
|
||||
@contextlib.asynccontextmanager
|
||||
async def generate_agent(config):
|
||||
organization_id = config["configurable"].get("x-organization-id")
|
||||
if organization_id == "org1":
|
||||
graph = ...
|
||||
yield graph
|
||||
else:
|
||||
graph = ...
|
||||
yield graph
|
||||
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"graphs": {"agent": "my_grph.py:generate_agent"}
|
||||
}
|
||||
```
|
||||
|
||||
For more examples on how to use runtime configuration, check out the [configuration how-to](../../how-tos/configuration.ipynb).
|
||||
|
||||
### Opt-out of configurable headers
|
||||
|
||||
If you'd like to opt-out of configurable headers, you can simply set a wildcard pattern in the `exclude` list:
|
||||
|
||||
```json
|
||||
@@ -81,6 +31,4 @@ If you'd like to opt-out of configurable headers, you can simply set a wildcard
|
||||
}
|
||||
```
|
||||
|
||||
This will exclude all headers from being added to your run's configuration.
|
||||
|
||||
Note that exclusions take precedence over inclusions.
|
||||
This will exclude all headers from being added to your run's configuration.
|
||||
@@ -440,22 +440,6 @@ Upon **resuming** the graph, the counter will be incremented a second time, resu
|
||||
The value of counter is: 2
|
||||
```
|
||||
|
||||
### Resuming multiple interrupts with one invocation
|
||||
|
||||
If you have multiple interrupts in the task queue, you can use `Command.resume` with a dictionary mapping
|
||||
of interrupt ids to resume values to resume multiple interrupts with a single `invoke` / `stream` call.
|
||||
|
||||
For example, once your graph has been interrupted (multiple times, theoretically) and is stalled:
|
||||
|
||||
```python
|
||||
resume_map = {
|
||||
i.interrupt_id: f"human input for prompt {i.value}"
|
||||
for i in parent.get_state(thread_config).interrupts
|
||||
}
|
||||
|
||||
parent_graph.invoke(Command(resume=resume_map), config=thread_config)
|
||||
```
|
||||
|
||||
## Common Pitfalls
|
||||
|
||||
### Side-effects
|
||||
|
||||
@@ -691,8 +691,7 @@
|
||||
"\n",
|
||||
"checkpointer = InMemorySaver()\n",
|
||||
"graph = create_react_agent(\n",
|
||||
" # limit the output size to ensure consistent behavior\n",
|
||||
" model.bind(max_tokens=256),\n",
|
||||
" model,\n",
|
||||
" tools,\n",
|
||||
" # highlight-next-line\n",
|
||||
" pre_model_hook=summarization_node,\n",
|
||||
|
||||
@@ -102,8 +102,6 @@ CONF = cast(Literal["configurable"], sys.intern("configurable"))
|
||||
# key for the configurable dict in RunnableConfig
|
||||
NULL_TASK_ID = sys.intern("00000000-0000-0000-0000-000000000000")
|
||||
# the task_id to use for writes that are not associated with a task
|
||||
CONFIG_KEY_RESUME_MAP = sys.intern("__pregel_resume_map")
|
||||
# holds a mapping of task ns -> resume value for resuming tasks
|
||||
|
||||
RESERVED = {
|
||||
TAG_HIDDEN,
|
||||
|
||||
@@ -853,7 +853,6 @@ class Pregel(PregelProtocol):
|
||||
created_at=None,
|
||||
parent_config=None,
|
||||
tasks=(),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# migrate checkpoint if needed
|
||||
@@ -938,12 +937,6 @@ class Pregel(PregelProtocol):
|
||||
next_tasks[tid].writes.append((k, v))
|
||||
if tasks := [t for t in next_tasks.values() if t.writes]:
|
||||
apply_writes(saved.checkpoint, channels, tasks, None)
|
||||
tasks_with_writes = tasks_w_writes(
|
||||
next_tasks.values(),
|
||||
saved.pending_writes,
|
||||
task_states,
|
||||
self.stream_channels_asis,
|
||||
)
|
||||
# assemble the state snapshot
|
||||
return StateSnapshot(
|
||||
read_channels(channels, self.stream_channels_asis),
|
||||
@@ -952,8 +945,12 @@ class Pregel(PregelProtocol):
|
||||
saved.metadata,
|
||||
saved.checkpoint["ts"],
|
||||
patch_checkpoint_map(saved.parent_config, saved.metadata),
|
||||
tasks_with_writes,
|
||||
tuple([i for task in tasks_with_writes for i in task.interrupts]),
|
||||
tasks_w_writes(
|
||||
next_tasks.values(),
|
||||
saved.pending_writes,
|
||||
task_states,
|
||||
self.stream_channels_asis,
|
||||
),
|
||||
)
|
||||
|
||||
async def _aprepare_state_snapshot(
|
||||
@@ -972,7 +969,6 @@ class Pregel(PregelProtocol):
|
||||
created_at=None,
|
||||
parent_config=None,
|
||||
tasks=(),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# migrate checkpoint if needed
|
||||
@@ -1060,13 +1056,6 @@ class Pregel(PregelProtocol):
|
||||
next_tasks[tid].writes.append((k, v))
|
||||
if tasks := [t for t in next_tasks.values() if t.writes]:
|
||||
apply_writes(saved.checkpoint, channels, tasks, None)
|
||||
|
||||
tasks_with_writes = tasks_w_writes(
|
||||
next_tasks.values(),
|
||||
saved.pending_writes,
|
||||
task_states,
|
||||
self.stream_channels_asis,
|
||||
)
|
||||
# assemble the state snapshot
|
||||
return StateSnapshot(
|
||||
read_channels(channels, self.stream_channels_asis),
|
||||
@@ -1075,8 +1064,12 @@ class Pregel(PregelProtocol):
|
||||
saved.metadata,
|
||||
saved.checkpoint["ts"],
|
||||
patch_checkpoint_map(saved.parent_config, saved.metadata),
|
||||
tasks_with_writes,
|
||||
tuple([i for task in tasks_with_writes for i in task.interrupts]),
|
||||
tasks_w_writes(
|
||||
next_tasks.values(),
|
||||
saved.pending_writes,
|
||||
task_states,
|
||||
self.stream_channels_asis,
|
||||
),
|
||||
)
|
||||
|
||||
def get_state(
|
||||
|
||||
@@ -40,7 +40,6 @@ from langgraph.constants import (
|
||||
CONFIG_KEY_CHECKPOINTER,
|
||||
CONFIG_KEY_PREVIOUS,
|
||||
CONFIG_KEY_READ,
|
||||
CONFIG_KEY_RESUME_MAP,
|
||||
CONFIG_KEY_SCRATCHPAD,
|
||||
CONFIG_KEY_SEND,
|
||||
CONFIG_KEY_STORE,
|
||||
@@ -595,8 +594,6 @@ def prepare_single_task(
|
||||
config[CONF].get(CONFIG_KEY_SCRATCHPAD),
|
||||
pending_writes,
|
||||
task_id,
|
||||
xxh3_128_hexdigest(task_checkpoint_ns.encode()),
|
||||
config[CONF].get(CONFIG_KEY_RESUME_MAP),
|
||||
),
|
||||
},
|
||||
),
|
||||
@@ -707,8 +704,6 @@ def prepare_single_task(
|
||||
config[CONF].get(CONFIG_KEY_SCRATCHPAD),
|
||||
pending_writes,
|
||||
task_id,
|
||||
xxh3_128_hexdigest(task_checkpoint_ns.encode()),
|
||||
config[CONF].get(CONFIG_KEY_RESUME_MAP),
|
||||
),
|
||||
CONFIG_KEY_PREVIOUS: checkpoint["channel_values"].get(
|
||||
PREVIOUS, None
|
||||
@@ -835,8 +830,6 @@ def prepare_single_task(
|
||||
config[CONF].get(CONFIG_KEY_SCRATCHPAD),
|
||||
pending_writes,
|
||||
task_id,
|
||||
xxh3_128_hexdigest(task_checkpoint_ns.encode()),
|
||||
config[CONF].get(CONFIG_KEY_RESUME_MAP),
|
||||
),
|
||||
CONFIG_KEY_PREVIOUS: checkpoint["channel_values"].get(
|
||||
PREVIOUS, None
|
||||
@@ -888,8 +881,6 @@ def _scratchpad(
|
||||
parent_scratchpad: Optional[PregelScratchpad],
|
||||
pending_writes: list[PendingWrite],
|
||||
task_id: str,
|
||||
namespace_hash: str,
|
||||
resume_map: Optional[dict[str, Any]],
|
||||
) -> PregelScratchpad:
|
||||
if len(pending_writes) > 0:
|
||||
# find global resume value
|
||||
@@ -901,7 +892,6 @@ def _scratchpad(
|
||||
# None cannot be used as a resume value, because it would be difficult to
|
||||
# distinguish from missing when used over http
|
||||
null_resume_write = None
|
||||
|
||||
# find task-specific resume value
|
||||
for w in pending_writes:
|
||||
if w[0] == task_id and w[1] == RESUME:
|
||||
@@ -911,13 +901,8 @@ def _scratchpad(
|
||||
break
|
||||
else:
|
||||
task_resume_write = []
|
||||
# clear var
|
||||
del w
|
||||
|
||||
# find namespace and task-specific resume value
|
||||
if resume_map and namespace_hash in resume_map:
|
||||
mapped_resume_write = resume_map[namespace_hash]
|
||||
task_resume_write.append(mapped_resume_write)
|
||||
|
||||
else:
|
||||
null_resume_write = None
|
||||
task_resume_write = []
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
from collections import Counter
|
||||
from collections.abc import Iterator, Mapping, Sequence
|
||||
from typing import Any, Literal, Optional, TypeVar, Union
|
||||
from uuid import UUID
|
||||
|
||||
from langchain_core.runnables.utils import AddableDict
|
||||
|
||||
from langgraph.channels.base import BaseChannel, EmptyChannelError
|
||||
from langgraph.checkpoint.base import PendingWrite
|
||||
from langgraph.constants import (
|
||||
EMPTY_SEQ,
|
||||
ERROR,
|
||||
@@ -22,6 +24,15 @@ from langgraph.pregel.log import logger
|
||||
from langgraph.types import Command, PregelExecutableTask, Send
|
||||
|
||||
|
||||
def is_task_id(task_id: str) -> bool:
|
||||
"""Check if a string is a valid task id."""
|
||||
try:
|
||||
UUID(task_id)
|
||||
except Exception:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def read_channel(
|
||||
channels: Mapping[str, BaseChannel],
|
||||
chan: str,
|
||||
@@ -55,7 +66,9 @@ def read_channels(
|
||||
return values
|
||||
|
||||
|
||||
def map_command(cmd: Command) -> Iterator[tuple[str, str, Any]]:
|
||||
def map_command(
|
||||
cmd: Command, pending_writes: list[PendingWrite]
|
||||
) -> Iterator[tuple[str, str, Any]]:
|
||||
"""Map input chunk to a sequence of pending writes in the form (channel, value)."""
|
||||
if cmd.graph == Command.PARENT:
|
||||
raise InvalidUpdateError("There is no parent graph")
|
||||
@@ -74,7 +87,15 @@ def map_command(cmd: Command) -> Iterator[tuple[str, str, Any]]:
|
||||
f"In Command.goto, expected Send/str, got {type(send).__name__}"
|
||||
)
|
||||
if cmd.resume is not None:
|
||||
yield (NULL_TASK_ID, RESUME, cmd.resume)
|
||||
if isinstance(cmd.resume, dict) and all(is_task_id(k) for k in cmd.resume):
|
||||
for tid, resume in cmd.resume.items():
|
||||
existing: list[Any] = next(
|
||||
(w[2] for w in pending_writes if w[0] == tid and w[1] == RESUME), []
|
||||
)
|
||||
existing.append(resume)
|
||||
yield (tid, RESUME, existing)
|
||||
else:
|
||||
yield (NULL_TASK_ID, RESUME, cmd.resume)
|
||||
if cmd.update:
|
||||
for k, v in cmd._update_as_tuples():
|
||||
yield (NULL_TASK_ID, k, v)
|
||||
|
||||
@@ -47,7 +47,6 @@ from langgraph.constants import (
|
||||
CONFIG_KEY_DEDUPE_TASKS,
|
||||
CONFIG_KEY_DELEGATE,
|
||||
CONFIG_KEY_ENSURE_LATEST,
|
||||
CONFIG_KEY_RESUME_MAP,
|
||||
CONFIG_KEY_RESUMING,
|
||||
CONFIG_KEY_SCRATCHPAD,
|
||||
CONFIG_KEY_STREAM,
|
||||
@@ -113,7 +112,7 @@ from langgraph.pregel.io import (
|
||||
)
|
||||
from langgraph.pregel.manager import AsyncChannelsManager, ChannelsManager
|
||||
from langgraph.pregel.read import PregelNode
|
||||
from langgraph.pregel.utils import get_new_channel_versions, is_xxh3_128_hexdigest
|
||||
from langgraph.pregel.utils import get_new_channel_versions
|
||||
from langgraph.store.base import BaseStore
|
||||
from langgraph.types import (
|
||||
All,
|
||||
@@ -650,21 +649,14 @@ class PregelLoop(LoopProtocol):
|
||||
|
||||
# map command to writes
|
||||
if isinstance(self.input, Command):
|
||||
if resume_is_map := (
|
||||
(resume := self.input.resume) is not None
|
||||
and isinstance(resume, dict)
|
||||
and all(is_xxh3_128_hexdigest(k) for k in resume)
|
||||
):
|
||||
self.config[CONF][CONFIG_KEY_RESUME_MAP] = self.input.resume
|
||||
if resume is not None and not self.checkpointer:
|
||||
if self.input.resume is not None and not self.checkpointer:
|
||||
raise RuntimeError(
|
||||
"Cannot use Command(resume=...) without checkpointer"
|
||||
)
|
||||
writes: defaultdict[str, list[tuple[str, Any]]] = defaultdict(list)
|
||||
# group writes by task ID
|
||||
for tid, c, v in map_command(cmd=self.input):
|
||||
if not (c == RESUME and resume_is_map):
|
||||
writes[tid].append((c, v))
|
||||
for tid, c, v in map_command(self.input, self.checkpoint_pending_writes):
|
||||
writes[tid].append((c, v))
|
||||
if not writes:
|
||||
raise EmptyInputError("Received empty Command input")
|
||||
# save writes
|
||||
|
||||
@@ -241,7 +241,7 @@ class RemoteGraph(PregelProtocol):
|
||||
)
|
||||
|
||||
def _create_state_snapshot(self, state: ThreadState) -> StateSnapshot:
|
||||
tasks: list[PregelTask] = []
|
||||
tasks = []
|
||||
for task in state["tasks"]:
|
||||
interrupts = []
|
||||
for interrupt in task["interrupts"]:
|
||||
@@ -289,7 +289,6 @@ class RemoteGraph(PregelProtocol):
|
||||
if state["parent_checkpoint"]
|
||||
else None,
|
||||
tasks=tuple(tasks),
|
||||
interrupts=tuple([i for task in tasks for i in task.interrupts]),
|
||||
)
|
||||
|
||||
def _get_checkpoint(self, config: Optional[RunnableConfig]) -> Optional[Checkpoint]:
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import ast
|
||||
import inspect
|
||||
import re
|
||||
import textwrap
|
||||
from typing import Any, Callable, Optional
|
||||
|
||||
@@ -208,8 +207,3 @@ class NonLocals(ast.NodeVisitor):
|
||||
parent = parent.value
|
||||
if isinstance(parent, ast.Name):
|
||||
self.loads.add(parent.id + "." + attr_expr)
|
||||
|
||||
|
||||
def is_xxh3_128_hexdigest(value: str) -> bool:
|
||||
"""Check if the given string matches the format of xxh3_128_hexdigest."""
|
||||
return bool(re.fullmatch(r"[0-9a-f]{32}", value))
|
||||
|
||||
@@ -147,7 +147,7 @@ class Interrupt:
|
||||
"""Generate a unique ID for the interrupt based on its namespace."""
|
||||
if self.ns is None:
|
||||
return "placeholder-id"
|
||||
return xxh3_128_hexdigest("|".join(self.ns).encode())
|
||||
return xxh3_128_hexdigest("".join(self.ns).encode())
|
||||
|
||||
|
||||
class StateUpdate(NamedTuple):
|
||||
@@ -192,21 +192,19 @@ class StateSnapshot(NamedTuple):
|
||||
"""Snapshot of the state of the graph at the beginning of a step."""
|
||||
|
||||
values: Union[dict[str, Any], Any]
|
||||
"""Current values of channels."""
|
||||
"""Current values of channels"""
|
||||
next: tuple[str, ...]
|
||||
"""The name of the node to execute in each task for this step."""
|
||||
config: RunnableConfig
|
||||
"""Config used to fetch this snapshot."""
|
||||
"""Config used to fetch this snapshot"""
|
||||
metadata: Optional[CheckpointMetadata]
|
||||
"""Metadata associated with this snapshot."""
|
||||
"""Metadata associated with this snapshot"""
|
||||
created_at: Optional[str]
|
||||
"""Timestamp of snapshot creation."""
|
||||
"""Timestamp of snapshot creation"""
|
||||
parent_config: Optional[RunnableConfig]
|
||||
"""Config used to fetch the parent snapshot, if any."""
|
||||
"""Config used to fetch the parent snapshot, if any"""
|
||||
tasks: tuple[PregelTask, ...]
|
||||
"""Tasks to execute in this step. If already attempted, may contain an error."""
|
||||
interrupts: tuple[Interrupt, ...]
|
||||
"""Interrupts that occurred in this step that are pending resolution."""
|
||||
|
||||
|
||||
class Send:
|
||||
@@ -296,10 +294,6 @@ class Command(Generic[N], ToolOutputMixin):
|
||||
- Command.PARENT: closest parent graph
|
||||
update: update to apply to the graph's state.
|
||||
resume: value to resume execution with. To be used together with [`interrupt()`][langgraph.types.interrupt].
|
||||
Can be one of the following:
|
||||
|
||||
- mapping of interrupt ids to resume values
|
||||
- a single value with which to resume the next interrupt
|
||||
goto: can be one of the following:
|
||||
|
||||
- name of the node to navigate to next (any node that belongs to the specified `graph`)
|
||||
@@ -310,7 +304,7 @@ class Command(Generic[N], ToolOutputMixin):
|
||||
|
||||
graph: Optional[str] = None
|
||||
update: Optional[Any] = None
|
||||
resume: Optional[Union[dict[str, Any], Any]] = None
|
||||
resume: Optional[Union[Any, dict[str, Any]]] = None
|
||||
goto: Union[Send, Sequence[Union[Send, str]], str] = ()
|
||||
|
||||
def __repr__(self) -> str:
|
||||
|
||||
@@ -63,7 +63,6 @@ def get_expected_history(*, exc_task_results: int = 0) -> list[StateSnapshot]:
|
||||
}
|
||||
},
|
||||
tasks=(),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={
|
||||
@@ -114,15 +113,6 @@ def get_expected_history(*, exc_task_results: int = 0) -> list[StateSnapshot]:
|
||||
else {"answer": "doc1,doc2,doc3,doc4"},
|
||||
),
|
||||
),
|
||||
interrupts=()
|
||||
if exc_task_results
|
||||
else (
|
||||
Interrupt(
|
||||
value="",
|
||||
resumable=True,
|
||||
ns=[AnyStr("qa:")],
|
||||
),
|
||||
),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={
|
||||
@@ -166,7 +156,6 @@ def get_expected_history(*, exc_task_results: int = 0) -> list[StateSnapshot]:
|
||||
result=None if exc_task_results else {"docs": ["doc1", "doc2"]},
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"query": "query: what is weather in sf", "docs": []},
|
||||
@@ -217,7 +206,6 @@ def get_expected_history(*, exc_task_results: int = 0) -> list[StateSnapshot]:
|
||||
else {"docs": ["doc3", "doc4"]},
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"query": "what is weather in sf", "docs": []},
|
||||
@@ -257,7 +245,6 @@ def get_expected_history(*, exc_task_results: int = 0) -> list[StateSnapshot]:
|
||||
else {"query": "query: what is weather in sf"},
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"docs": []},
|
||||
@@ -289,7 +276,6 @@ def get_expected_history(*, exc_task_results: int = 0) -> list[StateSnapshot]:
|
||||
result={"query": "what is weather in sf"},
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -1745,7 +1731,6 @@ def test_saved_checkpoint_state_graph(
|
||||
created_at=AnyStr(),
|
||||
parent_config=latest_state.parent_config,
|
||||
tasks=latest_state.tasks,
|
||||
interrupts=latest_state.interrupts,
|
||||
)
|
||||
== history[0]
|
||||
)
|
||||
@@ -1817,7 +1802,6 @@ async def test_saved_checkpoint_state_graph_async(
|
||||
created_at=AnyStr(),
|
||||
parent_config=latest_state.parent_config,
|
||||
tasks=latest_state.tasks,
|
||||
interrupts=latest_state.interrupts,
|
||||
)
|
||||
== history[0]
|
||||
)
|
||||
|
||||
@@ -144,7 +144,6 @@ def test_invoke_two_processes_in_out_interrupt(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[1].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"inbox": 4, "output": 4, "input": 3},
|
||||
@@ -166,7 +165,6 @@ def test_invoke_two_processes_in_out_interrupt(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[2].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"inbox": 21, "output": 4, "input": 3},
|
||||
@@ -188,7 +186,6 @@ def test_invoke_two_processes_in_out_interrupt(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[3].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"inbox": 21, "output": 4, "input": 20},
|
||||
@@ -210,7 +207,6 @@ def test_invoke_two_processes_in_out_interrupt(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[4].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"inbox": 3, "output": 4, "input": 20},
|
||||
@@ -232,7 +228,6 @@ def test_invoke_two_processes_in_out_interrupt(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[5].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"inbox": 3, "output": 4, "input": 2},
|
||||
@@ -254,7 +249,6 @@ def test_invoke_two_processes_in_out_interrupt(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[6].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"inbox": 3, "input": 2},
|
||||
@@ -276,7 +270,6 @@ def test_invoke_two_processes_in_out_interrupt(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[7].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"input": 2},
|
||||
@@ -298,7 +291,6 @@ def test_invoke_two_processes_in_out_interrupt(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=None,
|
||||
interrupts=(),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -366,7 +358,6 @@ def test_fork_always_re_runs_nodes(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[1].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values=5,
|
||||
@@ -388,7 +379,6 @@ def test_fork_always_re_runs_nodes(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[2].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values=4,
|
||||
@@ -410,7 +400,6 @@ def test_fork_always_re_runs_nodes(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[3].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values=3,
|
||||
@@ -432,7 +421,6 @@ def test_fork_always_re_runs_nodes(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[4].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values=2,
|
||||
@@ -454,7 +442,6 @@ def test_fork_always_re_runs_nodes(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[5].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values=1,
|
||||
@@ -476,7 +463,6 @@ def test_fork_always_re_runs_nodes(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[6].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values=0,
|
||||
@@ -498,7 +484,6 @@ def test_fork_always_re_runs_nodes(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=None,
|
||||
interrupts=(),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -791,7 +776,6 @@ def test_conditional_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
assert (
|
||||
app_w_interrupt.checkpointer.get_tuple(config).config["configurable"][
|
||||
@@ -854,7 +838,6 @@ def test_conditional_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
assert [c for c in app_w_interrupt.stream(None, config)] == [
|
||||
@@ -986,7 +969,6 @@ def test_conditional_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# test state get/update methods with interrupt_before
|
||||
@@ -1053,7 +1035,6 @@ def test_conditional_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
app_w_interrupt.update_state(
|
||||
@@ -1110,7 +1091,6 @@ def test_conditional_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
assert [c for c in app_w_interrupt.stream(None, config)] == [
|
||||
@@ -1242,7 +1222,6 @@ def test_conditional_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# test re-invoke to continue with interrupt_before
|
||||
@@ -1309,7 +1288,6 @@ def test_conditional_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
assert [c for c in app_w_interrupt.stream(None, config)] == [
|
||||
@@ -1706,7 +1684,6 @@ def test_conditional_state_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
with assert_ctx_once():
|
||||
@@ -1760,7 +1737,6 @@ def test_conditional_state_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
with assert_ctx_once():
|
||||
@@ -1848,7 +1824,6 @@ def test_conditional_state_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# test state get/update methods with interrupt_before
|
||||
@@ -1911,7 +1886,6 @@ def test_conditional_state_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
app_w_interrupt.update_state(
|
||||
@@ -1964,7 +1938,6 @@ def test_conditional_state_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
assert [c for c in app_w_interrupt.stream(None, config)] == [
|
||||
@@ -2050,7 +2023,6 @@ def test_conditional_state_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# test w interrupt before all
|
||||
@@ -2094,7 +2066,6 @@ def test_conditional_state_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
assert [c for c in app_w_interrupt.stream(None, config)] == [
|
||||
@@ -2145,7 +2116,6 @@ def test_conditional_state_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
assert [c for c in app_w_interrupt.stream(None, config)] == [
|
||||
@@ -2217,7 +2187,6 @@ def test_conditional_state_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
assert [c for c in app_w_interrupt.stream(None, config)] == [
|
||||
@@ -2291,7 +2260,6 @@ def test_conditional_state_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
assert [c for c in app_w_interrupt.stream(None, config)] == [
|
||||
@@ -2363,7 +2331,6 @@ def test_conditional_state_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
assert [c for c in app_w_interrupt.stream(None, config)] == [
|
||||
@@ -3104,7 +3071,6 @@ def test_state_graph_packets(
|
||||
if "shallow" in checkpointer_name
|
||||
else [*app_w_interrupt.checkpointer.list(config, limit=2)][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# modify ai message
|
||||
@@ -3169,7 +3135,6 @@ def test_state_graph_packets(
|
||||
if "shallow" in checkpointer_name
|
||||
else [*app_w_interrupt.checkpointer.list(config, limit=2)][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
assert [c for c in app_w_interrupt.stream(None, config)] == [
|
||||
@@ -3289,7 +3254,6 @@ def test_state_graph_packets(
|
||||
if "shallow" in checkpointer_name
|
||||
else [*app_w_interrupt.checkpointer.list(config, limit=2)][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
app_w_interrupt.update_state(
|
||||
@@ -3351,7 +3315,6 @@ def test_state_graph_packets(
|
||||
if "shallow" in checkpointer_name
|
||||
else [*app_w_interrupt.checkpointer.list(config, limit=2)][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# interrupt before tools
|
||||
@@ -3441,7 +3404,6 @@ def test_state_graph_packets(
|
||||
if "shallow" in checkpointer_name
|
||||
else [*app_w_interrupt.checkpointer.list(config, limit=2)][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# modify ai message
|
||||
@@ -3500,7 +3462,6 @@ def test_state_graph_packets(
|
||||
if "shallow" in checkpointer_name
|
||||
else [*app_w_interrupt.checkpointer.list(config, limit=2)][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
assert [c for c in app_w_interrupt.stream(None, config)] == [
|
||||
@@ -3618,7 +3579,6 @@ def test_state_graph_packets(
|
||||
if "shallow" in checkpointer_name
|
||||
else [*app_w_interrupt.checkpointer.list(config, limit=2)][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
app_w_interrupt.update_state(
|
||||
@@ -3680,7 +3640,6 @@ def test_state_graph_packets(
|
||||
if "shallow" in checkpointer_name
|
||||
else [*app_w_interrupt.checkpointer.list(config, limit=2)][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
|
||||
@@ -3977,7 +3936,6 @@ def test_message_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# modify ai message
|
||||
@@ -4029,7 +3987,6 @@ def test_message_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
assert [c for c in app_w_interrupt.stream(None, config)] == [
|
||||
@@ -4123,7 +4080,6 @@ def test_message_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
app_w_interrupt.update_state(
|
||||
@@ -4175,7 +4131,6 @@ def test_message_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
app_w_interrupt = workflow.compile(
|
||||
@@ -4251,7 +4206,6 @@ def test_message_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# modify ai message
|
||||
@@ -4309,7 +4263,6 @@ def test_message_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
assert [c for c in app_w_interrupt.stream(None, config)] == [
|
||||
@@ -4403,7 +4356,6 @@ def test_message_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
app_w_interrupt.update_state(
|
||||
@@ -4456,7 +4408,6 @@ def test_message_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# add an extra message as if it came from "tools" node
|
||||
@@ -4509,7 +4460,6 @@ def test_message_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
|
||||
@@ -4809,7 +4759,6 @@ def test_root_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# modify ai message
|
||||
@@ -4861,7 +4810,6 @@ def test_root_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
assert [c for c in app_w_interrupt.stream(None, config)] == [
|
||||
@@ -4956,7 +4904,6 @@ def test_root_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
app_w_interrupt.update_state(
|
||||
@@ -5009,7 +4956,6 @@ def test_root_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
app_w_interrupt = workflow.compile(
|
||||
@@ -5085,7 +5031,6 @@ def test_root_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# modify ai message
|
||||
@@ -5143,7 +5088,6 @@ def test_root_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
assert [c for c in app_w_interrupt.stream(None, config)] == [
|
||||
@@ -5238,7 +5182,6 @@ def test_root_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
app_w_interrupt.update_state(
|
||||
@@ -5290,7 +5233,6 @@ def test_root_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# add an extra message as if it came from "tools" node
|
||||
@@ -5343,7 +5285,6 @@ def test_root_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(app_w_interrupt.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# create new graph with one more state key, reuse previous thread history
|
||||
@@ -5427,7 +5368,6 @@ def test_root_graph(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(new_app.checkpointer.list(config, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# new input is merged to old state
|
||||
@@ -5835,13 +5775,6 @@ def test_dynamic_interrupt(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(tool_two.checkpointer.list(thread1, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(
|
||||
Interrupt(
|
||||
value="Just because...",
|
||||
resumable=True,
|
||||
ns=[AnyStr("tool_two:")],
|
||||
),
|
||||
),
|
||||
)
|
||||
# clear the interrupt and next tasks
|
||||
tool_two.update_state(thread1, None, as_node=END)
|
||||
@@ -5870,7 +5803,6 @@ def test_dynamic_interrupt(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(tool_two.checkpointer.list(thread1, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
|
||||
@@ -6032,13 +5964,6 @@ def test_copy_checkpoint(
|
||||
if "shallow" in checkpointer_name
|
||||
else [*tool_two.checkpointer.list(thread1, limit=2)][-1].config
|
||||
),
|
||||
interrupts=(
|
||||
Interrupt(
|
||||
value="Just because...",
|
||||
resumable=True,
|
||||
ns=[AnyStr("tool_two:")],
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
if "shallow" in checkpointer_name:
|
||||
@@ -6084,7 +6009,6 @@ def test_copy_checkpoint(
|
||||
parent_config=(
|
||||
[*tool_two.checkpointer.list(thread1, limit=2)][-1].parent_config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
|
||||
@@ -6260,13 +6184,6 @@ def test_dynamic_interrupt_subgraph(
|
||||
)
|
||||
)[-1].config
|
||||
),
|
||||
interrupts=(
|
||||
Interrupt(
|
||||
value="Just because...",
|
||||
resumable=True,
|
||||
ns=[AnyStr("tool_two:"), AnyStr("do:")],
|
||||
),
|
||||
),
|
||||
)
|
||||
# clear the interrupt and next tasks
|
||||
tool_two.update_state(thread1, None, as_node=END)
|
||||
@@ -6299,7 +6216,6 @@ def test_dynamic_interrupt_subgraph(
|
||||
)
|
||||
)[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
|
||||
@@ -6418,7 +6334,6 @@ def test_start_branch_then(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(tool_two.checkpointer.list(thread1, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# resume, for same result as above
|
||||
assert tool_two.invoke(None, thread1, debug=1) == {
|
||||
@@ -6450,7 +6365,6 @@ def test_start_branch_then(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(tool_two.checkpointer.list(thread1, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
thread2 = {"configurable": {"thread_id": "2", "assistant_id": "a"}}
|
||||
@@ -6484,7 +6398,6 @@ def test_start_branch_then(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(tool_two.checkpointer.list(thread2, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# resume, for same result as above
|
||||
assert tool_two.invoke(None, thread2, debug=1) == {
|
||||
@@ -6516,7 +6429,6 @@ def test_start_branch_then(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(tool_two.checkpointer.list(thread2, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
thread3 = {"configurable": {"thread_id": "3", "assistant_id": "b"}}
|
||||
@@ -6550,7 +6462,6 @@ def test_start_branch_then(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(tool_two.checkpointer.list(thread3, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# update state
|
||||
tool_two.update_state(thread3, {"my_key": "key"}) # appends to my_key
|
||||
@@ -6579,7 +6490,6 @@ def test_start_branch_then(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(tool_two.checkpointer.list(thread3, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# resume, for same result as above
|
||||
assert tool_two.invoke(None, thread3, debug=1) == {
|
||||
@@ -6611,7 +6521,6 @@ def test_start_branch_then(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(tool_two.checkpointer.list(thread3, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
|
||||
@@ -6991,7 +6900,6 @@ def test_branch_then(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(tool_two.checkpointer.list(thread1, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# resume, for same result as above
|
||||
assert tool_two.invoke(None, thread1, debug=1) == {
|
||||
@@ -7022,7 +6930,6 @@ def test_branch_then(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(tool_two.checkpointer.list(thread1, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
thread2 = {"configurable": {"thread_id": "2"}}
|
||||
@@ -7055,7 +6962,6 @@ def test_branch_then(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(tool_two.checkpointer.list(thread2, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# resume, for same result as above
|
||||
assert tool_two.invoke(None, thread2, debug=1) == {
|
||||
@@ -7086,7 +6992,6 @@ def test_branch_then(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(tool_two.checkpointer.list(thread2, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
tool_two = tool_two_graph.compile(
|
||||
@@ -7127,7 +7032,6 @@ def test_branch_then(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(tool_two.checkpointer.list(thread1, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# update state
|
||||
@@ -7159,7 +7063,6 @@ def test_branch_then(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(tool_two.checkpointer.list(thread1, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
tool_two = tool_two_graph.compile(
|
||||
@@ -7200,7 +7103,6 @@ def test_branch_then(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(tool_two.checkpointer.list(thread1, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# resume, for same result as above
|
||||
assert tool_two.invoke(None, thread1, debug=1) == {
|
||||
@@ -7231,7 +7133,6 @@ def test_branch_then(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(tool_two.checkpointer.list(thread1, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
thread2 = {"configurable": {"thread_id": "22"}}
|
||||
@@ -7264,7 +7165,6 @@ def test_branch_then(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(tool_two.checkpointer.list(thread2, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# resume, for same result as above
|
||||
assert tool_two.invoke(None, thread2, debug=1) == {
|
||||
@@ -7295,7 +7195,6 @@ def test_branch_then(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(tool_two.checkpointer.list(thread2, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
thread3 = {"configurable": {"thread_id": "23"}}
|
||||
@@ -7322,7 +7221,6 @@ def test_branch_then(
|
||||
"thread_id": "23",
|
||||
},
|
||||
parent_config=None,
|
||||
interrupts=(),
|
||||
)
|
||||
# run from this point
|
||||
assert tool_two.invoke(None, thread3) == {
|
||||
@@ -7354,7 +7252,6 @@ def test_branch_then(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(tool_two.checkpointer.list(thread3, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# resume, for same result as above
|
||||
assert tool_two.invoke(None, thread3, debug=1) == {
|
||||
@@ -7385,7 +7282,6 @@ def test_branch_then(
|
||||
if "shallow" in checkpointer_name
|
||||
else list(tool_two.checkpointer.list(thread3, limit=2))[-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
|
||||
@@ -7527,7 +7423,6 @@ def test_send_dedupe_on_resume(
|
||||
}
|
||||
},
|
||||
tasks=(),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values=[
|
||||
@@ -7574,7 +7469,6 @@ def test_send_dedupe_on_resume(
|
||||
result=["3"],
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values=[
|
||||
@@ -7642,7 +7536,6 @@ def test_send_dedupe_on_resume(
|
||||
result=["3"],
|
||||
),
|
||||
),
|
||||
interrupts=(Interrupt(value="Bahh", resumable=False, ns=None),),
|
||||
),
|
||||
StateSnapshot(
|
||||
values=["0", "1"],
|
||||
@@ -7698,7 +7591,6 @@ def test_send_dedupe_on_resume(
|
||||
result=["3.1"],
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values=["0"],
|
||||
@@ -7736,7 +7628,6 @@ def test_send_dedupe_on_resume(
|
||||
result=["1"],
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values=[],
|
||||
@@ -7757,7 +7648,6 @@ def test_send_dedupe_on_resume(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=None,
|
||||
interrupts=(),
|
||||
tasks=(
|
||||
PregelTask(
|
||||
id=AnyStr(),
|
||||
@@ -7872,7 +7762,6 @@ def test_nested_graph_state(
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# now, get_state with subgraphs state
|
||||
assert app.get_state(config, subgraphs=True) == StateSnapshot(
|
||||
@@ -7939,7 +7828,6 @@ def test_nested_graph_state(
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -7970,7 +7858,6 @@ def test_nested_graph_state(
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# get_state_history returns outer graph checkpoints
|
||||
history = list(app.get_state_history(config))
|
||||
@@ -8017,7 +7904,6 @@ def test_nested_graph_state(
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"my_key": "my value"},
|
||||
@@ -8052,7 +7938,6 @@ def test_nested_graph_state(
|
||||
"checkpoint_id": AnyStr(),
|
||||
}
|
||||
},
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={},
|
||||
@@ -8081,7 +7966,6 @@ def test_nested_graph_state(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=None,
|
||||
interrupts=(),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -8138,7 +8022,6 @@ def test_nested_graph_state(
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
tasks=(PregelTask(AnyStr(), "inner_2", (PULL, "inner_2")),),
|
||||
),
|
||||
StateSnapshot(
|
||||
@@ -8188,7 +8071,6 @@ def test_nested_graph_state(
|
||||
},
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={},
|
||||
@@ -8217,7 +8099,6 @@ def test_nested_graph_state(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=None,
|
||||
interrupts=(),
|
||||
tasks=(
|
||||
PregelTask(
|
||||
AnyStr(),
|
||||
@@ -8269,7 +8150,6 @@ def test_nested_graph_state(
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# test full history at the end
|
||||
actual_history = list(app.get_state_history(config))
|
||||
@@ -8306,7 +8186,6 @@ def test_nested_graph_state(
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"my_key": "hi my value here and there"},
|
||||
@@ -8341,7 +8220,6 @@ def test_nested_graph_state(
|
||||
"checkpoint_id": AnyStr(),
|
||||
}
|
||||
},
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"my_key": "hi my value"},
|
||||
@@ -8379,7 +8257,6 @@ def test_nested_graph_state(
|
||||
"checkpoint_id": AnyStr(),
|
||||
}
|
||||
},
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"my_key": "my value"},
|
||||
@@ -8414,7 +8291,6 @@ def test_nested_graph_state(
|
||||
"checkpoint_id": AnyStr(),
|
||||
}
|
||||
},
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={},
|
||||
@@ -8443,7 +8319,6 @@ def test_nested_graph_state(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=None,
|
||||
interrupts=(),
|
||||
),
|
||||
]
|
||||
if "shallow" in checkpointer_name:
|
||||
@@ -8564,7 +8439,6 @@ def test_doubly_nested_graph_state(
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
child_state = app.get_state(outer_state.tasks[0].state)
|
||||
assert child_state == StateSnapshot(
|
||||
@@ -8626,7 +8500,6 @@ def test_doubly_nested_graph_state(
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
grandchild_state = app.get_state(child_state.tasks[0].state)
|
||||
assert grandchild_state == StateSnapshot(
|
||||
@@ -8689,7 +8562,6 @@ def test_doubly_nested_graph_state(
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# get state with subgraphs
|
||||
assert app.get_state(config, subgraphs=True) == StateSnapshot(
|
||||
@@ -8777,7 +8649,6 @@ def test_doubly_nested_graph_state(
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -8819,7 +8690,6 @@ def test_doubly_nested_graph_state(
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -8850,7 +8720,6 @@ def test_doubly_nested_graph_state(
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# # resume
|
||||
assert [c for c in app.stream(None, config, subgraphs=True)] == [
|
||||
@@ -8898,7 +8767,6 @@ def test_doubly_nested_graph_state(
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
)
|
||||
|
||||
@@ -8936,7 +8804,6 @@ def test_doubly_nested_graph_state(
|
||||
"checkpoint_id": AnyStr(),
|
||||
}
|
||||
},
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"my_key": "hi my value here and there"},
|
||||
@@ -8971,7 +8838,6 @@ def test_doubly_nested_graph_state(
|
||||
result={"my_key": "hi my value here and there and back again"},
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"my_key": "hi my value"},
|
||||
@@ -9012,7 +8878,6 @@ def test_doubly_nested_graph_state(
|
||||
"checkpoint_id": AnyStr(),
|
||||
}
|
||||
},
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"my_key": "my value"},
|
||||
@@ -9047,7 +8912,6 @@ def test_doubly_nested_graph_state(
|
||||
result={"my_key": "hi my value"},
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={},
|
||||
@@ -9068,7 +8932,6 @@ def test_doubly_nested_graph_state(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=None,
|
||||
interrupts=(),
|
||||
tasks=(
|
||||
PregelTask(
|
||||
id=AnyStr(),
|
||||
@@ -9119,7 +8982,6 @@ def test_doubly_nested_graph_state(
|
||||
}
|
||||
},
|
||||
tasks=(),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"my_key": "hi my value"},
|
||||
@@ -9171,7 +9033,6 @@ def test_doubly_nested_graph_state(
|
||||
result={"my_key": "hi my value here and there"},
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={},
|
||||
@@ -9200,7 +9061,6 @@ def test_doubly_nested_graph_state(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=None,
|
||||
interrupts=(),
|
||||
tasks=(
|
||||
PregelTask(
|
||||
id=AnyStr(),
|
||||
@@ -9267,7 +9127,6 @@ def test_doubly_nested_graph_state(
|
||||
}
|
||||
},
|
||||
tasks=(),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"my_key": "hi my value here"},
|
||||
@@ -9329,7 +9188,6 @@ def test_doubly_nested_graph_state(
|
||||
result={"my_key": "hi my value here and there"},
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"my_key": "hi my value"},
|
||||
@@ -9391,7 +9249,6 @@ def test_doubly_nested_graph_state(
|
||||
result={"my_key": "hi my value here"},
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={},
|
||||
@@ -9432,7 +9289,6 @@ def test_doubly_nested_graph_state(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=None,
|
||||
interrupts=(),
|
||||
tasks=(
|
||||
PregelTask(
|
||||
id=AnyStr(),
|
||||
@@ -9709,7 +9565,6 @@ def test_send_react_interrupt(
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
tasks=(
|
||||
PregelTask(
|
||||
id=AnyStr(),
|
||||
@@ -9773,7 +9628,6 @@ def test_send_react_interrupt(
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
tasks=(),
|
||||
)
|
||||
|
||||
@@ -9871,7 +9725,6 @@ def test_send_react_interrupt(
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
tasks=(
|
||||
PregelTask(
|
||||
id=AnyStr(),
|
||||
@@ -9963,7 +9816,6 @@ def test_send_react_interrupt(
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
tasks=(
|
||||
PregelTask(
|
||||
id=AnyStr(),
|
||||
@@ -10194,7 +10046,6 @@ def test_send_react_interrupt_control(
|
||||
result=None,
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# remove the tool call, clearing the pending task
|
||||
@@ -10247,7 +10098,6 @@ def test_send_react_interrupt_control(
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
tasks=(),
|
||||
)
|
||||
|
||||
@@ -10450,7 +10300,6 @@ def test_weather_subgraph(
|
||||
},
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# update
|
||||
@@ -10593,11 +10442,9 @@ def test_weather_subgraph(
|
||||
path=(PULL, "weather_node"),
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
graph.update_state(
|
||||
state.tasks[0].state.config,
|
||||
@@ -10700,12 +10547,10 @@ def test_weather_subgraph(
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
tasks=(),
|
||||
),
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
assert [
|
||||
c
|
||||
|
||||
@@ -141,7 +141,6 @@ async def test_invoke_two_processes_in_out_interrupt(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[1].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"inbox": 4, "output": 4, "input": 3},
|
||||
@@ -165,7 +164,6 @@ async def test_invoke_two_processes_in_out_interrupt(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[2].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"inbox": 21, "output": 4, "input": 3},
|
||||
@@ -189,7 +187,6 @@ async def test_invoke_two_processes_in_out_interrupt(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[3].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"inbox": 21, "output": 4, "input": 20},
|
||||
@@ -211,7 +208,6 @@ async def test_invoke_two_processes_in_out_interrupt(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[4].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"inbox": 3, "output": 4, "input": 20},
|
||||
@@ -235,7 +231,6 @@ async def test_invoke_two_processes_in_out_interrupt(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[5].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"inbox": 3, "output": 4, "input": 2},
|
||||
@@ -257,7 +252,6 @@ async def test_invoke_two_processes_in_out_interrupt(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[6].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"inbox": 3, "input": 2},
|
||||
@@ -281,7 +275,6 @@ async def test_invoke_two_processes_in_out_interrupt(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[7].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"input": 2},
|
||||
@@ -305,7 +298,6 @@ async def test_invoke_two_processes_in_out_interrupt(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=None,
|
||||
interrupts=(),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -382,7 +374,6 @@ async def test_fork_always_re_runs_nodes(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[1].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values=5,
|
||||
@@ -404,7 +395,6 @@ async def test_fork_always_re_runs_nodes(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[2].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values=4,
|
||||
@@ -426,7 +416,6 @@ async def test_fork_always_re_runs_nodes(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[3].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values=3,
|
||||
@@ -448,7 +437,6 @@ async def test_fork_always_re_runs_nodes(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[4].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values=2,
|
||||
@@ -470,7 +458,6 @@ async def test_fork_always_re_runs_nodes(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[5].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values=1,
|
||||
@@ -492,7 +479,6 @@ async def test_fork_always_re_runs_nodes(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=history[6].config,
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values=0,
|
||||
@@ -516,7 +502,6 @@ async def test_fork_always_re_runs_nodes(
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=None,
|
||||
interrupts=(),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -873,7 +858,6 @@ async def test_conditional_graph(checkpointer_name: str) -> None:
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
await app_w_interrupt.aupdate_state(
|
||||
@@ -932,7 +916,6 @@ async def test_conditional_graph(checkpointer_name: str) -> None:
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
assert [c async for c in app_w_interrupt.astream(None, config)] == [
|
||||
@@ -1066,7 +1049,6 @@ async def test_conditional_graph(checkpointer_name: str) -> None:
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# test state get/update methods with interrupt_before
|
||||
@@ -1142,7 +1124,6 @@ async def test_conditional_graph(checkpointer_name: str) -> None:
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
await app_w_interrupt.aupdate_state(
|
||||
@@ -1201,7 +1182,6 @@ async def test_conditional_graph(checkpointer_name: str) -> None:
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
assert [c async for c in app_w_interrupt.astream(None, config)] == [
|
||||
@@ -1335,7 +1315,6 @@ async def test_conditional_graph(checkpointer_name: str) -> None:
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# test re-invoke to continue with interrupt_before
|
||||
@@ -1411,7 +1390,6 @@ async def test_conditional_graph(checkpointer_name: str) -> None:
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
assert [c async for c in app_w_interrupt.astream(None, config)] == [
|
||||
@@ -1841,7 +1819,6 @@ async def test_conditional_graph_state(
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
async with assert_ctx_once():
|
||||
@@ -1897,7 +1874,6 @@ async def test_conditional_graph_state(
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
async with assert_ctx_once():
|
||||
@@ -1987,7 +1963,6 @@ async def test_conditional_graph_state(
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# test state get/update methods with interrupt_before
|
||||
@@ -2056,7 +2031,6 @@ async def test_conditional_graph_state(
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
await app_w_interrupt.aupdate_state(
|
||||
@@ -2111,7 +2085,6 @@ async def test_conditional_graph_state(
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
assert [c async for c in app_w_interrupt.astream(None, config)] == [
|
||||
@@ -2199,7 +2172,6 @@ async def test_conditional_graph_state(
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
|
||||
@@ -2824,7 +2796,6 @@ async def test_state_graph_packets(checkpointer_name: str) -> None:
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# modify ai message
|
||||
@@ -2883,7 +2854,6 @@ async def test_state_graph_packets(checkpointer_name: str) -> None:
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
assert [c async for c in app_w_interrupt.astream(None, config)] == [
|
||||
@@ -2998,7 +2968,6 @@ async def test_state_graph_packets(checkpointer_name: str) -> None:
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
await app_w_interrupt.aupdate_state(
|
||||
@@ -3053,7 +3022,6 @@ async def test_state_graph_packets(checkpointer_name: str) -> None:
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# interrupt before tools
|
||||
@@ -3141,7 +3109,6 @@ async def test_state_graph_packets(checkpointer_name: str) -> None:
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# modify ai message
|
||||
@@ -3200,7 +3167,6 @@ async def test_state_graph_packets(checkpointer_name: str) -> None:
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
assert [c async for c in app_w_interrupt.astream(None, config)] == [
|
||||
@@ -3315,7 +3281,6 @@ async def test_state_graph_packets(checkpointer_name: str) -> None:
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
await app_w_interrupt.aupdate_state(
|
||||
@@ -3370,7 +3335,6 @@ async def test_state_graph_packets(checkpointer_name: str) -> None:
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
|
||||
@@ -3636,7 +3600,6 @@ async def test_message_graph(checkpointer_name: str) -> None:
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# modify ai message
|
||||
@@ -3691,7 +3654,6 @@ async def test_message_graph(checkpointer_name: str) -> None:
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
assert [c async for c in app_w_interrupt.astream(None, config)] == [
|
||||
@@ -3782,7 +3744,6 @@ async def test_message_graph(checkpointer_name: str) -> None:
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
await app_w_interrupt.aupdate_state(
|
||||
@@ -3831,7 +3792,6 @@ async def test_message_graph(checkpointer_name: str) -> None:
|
||||
c async for c in app_w_interrupt.checkpointer.alist(config, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
|
||||
@@ -4171,7 +4131,6 @@ async def test_start_branch_then(checkpointer_name: str) -> None:
|
||||
-1
|
||||
].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# resume, for same result as above
|
||||
assert await tool_two.ainvoke(None, thread1, debug=1) == {
|
||||
@@ -4205,7 +4164,6 @@ async def test_start_branch_then(checkpointer_name: str) -> None:
|
||||
-1
|
||||
].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
thread2 = {"configurable": {"thread_id": "2", "assistant_id": "a"}}
|
||||
@@ -4241,7 +4199,6 @@ async def test_start_branch_then(checkpointer_name: str) -> None:
|
||||
-1
|
||||
].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# resume, for same result as above
|
||||
assert await tool_two.ainvoke(None, thread2, debug=1) == {
|
||||
@@ -4275,7 +4232,6 @@ async def test_start_branch_then(checkpointer_name: str) -> None:
|
||||
-1
|
||||
].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
thread3 = {"configurable": {"thread_id": "3", "assistant_id": "b"}}
|
||||
@@ -4311,7 +4267,6 @@ async def test_start_branch_then(checkpointer_name: str) -> None:
|
||||
-1
|
||||
].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# update state
|
||||
await tool_two.aupdate_state(thread3, {"my_key": "key"}) # appends to my_key
|
||||
@@ -4342,7 +4297,6 @@ async def test_start_branch_then(checkpointer_name: str) -> None:
|
||||
-1
|
||||
].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# resume, for same result as above
|
||||
assert await tool_two.ainvoke(None, thread3, debug=1) == {
|
||||
@@ -4376,7 +4330,6 @@ async def test_start_branch_then(checkpointer_name: str) -> None:
|
||||
-1
|
||||
].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
|
||||
@@ -4919,7 +4872,6 @@ async def test_branch_then(checkpointer_name: str) -> None:
|
||||
-1
|
||||
].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# resume, for same result as above
|
||||
assert await tool_two.ainvoke(None, thread1, debug=1) == {
|
||||
@@ -4952,7 +4904,6 @@ async def test_branch_then(checkpointer_name: str) -> None:
|
||||
-1
|
||||
].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
thread2 = {"configurable": {"thread_id": "12"}}
|
||||
@@ -4987,7 +4938,6 @@ async def test_branch_then(checkpointer_name: str) -> None:
|
||||
-1
|
||||
].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# resume, for same result as above
|
||||
assert await tool_two.ainvoke(None, thread2, debug=1) == {
|
||||
@@ -5020,7 +4970,6 @@ async def test_branch_then(checkpointer_name: str) -> None:
|
||||
-1
|
||||
].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
tool_two = tool_two_graph.compile(
|
||||
@@ -5063,7 +5012,6 @@ async def test_branch_then(checkpointer_name: str) -> None:
|
||||
-1
|
||||
].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# resume, for same result as above
|
||||
assert await tool_two.ainvoke(None, thread1, debug=1) == {
|
||||
@@ -5096,7 +5044,6 @@ async def test_branch_then(checkpointer_name: str) -> None:
|
||||
-1
|
||||
].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
thread2 = {"configurable": {"thread_id": "22"}}
|
||||
@@ -5131,7 +5078,6 @@ async def test_branch_then(checkpointer_name: str) -> None:
|
||||
-1
|
||||
].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# resume, for same result as above
|
||||
assert await tool_two.ainvoke(None, thread2, debug=1) == {
|
||||
@@ -5164,7 +5110,6 @@ async def test_branch_then(checkpointer_name: str) -> None:
|
||||
-1
|
||||
].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
thread3 = {"configurable": {"thread_id": "23"}}
|
||||
@@ -5187,7 +5132,6 @@ async def test_branch_then(checkpointer_name: str) -> None:
|
||||
"thread_id": "23",
|
||||
},
|
||||
parent_config=None,
|
||||
interrupts=(),
|
||||
)
|
||||
# run from this point
|
||||
assert await tool_two.ainvoke(None, thread3) == {
|
||||
@@ -5215,7 +5159,6 @@ async def test_branch_then(checkpointer_name: str) -> None:
|
||||
"thread_id": "23",
|
||||
},
|
||||
parent_config=(None if "shallow" in checkpointer_name else uconfig),
|
||||
interrupts=(),
|
||||
)
|
||||
# resume, for same result as above
|
||||
assert await tool_two.ainvoke(None, thread3, debug=1) == {
|
||||
@@ -5248,7 +5191,6 @@ async def test_branch_then(checkpointer_name: str) -> None:
|
||||
-1
|
||||
].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
|
||||
@@ -5345,7 +5287,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# now, get_state with subgraphs state
|
||||
assert await app.aget_state(config, subgraphs=True) == StateSnapshot(
|
||||
@@ -5412,7 +5353,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -5443,7 +5383,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# get_state_history returns outer graph checkpoints
|
||||
history = [c async for c in app.aget_state_history(config)]
|
||||
@@ -5490,7 +5429,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"my_key": "my value"},
|
||||
@@ -5525,7 +5463,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
|
||||
"checkpoint_id": AnyStr(),
|
||||
}
|
||||
},
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={},
|
||||
@@ -5554,7 +5491,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=None,
|
||||
interrupts=(),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -5614,7 +5550,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
|
||||
}
|
||||
),
|
||||
tasks=(PregelTask(AnyStr(), "inner_2", (PULL, "inner_2")),),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"my_key": "hi my value"},
|
||||
@@ -5663,7 +5598,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
|
||||
},
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={},
|
||||
@@ -5700,7 +5634,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
|
||||
result={"my_key": "hi my value"},
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -5744,7 +5677,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# test full history at the end
|
||||
actual_history = [c async for c in app.aget_state_history(config)]
|
||||
@@ -5783,7 +5715,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"my_key": "hi my value here and there"},
|
||||
@@ -5818,7 +5749,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
|
||||
"checkpoint_id": AnyStr(),
|
||||
}
|
||||
},
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"my_key": "hi my value"},
|
||||
@@ -5859,7 +5789,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
|
||||
"checkpoint_id": AnyStr(),
|
||||
}
|
||||
},
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"my_key": "my value"},
|
||||
@@ -5894,7 +5823,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
|
||||
"checkpoint_id": AnyStr(),
|
||||
}
|
||||
},
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={},
|
||||
@@ -5923,7 +5851,6 @@ async def test_nested_graph_state(checkpointer_name: str) -> None:
|
||||
},
|
||||
created_at=AnyStr(),
|
||||
parent_config=None,
|
||||
interrupts=(),
|
||||
),
|
||||
]
|
||||
if "shallow" in checkpointer_name:
|
||||
@@ -6043,7 +5970,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
child_state = await app.aget_state(outer_state.tasks[0].state)
|
||||
assert child_state == StateSnapshot(
|
||||
@@ -6105,7 +6031,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
grandchild_state = await app.aget_state(child_state.tasks[0].state)
|
||||
assert grandchild_state == StateSnapshot(
|
||||
@@ -6170,7 +6095,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# get state with subgraphs
|
||||
assert await app.aget_state(config, subgraphs=True) == StateSnapshot(
|
||||
@@ -6262,7 +6186,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -6306,7 +6229,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -6337,7 +6259,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# resume
|
||||
assert [c async for c in app.astream(None, config, subgraphs=True)] == [
|
||||
@@ -6390,7 +6311,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
)
|
||||
|
||||
@@ -6432,7 +6352,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
|
||||
"checkpoint_id": AnyStr(),
|
||||
}
|
||||
},
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"my_key": "hi my value here and there"},
|
||||
@@ -6464,7 +6383,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
|
||||
id=AnyStr(), name="parent_2", path=(PULL, "parent_2")
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"my_key": "hi my value"},
|
||||
@@ -6504,7 +6422,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
|
||||
"checkpoint_id": AnyStr(),
|
||||
}
|
||||
},
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"my_key": "my value"},
|
||||
@@ -6536,7 +6453,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
|
||||
id=AnyStr(), name="parent_1", path=(PULL, "parent_1")
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={},
|
||||
@@ -6562,7 +6478,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
|
||||
id=AnyStr(), name="__start__", path=(PULL, "__start__")
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
][0]
|
||||
)
|
||||
@@ -6608,7 +6523,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
|
||||
}
|
||||
},
|
||||
tasks=(),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"my_key": "hi my value"},
|
||||
@@ -6660,7 +6574,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
|
||||
result={"my_key": "hi my value here and there"},
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={},
|
||||
@@ -6697,7 +6610,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
|
||||
result={"my_key": "hi my value"},
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
]
|
||||
# get grandchild graph history
|
||||
@@ -6762,7 +6674,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
|
||||
}
|
||||
},
|
||||
tasks=(),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"my_key": "hi my value here"},
|
||||
@@ -6826,7 +6737,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
|
||||
result={"my_key": "hi my value here and there"},
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={"my_key": "hi my value"},
|
||||
@@ -6890,7 +6800,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
|
||||
result={"my_key": "hi my value here"},
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values={},
|
||||
@@ -6941,7 +6850,6 @@ async def test_doubly_nested_graph_state(checkpointer_name: str) -> None:
|
||||
result={"my_key": "hi my value"},
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -7223,7 +7131,6 @@ async def test_weather_subgraph(
|
||||
},
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
# confirm that list() delegates to alist() correctly
|
||||
assert await asyncio.to_thread(get_first_in_list) == state
|
||||
@@ -7363,7 +7270,6 @@ async def test_weather_subgraph(
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
tasks=(
|
||||
PregelTask(
|
||||
id=AnyStr(),
|
||||
@@ -7374,7 +7280,6 @@ async def test_weather_subgraph(
|
||||
),
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
await graph.aupdate_state(
|
||||
state.tasks[0].state.config,
|
||||
@@ -7414,7 +7319,6 @@ async def test_weather_subgraph(
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
tasks=(
|
||||
PregelTask(
|
||||
id=AnyStr(),
|
||||
@@ -7481,7 +7385,6 @@ async def test_weather_subgraph(
|
||||
}
|
||||
),
|
||||
tasks=(),
|
||||
interrupts=(),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -2491,7 +2491,6 @@ def test_in_one_fan_out_state_graph_waiting_edge(
|
||||
"thread_id": "2",
|
||||
},
|
||||
parent_config=expected_parent_config,
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
assert [c for c in app_w_interrupt.stream(None, config, debug=1)] == [
|
||||
@@ -5225,7 +5224,6 @@ def test_parent_command(request: pytest.FixtureRequest, checkpointer_name: str)
|
||||
}
|
||||
),
|
||||
tasks=(),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -650,13 +650,6 @@ async def test_dynamic_interrupt(checkpointer_name: str) -> None:
|
||||
-1
|
||||
].config
|
||||
),
|
||||
interrupts=(
|
||||
Interrupt(
|
||||
value="Just because...",
|
||||
resumable=True,
|
||||
ns=[AnyStr("tool_two:")],
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
# clear the interrupt and next tasks
|
||||
@@ -683,7 +676,6 @@ async def test_dynamic_interrupt(checkpointer_name: str) -> None:
|
||||
-1
|
||||
].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
|
||||
@@ -856,13 +848,6 @@ async def test_dynamic_interrupt_subgraph(checkpointer_name: str) -> None:
|
||||
c async for c in tool_two.checkpointer.alist(thread1root, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(
|
||||
Interrupt(
|
||||
value="Just because...",
|
||||
resumable=True,
|
||||
ns=[AnyStr("tool_two:"), AnyStr("do:")],
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
# clear the interrupt and next tasks
|
||||
@@ -889,7 +874,6 @@ async def test_dynamic_interrupt_subgraph(checkpointer_name: str) -> None:
|
||||
c async for c in tool_two.checkpointer.alist(thread1root, limit=2)
|
||||
][-1].config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
|
||||
@@ -1063,13 +1047,6 @@ async def test_copy_checkpoint(checkpointer_name: str) -> None:
|
||||
-1
|
||||
].config
|
||||
),
|
||||
interrupts=(
|
||||
Interrupt(
|
||||
value="Just because...",
|
||||
resumable=True,
|
||||
ns=[AnyStr("tool_two:")],
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
if "shallow" in checkpointer_name:
|
||||
@@ -1111,7 +1088,6 @@ async def test_copy_checkpoint(checkpointer_name: str) -> None:
|
||||
-1
|
||||
].parent_config
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
|
||||
@@ -2924,7 +2900,6 @@ async def test_send_dedupe_on_resume(
|
||||
}
|
||||
},
|
||||
tasks=(),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values=[
|
||||
@@ -2971,7 +2946,6 @@ async def test_send_dedupe_on_resume(
|
||||
result=["3"],
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values=[
|
||||
@@ -3039,7 +3013,6 @@ async def test_send_dedupe_on_resume(
|
||||
result=["3"],
|
||||
),
|
||||
),
|
||||
interrupts=(Interrupt(value="Bahh", resumable=False, ns=None),),
|
||||
),
|
||||
StateSnapshot(
|
||||
values=["0", "1"],
|
||||
@@ -3095,7 +3068,6 @@ async def test_send_dedupe_on_resume(
|
||||
result=["3.1"],
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values=["0"],
|
||||
@@ -3133,7 +3105,6 @@ async def test_send_dedupe_on_resume(
|
||||
result=["1"],
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
StateSnapshot(
|
||||
values=[],
|
||||
@@ -3165,7 +3136,6 @@ async def test_send_dedupe_on_resume(
|
||||
result=["0"],
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
),
|
||||
]
|
||||
if checkpoint_during:
|
||||
@@ -3368,7 +3338,6 @@ async def test_send_react_interrupt(checkpointer_name: str) -> None:
|
||||
result=None,
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# remove the tool call, clearing the pending task
|
||||
@@ -3422,7 +3391,6 @@ async def test_send_react_interrupt(checkpointer_name: str) -> None:
|
||||
}
|
||||
),
|
||||
tasks=(),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# tool call not executed
|
||||
@@ -3528,7 +3496,6 @@ async def test_send_react_interrupt(checkpointer_name: str) -> None:
|
||||
result=None,
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# replace the tool call, should clear previous send, create new one
|
||||
@@ -3620,7 +3587,6 @@ async def test_send_react_interrupt(checkpointer_name: str) -> None:
|
||||
result=None,
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# prev tool call not executed, new tool call is
|
||||
@@ -3838,7 +3804,6 @@ async def test_send_react_interrupt_control(
|
||||
result=None,
|
||||
),
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# remove the tool call, clearing the pending task
|
||||
@@ -3892,7 +3857,6 @@ async def test_send_react_interrupt_control(
|
||||
}
|
||||
),
|
||||
tasks=(),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
# tool call not executed
|
||||
@@ -4973,7 +4937,6 @@ async def test_in_one_fan_out_state_graph_waiting_edge_custom_state_class(
|
||||
}
|
||||
}
|
||||
),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
async with assert_ctx_once():
|
||||
@@ -6672,7 +6635,6 @@ async def test_parent_command(checkpointer_name: str) -> None:
|
||||
}
|
||||
),
|
||||
tasks=(),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -183,7 +183,6 @@ def test_get_state():
|
||||
created_at="timestamp",
|
||||
parent_config=None,
|
||||
tasks=(),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
|
||||
@@ -241,7 +240,6 @@ async def test_aget_state():
|
||||
}
|
||||
},
|
||||
tasks=(),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
|
||||
@@ -292,7 +290,6 @@ def test_get_state_history():
|
||||
created_at="timestamp",
|
||||
parent_config=None,
|
||||
tasks=(),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
|
||||
@@ -346,7 +343,6 @@ async def test_aget_state_history():
|
||||
created_at="timestamp",
|
||||
parent_config=None,
|
||||
tasks=(),
|
||||
interrupts=(),
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user