Test trace_agent_invocation sets span attributes correctly.
(mock_span_fixture)
| 129 | |
| 130 | @pytest.mark.asyncio |
| 131 | async def test_trace_agent_invocation(mock_span_fixture): |
| 132 | """Test trace_agent_invocation sets span attributes correctly.""" |
| 133 | agent = LlmAgent(name='test_llm_agent', model='gemini-pro') |
| 134 | agent.description = 'Test agent description' |
| 135 | invocation_context = await _create_invocation_context(agent) |
| 136 | |
| 137 | trace_agent_invocation(mock_span_fixture, agent, invocation_context) |
| 138 | |
| 139 | expected_calls = [ |
| 140 | mock.call('gen_ai.operation.name', 'invoke_agent'), |
| 141 | mock.call('gen_ai.agent.description', agent.description), |
| 142 | mock.call('gen_ai.agent.name', agent.name), |
| 143 | mock.call( |
| 144 | 'gen_ai.conversation.id', |
| 145 | invocation_context.session.id, |
| 146 | ), |
| 147 | ] |
| 148 | mock_span_fixture.set_attribute.assert_has_calls( |
| 149 | expected_calls, any_order=True |
| 150 | ) |
| 151 | assert mock_span_fixture.set_attribute.call_count == len(expected_calls) |
| 152 | |
| 153 | |
| 154 | @pytest.mark.asyncio |
nothing calls this directly
no test coverage detected