async def test_workflow_requires_root_agent():
    """Test that workflow requires exactly one root agent."""
    with pytest.raises(ValueError, match="Exactly one root agent must be provided"):
        AgentWorkflow(
            agents=[
                FunctionAgent(
                    name="agent1",
                    description="test",
                    llm=MockLLM(
                        responses=[
                            ChatMessage(role=MessageRole.ASSISTANT, content="test"),
                        ]
                    ),
                ),
                ReActAgent(
                    name="agent2",
                    description="test",
                    llm=MockLLM(
                        responses=[
                            ChatMessage(role=MessageRole.ASSISTANT, content="test"),
                        ]
                    ),
                ),
            ]
        )
Test that workflow requires exactly one root agent.
llama-index-core/tests/agent/workflow/test_multi_agent_workflow.py