_build_command() — langchain Function Reference
Architecture documentation for the _build_command() function in _execution.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 0ca39ab6_f475_3199_9fda_998b3047cb82["_build_command()"] 3ead6362_15e4_31b5_852b_83ad2c63fa17["DockerExecutionPolicy"] 0ca39ab6_f475_3199_9fda_998b3047cb82 -->|defined in| 3ead6362_15e4_31b5_852b_83ad2c63fa17 e4dfd7ef_1e04_5414_759b_eeaddac35815["_build_command()"] e4dfd7ef_1e04_5414_759b_eeaddac35815 -->|calls| 0ca39ab6_f475_3199_9fda_998b3047cb82 ba1b6b39_fb63_7014_9fdb_7866618f263b["spawn()"] ba1b6b39_fb63_7014_9fdb_7866618f263b -->|calls| 0ca39ab6_f475_3199_9fda_998b3047cb82 a45f9aa3_f5f0_035d_1dae_62dc52165b5e["_resolve_binary()"] 0ca39ab6_f475_3199_9fda_998b3047cb82 -->|calls| a45f9aa3_f5f0_035d_1dae_62dc52165b5e 73ea7e95_02e6_bd8d_5b08_873ffdee5093["_should_mount_workspace()"] 0ca39ab6_f475_3199_9fda_998b3047cb82 -->|calls| 73ea7e95_02e6_bd8d_5b08_873ffdee5093 e4dfd7ef_1e04_5414_759b_eeaddac35815["_build_command()"] 0ca39ab6_f475_3199_9fda_998b3047cb82 -->|calls| e4dfd7ef_1e04_5414_759b_eeaddac35815 3e8d5e89_0a16_467a_a1cf_2c14a1472ea3["_resolve_binary()"] 0ca39ab6_f475_3199_9fda_998b3047cb82 -->|calls| 3e8d5e89_0a16_467a_a1cf_2c14a1472ea3 style 0ca39ab6_f475_3199_9fda_998b3047cb82 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/langchain/agents/middleware/_execution.py lines 331–363
def _build_command(
self,
workspace: Path,
env: Mapping[str, str],
command: Sequence[str],
) -> list[str]:
binary = self._resolve_binary()
full_command: list[str] = [binary, "run", "-i"]
if self.remove_container_on_exit:
full_command.append("--rm")
if not self.network_enabled:
full_command.extend(["--network", "none"])
if self.memory_bytes is not None:
full_command.extend(["--memory", str(self.memory_bytes)])
if self._should_mount_workspace(workspace):
host_path = str(workspace)
full_command.extend(["-v", f"{host_path}:{host_path}"])
full_command.extend(["-w", host_path])
else:
full_command.extend(["-w", "/"])
if self.read_only_rootfs:
full_command.append("--read-only")
for key, value in env.items():
full_command.extend(["-e", f"{key}={value}"])
if self.cpus is not None:
full_command.extend(["--cpus", self.cpus])
if self.user is not None:
full_command.extend(["--user", self.user])
if self.extra_run_args:
full_command.extend(self.extra_run_args)
full_command.append(self.image)
full_command.extend(command)
return full_command
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does _build_command() do?
_build_command() is a function in the langchain codebase, defined in libs/langchain_v1/langchain/agents/middleware/_execution.py.
Where is _build_command() defined?
_build_command() is defined in libs/langchain_v1/langchain/agents/middleware/_execution.py at line 331.
What does _build_command() call?
_build_command() calls 4 function(s): _build_command, _resolve_binary, _resolve_binary, _should_mount_workspace.
What calls _build_command()?
_build_command() is called by 2 function(s): _build_command, spawn.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free