Home / Function/ _create_action_and_config() — langchain Function Reference

_create_action_and_config() — langchain Function Reference

Architecture documentation for the _create_action_and_config() function in human_in_the_loop.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  ba9e7a24_05d8_9c3c_8018_6e7b08711eb2["_create_action_and_config()"]
  b706912e_28f0_afbf_eb10_723aa3e74c52["HumanInTheLoopMiddleware"]
  ba9e7a24_05d8_9c3c_8018_6e7b08711eb2 -->|defined in| b706912e_28f0_afbf_eb10_723aa3e74c52
  c27d424a_40fd_dcec_b4d0_8dbf62b73ff2["after_model()"]
  c27d424a_40fd_dcec_b4d0_8dbf62b73ff2 -->|calls| ba9e7a24_05d8_9c3c_8018_6e7b08711eb2
  style ba9e7a24_05d8_9c3c_8018_6e7b08711eb2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/langchain/agents/middleware/human_in_the_loop.py lines 210–244

    def _create_action_and_config(
        self,
        tool_call: ToolCall,
        config: InterruptOnConfig,
        state: AgentState[Any],
        runtime: Runtime[ContextT],
    ) -> tuple[ActionRequest, ReviewConfig]:
        """Create an ActionRequest and ReviewConfig for a tool call."""
        tool_name = tool_call["name"]
        tool_args = tool_call["args"]

        # Generate description using the description field (str or callable)
        description_value = config.get("description")
        if callable(description_value):
            description = description_value(tool_call, state, runtime)
        elif description_value is not None:
            description = description_value
        else:
            description = f"{self.description_prefix}\n\nTool: {tool_name}\nArgs: {tool_args}"

        # Create ActionRequest with description
        action_request = ActionRequest(
            name=tool_name,
            args=tool_args,
            description=description,
        )

        # Create ReviewConfig
        # eventually can get tool information and populate args_schema from there
        review_config = ReviewConfig(
            action_name=tool_name,
            allowed_decisions=config["allowed_decisions"],
        )

        return action_request, review_config

Domain

Subdomains

Called By

Frequently Asked Questions

What does _create_action_and_config() do?
_create_action_and_config() is a function in the langchain codebase, defined in libs/langchain_v1/langchain/agents/middleware/human_in_the_loop.py.
Where is _create_action_and_config() defined?
_create_action_and_config() is defined in libs/langchain_v1/langchain/agents/middleware/human_in_the_loop.py at line 210.
What calls _create_action_and_config()?
_create_action_and_config() is called by 1 function(s): after_model.

Analyze Your Own Codebase

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

Try Supermodel Free