Home / Function/ abefore_agent() — langchain Function Reference

abefore_agent() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  a95ca573_06ef_a010_8c90_7f8d5c1d3de1["abefore_agent()"]
  4e57a0ff_f1a5_e2e9_6949_569d7cd6d70a["ShellToolMiddleware"]
  a95ca573_06ef_a010_8c90_7f8d5c1d3de1 -->|defined in| 4e57a0ff_f1a5_e2e9_6949_569d7cd6d70a
  style a95ca573_06ef_a010_8c90_7f8d5c1d3de1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/langchain/agents/middleware/shell_tool.py lines 643–655

    async def abefore_agent(
        self, state: ShellToolState[ResponseT], runtime: Runtime[ContextT]
    ) -> dict[str, Any] | None:
        """Async start the shell session and run startup commands.

        Args:
            state: The current agent state.
            runtime: The runtime context.

        Returns:
            Shell session resources to be stored in the agent state.
        """
        return await run_in_executor(None, self.before_agent, state, runtime)

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free