Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
eyurtsev committed Jan 24, 2025
1 parent 6f164e2 commit 5f5c029
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libs/langgraph/langgraph/prebuilt/tool_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,14 @@ def invoke(
async def ainvoke(
self, input: Input, config: Optional[RunnableConfig] = None, **kwargs: Any
) -> Any:
# When ToolNode is added to a StateGraph as a node, the function signature
# does not include the Store argument.
# The code adds `store` to the kwargs if it is not already present with a
# special sentinel value.
# Adding `store` to the kwargs allows the underlying tool to request `store`
# as a run time parameter.
# The sentinel value is used to allow users to pass a custom value to `store`
# including a None.
if "store" not in kwargs:
kwargs["store"] = INJECT_SENTINEL
return await super().ainvoke(input, config, **kwargs)
Expand Down

0 comments on commit 5f5c029

Please sign in to comment.