Home / Class/ TestCommandResumeDisallowed Class — langchain Architecture

TestCommandResumeDisallowed Class — langchain Architecture

Architecture documentation for the TestCommandResumeDisallowed class in test_wrap_model_call_state_update.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  f394727c_2dd7_5611_dc5c_e45213fceb3e["TestCommandResumeDisallowed"]
  949c7cf4_56fe_f3b4_cd89_9631a7e9cb1e["AgentMiddleware"]
  f394727c_2dd7_5611_dc5c_e45213fceb3e -->|extends| 949c7cf4_56fe_f3b4_cd89_9631a7e9cb1e
  08361e76_a995_1e57_f200_e292474e2f00["test_wrap_model_call_state_update.py"]
  f394727c_2dd7_5611_dc5c_e45213fceb3e -->|defined in| 08361e76_a995_1e57_f200_e292474e2f00
  d4eb17da_4793_52cf_fcf9_26f3e584e89a["test_command_resume_raises_not_implemented()"]
  f394727c_2dd7_5611_dc5c_e45213fceb3e -->|method| d4eb17da_4793_52cf_fcf9_26f3e584e89a
  4b256c1c_befc_80c9_88f0_dc0b1defc3b3["test_async_command_resume_raises_not_implemented()"]
  f394727c_2dd7_5611_dc5c_e45213fceb3e -->|method| 4b256c1c_befc_80c9_88f0_dc0b1defc3b3

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call_state_update.py lines 828–871

class TestCommandResumeDisallowed:
    """Test that Command resume raises NotImplementedError in wrap_model_call."""

    def test_command_resume_raises_not_implemented(self) -> None:
        """Command with resume in wrap_model_call raises NotImplementedError."""

        class ResumeMiddleware(AgentMiddleware):
            def wrap_model_call(
                self,
                request: ModelRequest,
                handler: Callable[[ModelRequest], ModelResponse],
            ) -> ExtendedModelResponse:
                response = handler(request)
                return ExtendedModelResponse(
                    model_response=response,
                    command=Command(resume="some_value"),
                )

        model = GenericFakeChatModel(messages=iter([AIMessage(content="Hello!")]))
        agent = create_agent(model=model, middleware=[ResumeMiddleware()])

        with pytest.raises(NotImplementedError, match="Command resume is not yet supported"):
            agent.invoke({"messages": [HumanMessage(content="Hi")]})

    async def test_async_command_resume_raises_not_implemented(self) -> None:
        """Async: Command with resume in wrap_model_call raises NotImplementedError."""

        class AsyncResumeMiddleware(AgentMiddleware):
            async def awrap_model_call(
                self,
                request: ModelRequest,
                handler: Callable[[ModelRequest], Awaitable[ModelResponse]],
            ) -> ExtendedModelResponse:
                response = await handler(request)
                return ExtendedModelResponse(
                    model_response=response,
                    command=Command(resume="some_value"),
                )

        model = GenericFakeChatModel(messages=iter([AIMessage(content="Hello!")]))
        agent = create_agent(model=model, middleware=[AsyncResumeMiddleware()])

        with pytest.raises(NotImplementedError, match="Command resume is not yet supported"):
            await agent.ainvoke({"messages": [HumanMessage(content="Hi")]})

Extends

Frequently Asked Questions

What is the TestCommandResumeDisallowed class?
TestCommandResumeDisallowed is a class in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call_state_update.py.
Where is TestCommandResumeDisallowed defined?
TestCommandResumeDisallowed is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_model_call_state_update.py at line 828.
What does TestCommandResumeDisallowed extend?
TestCommandResumeDisallowed extends AgentMiddleware.

Analyze Your Own Codebase

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

Try Supermodel Free