Home / Function/ _normalize_env() — langchain Function Reference

_normalize_env() — langchain Function Reference

Architecture documentation for the _normalize_env() function in shell_tool.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  048bbd8b_6ac4_806a_f4c0_f28cd49dcbd0["_normalize_env()"]
  4e57a0ff_f1a5_e2e9_6949_569d7cd6d70a["ShellToolMiddleware"]
  048bbd8b_6ac4_806a_f4c0_f28cd49dcbd0 -->|defined in| 4e57a0ff_f1a5_e2e9_6949_569d7cd6d70a
  bb8cdf05_0b11_e3e7_3c28_2a6ae5bfecb9["__init__()"]
  bb8cdf05_0b11_e3e7_3c28_2a6ae5bfecb9 -->|calls| 048bbd8b_6ac4_806a_f4c0_f28cd49dcbd0
  style 048bbd8b_6ac4_806a_f4c0_f28cd49dcbd0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/langchain/agents/middleware/shell_tool.py lines 616–625

    def _normalize_env(env: Mapping[str, Any] | None) -> dict[str, str] | None:
        if env is None:
            return None
        normalized: dict[str, str] = {}
        for key, value in env.items():
            if not isinstance(key, str):
                msg = "Environment variable names must be strings."  # type: ignore[unreachable]
                raise TypeError(msg)
            normalized[key] = str(value)
        return normalized

Domain

Subdomains

Called By

Frequently Asked Questions

What does _normalize_env() do?
_normalize_env() is a function in the langchain codebase, defined in libs/langchain_v1/langchain/agents/middleware/shell_tool.py.
Where is _normalize_env() defined?
_normalize_env() is defined in libs/langchain_v1/langchain/agents/middleware/shell_tool.py at line 616.
What calls _normalize_env()?
_normalize_env() is called by 1 function(s): __init__.

Analyze Your Own Codebase

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

Try Supermodel Free