Home / Class/ InterruptOnConfig Class — langchain Architecture

InterruptOnConfig Class — langchain Architecture

Architecture documentation for the InterruptOnConfig class in human_in_the_loop.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  bbfe7f8e_bc94_30b0_4fc6_188a0515db3b["InterruptOnConfig"]
  23036d87_b616_3e6b_013c_17cd312d2a62["human_in_the_loop.py"]
  bbfe7f8e_bc94_30b0_4fc6_188a0515db3b -->|defined in| 23036d87_b616_3e6b_013c_17cd312d2a62

Relationship Graph

Source Code

libs/langchain_v1/langchain/agents/middleware/human_in_the_loop.py lines 118–164

class InterruptOnConfig(TypedDict):
    """Configuration for an action requiring human in the loop.

    This is the configuration format used in the `HumanInTheLoopMiddleware.__init__`
    method.
    """

    allowed_decisions: list[DecisionType]
    """The decisions that are allowed for this action."""

    description: NotRequired[str | _DescriptionFactory]
    """The description attached to the request for human input.

    Can be either:

    - A static string describing the approval request
    - A callable that dynamically generates the description based on agent state,
        runtime, and tool call information

    Example:
        ```python
        # Static string description
        config = ToolConfig(
            allowed_decisions=["approve", "reject"],
            description="Please review this tool execution"
        )

        # Dynamic callable description
        def format_tool_description(
            tool_call: ToolCall,
            state: AgentState,
            runtime: Runtime[ContextT]
        ) -> str:
            import json
            return (
                f"Tool: {tool_call['name']}\\n"
                f"Arguments:\\n{json.dumps(tool_call['args'], indent=2)}"
            )

        config = InterruptOnConfig(
            allowed_decisions=["approve", "edit", "reject"],
            description=format_tool_description
        )
        ```
    """
    args_schema: NotRequired[dict[str, Any]]
    """JSON schema for the args associated with the action, if edits are allowed."""

Frequently Asked Questions

What is the InterruptOnConfig class?
InterruptOnConfig is a class in the langchain codebase, defined in libs/langchain_v1/langchain/agents/middleware/human_in_the_loop.py.
Where is InterruptOnConfig defined?
InterruptOnConfig is defined in libs/langchain_v1/langchain/agents/middleware/human_in_the_loop.py at line 118.

Analyze Your Own Codebase

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

Try Supermodel Free