_prep_run_args() — langchain Function Reference
Architecture documentation for the _prep_run_args() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 9e451f25_97c2_f2c6_30eb_6fb62f743dc0["_prep_run_args()"] 80cebff4_efbd_4311_85e9_de0dc81a7eee["base.py"] 9e451f25_97c2_f2c6_30eb_6fb62f743dc0 -->|defined in| 80cebff4_efbd_4311_85e9_de0dc81a7eee ede8808b_c1b5_3ed7_439d_90ebc56dd263["invoke()"] ede8808b_c1b5_3ed7_439d_90ebc56dd263 -->|calls| 9e451f25_97c2_f2c6_30eb_6fb62f743dc0 1d771513_400f_5264_361c_04bcb00f97ac["ainvoke()"] 1d771513_400f_5264_361c_04bcb00f97ac -->|calls| 9e451f25_97c2_f2c6_30eb_6fb62f743dc0 d8993587_9d39_6094_aba2_5ae5b188d613["_is_tool_call()"] 9e451f25_97c2_f2c6_30eb_6fb62f743dc0 -->|calls| d8993587_9d39_6094_aba2_5ae5b188d613 style 9e451f25_97c2_f2c6_30eb_6fb62f743dc0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/tools/base.py lines 1213–1247
def _prep_run_args(
value: str | dict | ToolCall,
config: RunnableConfig | None,
**kwargs: Any,
) -> tuple[str | dict, dict]:
"""Prepare arguments for tool execution.
Args:
value: The input value (`str`, `dict`, or `ToolCall`).
config: The runnable configuration.
**kwargs: Additional keyword arguments.
Returns:
A tuple of `(tool_input, run_kwargs)`.
"""
config = ensure_config(config)
if _is_tool_call(value):
tool_call_id: str | None = cast("ToolCall", value)["id"]
tool_input: str | dict = cast("ToolCall", value)["args"].copy()
else:
tool_call_id = None
tool_input = cast("str | dict", value)
return (
tool_input,
dict(
callbacks=config.get("callbacks"),
tags=config.get("tags"),
metadata=config.get("metadata"),
run_name=config.get("run_name"),
run_id=config.pop("run_id", None),
config=config,
tool_call_id=tool_call_id,
**kwargs,
),
)
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does _prep_run_args() do?
_prep_run_args() is a function in the langchain codebase, defined in libs/core/langchain_core/tools/base.py.
Where is _prep_run_args() defined?
_prep_run_args() is defined in libs/core/langchain_core/tools/base.py at line 1213.
What does _prep_run_args() call?
_prep_run_args() calls 1 function(s): _is_tool_call.
What calls _prep_run_args()?
_prep_run_args() is called by 2 function(s): ainvoke, invoke.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free