diff --git a/libs/langgraph/langgraph/managed/base.py b/libs/langgraph/langgraph/managed/base.py index c5516ca1e..ca206464e 100644 --- a/libs/langgraph/langgraph/managed/base.py +++ b/libs/langgraph/langgraph/managed/base.py @@ -110,12 +110,9 @@ ChannelTypePlaceholder = object() class ManagedValueMapping(dict[str, ManagedValue]): def replace_runtime_values(self, step: int, values: Union[dict[str, Any], Any]): - print("replace_runtime_values", values) if isinstance(values, dict): for key, value in values.items(): for chan, mv in self.items(): - print("chan", chan, "mv", mv, "v", mv(step), "value", value) - print(mv, mv.runtime, mv(step) is value) if mv.runtime and mv(step) is value: values[key] = {RUNTIME_PLACEHOLDER: chan} elif hasattr(values, "__dir__") and callable(values.__dir__): diff --git a/libs/langgraph/tests/test_pregel.py b/libs/langgraph/tests/test_pregel.py index ad13e52c0..9f6a0c0e5 100644 --- a/libs/langgraph/tests/test_pregel.py +++ b/libs/langgraph/tests/test_pregel.py @@ -4106,6 +4106,7 @@ def test_state_graph_packets( ) def agent(data: AgentState) -> AgentState: + assert isinstance(data["session"], httpx.Client) return { "messages": model.invoke(data["messages"]), "something_extra": "hi there", @@ -4113,6 +4114,7 @@ def test_state_graph_packets( # Define decision-making logic def should_continue(data: AgentState) -> str: + assert isinstance(data["session"], httpx.Client) assert ( data["something_extra"] == "hi there" ), "nodes can pass extra data to their cond edges, which isn't saved in state" @@ -4130,6 +4132,7 @@ def test_state_graph_packets( my_session: httpx.Client def tools_node(input: ToolInput, config: RunnableConfig) -> AgentState: + assert isinstance(input["my_session"], httpx.Client) tool_call = input["call"] time.sleep(tool_call["args"].get("idx", 0) / 10) output = tools_by_name[tool_call["name"]].invoke(tool_call["args"], config) diff --git a/libs/langgraph/tests/test_pregel_async.py b/libs/langgraph/tests/test_pregel_async.py index 6d0436bb5..4995addb6 100644 --- a/libs/langgraph/tests/test_pregel_async.py +++ b/libs/langgraph/tests/test_pregel_async.py @@ -3892,7 +3892,7 @@ async def test_state_graph_packets() -> None: class AgentState(TypedDict): messages: Annotated[list[BaseMessage], add_messages] - session: Annotated[httpx.Client, Context(httpx.Client)] + session: Annotated[httpx.AsyncClient, Context(httpx.AsyncClient)] @tool() def search_api(query: str) -> str: @@ -3937,6 +3937,7 @@ async def test_state_graph_packets() -> None: # Define decision-making logic def should_continue(data: AgentState) -> str: + assert isinstance(data["session"], httpx.AsyncClient) # Logic to decide whether to continue in the loop or exit if tool_calls := data["messages"][-1].tool_calls: return [ @@ -3951,6 +3952,7 @@ async def test_state_graph_packets() -> None: my_session: httpx.Client async def tools_node(input: ToolInput, config: RunnableConfig) -> AgentState: + assert isinstance(input["my_session"], httpx.AsyncClient) tool_call = input["call"] await asyncio.sleep(tool_call["args"].get("idx", 0) / 10) output = await tools_by_name[tool_call["name"]].ainvoke(