Home / Function/ spawn() — langchain Function Reference

spawn() — langchain Function Reference

Architecture documentation for the spawn() function in _execution.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  ba1b6b39_fb63_7014_9fdb_7866618f263b["spawn()"]
  3ead6362_15e4_31b5_852b_83ad2c63fa17["DockerExecutionPolicy"]
  ba1b6b39_fb63_7014_9fdb_7866618f263b -->|defined in| 3ead6362_15e4_31b5_852b_83ad2c63fa17
  0ca39ab6_f475_3199_9fda_998b3047cb82["_build_command()"]
  ba1b6b39_fb63_7014_9fdb_7866618f263b -->|calls| 0ca39ab6_f475_3199_9fda_998b3047cb82
  235aaeeb_c270_5c14_f276_f59bd26a7819["_launch_subprocess()"]
  ba1b6b39_fb63_7014_9fdb_7866618f263b -->|calls| 235aaeeb_c270_5c14_f276_f59bd26a7819
  29f56f3f_9ee5_4ab0_ea77_8c7c98917847["spawn()"]
  ba1b6b39_fb63_7014_9fdb_7866618f263b -->|calls| 29f56f3f_9ee5_4ab0_ea77_8c7c98917847
  style ba1b6b39_fb63_7014_9fdb_7866618f263b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/langchain/agents/middleware/_execution.py lines 314–329

    def spawn(
        self,
        *,
        workspace: Path,
        env: Mapping[str, str],
        command: Sequence[str],
    ) -> subprocess.Popen[str]:
        full_command = self._build_command(workspace, env, command)
        host_env = os.environ.copy()
        return _launch_subprocess(
            full_command,
            env=host_env,
            cwd=workspace,
            preexec_fn=None,
            start_new_session=False,
        )

Domain

Subdomains

Frequently Asked Questions

What does spawn() do?
spawn() is a function in the langchain codebase, defined in libs/langchain_v1/langchain/agents/middleware/_execution.py.
Where is spawn() defined?
spawn() is defined in libs/langchain_v1/langchain/agents/middleware/_execution.py at line 314.
What does spawn() call?
spawn() calls 3 function(s): _build_command, _launch_subprocess, spawn.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free