async def test_conversation_message_includes_citation_metadata(mock_streaming_agent):
    """Test that conversation messages include citation metadata."""
    with patch.object(mock_streaming_agent.conversation, 'add_message', wraps=mock_streaming_agent.conversation.add_message) as mock_add_message:
        messages = [Message(role="user", content="Test query")]

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

        # Check that add_message was called with citation metadata
        citation_calls = 0
        for call in mock_add_message.call_args_list:
            args, kwargs = call
            if args and isinstance(args[0], Message):
                message = args[0]
                if message.role == 'assistant' and message.metadata and 'citations' in message.metadata:
                    citation_calls += 1

        assert citation_calls > 0, "At least one assistant message should include citation metadata"
Test that conversation messages include citation metadata.
py/tests/unit/agent/test_agent_citations_old.py