_cleanup_resources() — langchain Function Reference
Architecture documentation for the _cleanup_resources() function in shell_tool.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 3fc9d5a9_a23d_6df7_d3e2_bba6248f9184["_cleanup_resources()"] 943b36d5_cd9f_c106_7d11_56e39e63078a["shell_tool.py"] 3fc9d5a9_a23d_6df7_d3e2_bba6248f9184 -->|defined in| 943b36d5_cd9f_c106_7d11_56e39e63078a 8e7ca27f_5ba4_f43b_b7dd_ea19f14cf7c4["stop()"] 3fc9d5a9_a23d_6df7_d3e2_bba6248f9184 -->|calls| 8e7ca27f_5ba4_f43b_b7dd_ea19f14cf7c4 style 3fc9d5a9_a23d_6df7_d3e2_bba6248f9184 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/langchain/agents/middleware/shell_tool.py lines 71–78
def _cleanup_resources(
session: ShellSession, tempdir: tempfile.TemporaryDirectory[str] | None, timeout: float
) -> None:
with contextlib.suppress(Exception):
session.stop(timeout)
if tempdir is not None:
with contextlib.suppress(Exception):
tempdir.cleanup()
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does _cleanup_resources() do?
_cleanup_resources() is a function in the langchain codebase, defined in libs/langchain_v1/langchain/agents/middleware/shell_tool.py.
Where is _cleanup_resources() defined?
_cleanup_resources() is defined in libs/langchain_v1/langchain/agents/middleware/shell_tool.py at line 71.
What does _cleanup_resources() call?
_cleanup_resources() calls 1 function(s): stop.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free