mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-17 21:25:46 +02:00
When ToolNode receives a bare `[tool_call]` list via the Send API (the
new dispatch shape that create_agent uses after langchain-ai/langchain
drops the ToolCallWithContext wrapper), hydrate ToolRuntime.state from
the current channel values instead of requiring the dispatcher to
inline the full agent state dict in the Send payload.
Implementation stays entirely in tool_node:
- Pregel installs CONFIG_KEY_READ as
`functools.partial(local_read, scratchpad, channels, managed, task)`.
Introspect the partial's positional args to learn channel + managed
names, then read them all via `ChannelRead.do_read` with an explicit
list. No changes to the pregel read machinery.
- Gracefully falls back to {} when invoked outside a Pregel context
(e.g. direct ToolNode(...).invoke(...) from test harnesses).
- Legacy ToolCallWithContext path is preserved for external dispatchers.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>