def test_worker_hide_handoffs() -> None:
    """Test that the supervisor forwards a message to a specific agent and receives the correct response."""

    @tool
    def echo_tool(text: str) -> str:
        """Echo the input text."""
        return text

    expectations: list[list[dict[str, Any]]] = [
        [
            {
                "name": None,
                "content": "Scooby-dooby-doo",
                "tool_calls": None,
                "type": "human",
            }
        ],
        [
            {
                "name": None,
                "content": "Scooby-dooby-doo",
                "tool_calls": None,
                "type": "human",
            },
            {
                "name": "echo_agent",
                "content": "Echo 1!",
                "tool_calls": [],
                "type": "ai",
            },
            {"name": "supervisor", "content": "boo", "tool_calls": [], "type": "ai"},
            {
                "name": None,
                "content": "Huh take two?",
                "tool_calls": None,
                "type": "human",
            },
        ],
    ]

    echo_model = FakeChatModelWithAssertion(
        responses=[
            AIMessage(content="Echo 1!"),
            AIMessage(content="Echo 2!"),
        ],
        assertion=Expectations(expectations),
    )
    echo_agent = create_react_agent(
        model=echo_model.bind_tools([echo_tool]),
        tools=[echo_tool],
        name="echo_agent",
    )

    supervisor_messages = [
        AIMessage(
            content="",
            tool_calls=[
                {
                    "name": "transfer_to_echo_agent",
                    "args": {},
                    "id": "call_gyQSgJQm5jJtPcF5ITe8GGGF",
                    "type": "tool_call",
                }
            ],
        ),
        AIMessage(
            content="boo",
        ),
        AIMessage(
            content="",
            tool_calls=[
                {
                    "name": "transfer_to_echo_agent",
                    "args": {},
                    "id": "call_gyQSgJQm5jJtPcF5ITe8GGGG",
                    "type": "tool_call",
                }
            ],
        ),
        AIMessage(
            content="END",
        ),
    ]

    workflow = create_supervisor(
        [echo_agent],
        model=FakeChatModel(responses=supervisor_messages),
        add_handoff_messages=False,
    )
    app = workflow.compile()

    result = app.invoke({"messages": [HumanMessage(content="Scooby-dooby-doo")]})
    app.invoke({"messages": result["messages"] + [HumanMessage(content="Huh take two?")]})
Test that the supervisor forwards a message to a specific agent and receives the correct response.
tests/test_supervisor.py