async def test_streaming_agent_functionality():
    """Test basic functionality of the streaming agent."""
    # Create mock config
    config = MagicMock()
    config.stream = True

    # Create mock providers
    llm_provider = MockLLMProvider(
        response_content="This is a test response",
        citations=[]
    )
    db_provider = MockDatabaseProvider()

    # Create mock search results collector
    search_results_collector = MockSearchResultsCollector({})

    # Create agent
    agent = MockR2RStreamingAgent(
        database_provider=db_provider,
        llm_provider=llm_provider,
        config=config,
        rag_generation_config=GenerationConfig(model="test/model")
    )

    # Set the search results collector
    agent.search_results_collector = search_results_collector

    # Test a simple query
    messages = [Message(role="user", content="Test query")]

    # Run the agent
    stream = agent.arun(messages=messages)
    output = await collect_stream_output(stream)

    # Verify response
    message_events = [line for line in output if 'event: message' in line]
    assert len(message_events) > 0, "Message event should be emitted"

    # Verify final answer
    final_answer_events = [line for line in output if 'event: agent.final_answer' in line]
    assert len(final_answer_events) > 0, "Final answer event should be emitted"

    # Verify done event
    done_events = [line for line in output if 'event: done' in line]
    assert len(done_events) > 0, "Done event should be emitted"
Test basic functionality of the streaming agent.
py/tests/unit/agent/test_agent_old.py