Apply patch [skip ci]

This commit is contained in:
open-swe[bot]
2025-08-22 12:37:24 +00:00
parent ce9473293f
commit d411013b6f
@@ -664,6 +664,44 @@ class ToolNode(RunnableCallable):
}
return tool_call
def _inject_runtime(
self,
tool_call: ToolCall,
store: Optional[BaseStore],
config: RunnableConfig,
) -> ToolCall:
"""Inject runtime object into tool call arguments.
This method creates and injects a Runtime object containing store and
context into tools that have a 'runtime' reserved keyword parameter.
Args:
tool_call: The tool call dictionary to augment with runtime.
store: The persistent store instance to include in runtime.
config: The runnable configuration containing context.
Returns:
The tool call with runtime injected if needed.
"""
runtime_arg = self.tool_to_runtime_arg[tool_call["name"]]
if not runtime_arg:
return tool_call
# Create a Runtime object with store and context from config
# The context will be available from the config if set
runtime = Runtime(
context=config.get("configurable", {}).get("context"),
store=store,
stream_writer=lambda _: None, # Default no-op stream writer
previous=None,
)
tool_call["args"] = {
**tool_call["args"],
runtime_arg: runtime,
}
return tool_call
def inject_tool_args(
self,
tool_call: ToolCall,
@@ -1179,3 +1217,4 @@ def _get_runtime_arg(tool: BaseTool) -> Optional[str]: