Home / Function/ __post_init__() — langchain Function Reference

__post_init__() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  09da5721_9419_a889_ea0d_6bba39e39a53["__post_init__()"]
  3ead6362_15e4_31b5_852b_83ad2c63fa17["DockerExecutionPolicy"]
  09da5721_9419_a889_ea0d_6bba39e39a53 -->|defined in| 3ead6362_15e4_31b5_852b_83ad2c63fa17
  style 09da5721_9419_a889_ea0d_6bba39e39a53 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/langchain/agents/middleware/_execution.py lines 295–312

    def __post_init__(self) -> None:
        super().__post_init__()
        if self.memory_bytes is not None and self.memory_bytes <= 0:
            msg = "memory_bytes must be positive if provided."
            raise ValueError(msg)
        if self.cpu_time_seconds is not None:
            msg = (
                "DockerExecutionPolicy does not support cpu_time_seconds; configure CPU limits "
                "using Docker run options such as '--cpus'."
            )
            raise RuntimeError(msg)
        if self.cpus is not None and not self.cpus.strip():
            msg = "cpus must be a non-empty string when provided."
            raise ValueError(msg)
        if self.user is not None and not self.user.strip():
            msg = "user must be a non-empty string when provided."
            raise ValueError(msg)
        self.extra_run_args = tuple(self.extra_run_args or ())

Domain

Subdomains

Frequently Asked Questions

What does __post_init__() do?
__post_init__() is a function in the langchain codebase, defined in libs/langchain_v1/langchain/agents/middleware/_execution.py.
Where is __post_init__() defined?
__post_init__() is defined in libs/langchain_v1/langchain/agents/middleware/_execution.py at line 295.

Analyze Your Own Codebase

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

Try Supermodel Free