spawn() — langchain Function Reference
Architecture documentation for the spawn() function in _execution.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD ea98a366_f701_dc2d_901d_9954c6c58e48["spawn()"] 489b9db3_8221_6964_1dd6_b6ee6fd2e645["HostExecutionPolicy"] ea98a366_f701_dc2d_901d_9954c6c58e48 -->|defined in| 489b9db3_8221_6964_1dd6_b6ee6fd2e645 29f56f3f_9ee5_4ab0_ea77_8c7c98917847["spawn()"] 29f56f3f_9ee5_4ab0_ea77_8c7c98917847 -->|calls| ea98a366_f701_dc2d_901d_9954c6c58e48 4369ac03_9b6d_38a2_6328_517f16dfa130["_create_preexec_fn()"] ea98a366_f701_dc2d_901d_9954c6c58e48 -->|calls| 4369ac03_9b6d_38a2_6328_517f16dfa130 6592225b_0ebb_d535_96fb_1f481b669d2c["_apply_post_spawn_limits()"] ea98a366_f701_dc2d_901d_9954c6c58e48 -->|calls| 6592225b_0ebb_d535_96fb_1f481b669d2c 235aaeeb_c270_5c14_f276_f59bd26a7819["_launch_subprocess()"] ea98a366_f701_dc2d_901d_9954c6c58e48 -->|calls| 235aaeeb_c270_5c14_f276_f59bd26a7819 29f56f3f_9ee5_4ab0_ea77_8c7c98917847["spawn()"] ea98a366_f701_dc2d_901d_9954c6c58e48 -->|calls| 29f56f3f_9ee5_4ab0_ea77_8c7c98917847 style ea98a366_f701_dc2d_901d_9954c6c58e48 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/langchain/agents/middleware/_execution.py lines 131–146
def spawn(
self,
*,
workspace: Path,
env: Mapping[str, str],
command: Sequence[str],
) -> subprocess.Popen[str]:
process = _launch_subprocess(
list(command),
env=env,
cwd=workspace,
preexec_fn=self._create_preexec_fn(),
start_new_session=self.create_process_group,
)
self._apply_post_spawn_limits(process)
return process
Domain
Subdomains
Called By
Source
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 131.
What does spawn() call?
spawn() calls 4 function(s): _apply_post_spawn_limits, _create_preexec_fn, _launch_subprocess, spawn.
What calls spawn()?
spawn() is called by 1 function(s): spawn.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free