Home / Function/ test_human_in_the_loop_middleware_no_interrupts_needed() — langchain Function Reference

test_human_in_the_loop_middleware_no_interrupts_needed() — langchain Function Reference

Architecture documentation for the test_human_in_the_loop_middleware_no_interrupts_needed() function in test_human_in_the_loop.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  6b3a6b58_02cc_8982_15a0_f8ce2d63f9ab["test_human_in_the_loop_middleware_no_interrupts_needed()"]
  b9ab5ab1_a37b_d0e1_974a_34ca8a76a788["test_human_in_the_loop.py"]
  6b3a6b58_02cc_8982_15a0_f8ce2d63f9ab -->|defined in| b9ab5ab1_a37b_d0e1_974a_34ca8a76a788
  style 6b3a6b58_02cc_8982_15a0_f8ce2d63f9ab fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_human_in_the_loop.py lines 30–54

def test_human_in_the_loop_middleware_no_interrupts_needed() -> None:
    """Test HumanInTheLoopMiddleware when no interrupts are needed."""
    middleware = HumanInTheLoopMiddleware(
        interrupt_on={"test_tool": {"allowed_decisions": ["approve", "edit", "reject"]}}
    )

    # Test with no messages
    state = AgentState[Any](messages=[])
    result = middleware.after_model(state, Runtime())
    assert result is None

    # Test with message but no tool calls
    state = AgentState[Any](messages=[HumanMessage(content="Hello"), AIMessage(content="Hi there")])

    result = middleware.after_model(state, Runtime())
    assert result is None

    # Test with tool calls that don't require interrupts
    ai_message = AIMessage(
        content="I'll help you",
        tool_calls=[{"name": "other_tool", "args": {"input": "test"}, "id": "1"}],
    )
    state = AgentState[Any](messages=[HumanMessage(content="Hello"), ai_message])
    result = middleware.after_model(state, Runtime())
    assert result is None

Domain

Subdomains

Frequently Asked Questions

What does test_human_in_the_loop_middleware_no_interrupts_needed() do?
test_human_in_the_loop_middleware_no_interrupts_needed() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_human_in_the_loop.py.
Where is test_human_in_the_loop_middleware_no_interrupts_needed() defined?
test_human_in_the_loop_middleware_no_interrupts_needed() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_human_in_the_loop.py at line 30.

Analyze Your Own Codebase

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

Try Supermodel Free