@@ -38,7 +38,6 @@ def _make_handler(self) -> TelemetryHandler:
3838
3939
4040class TestAgentInvocationHandler (_AgentTestBase ):
41-
4241 def test_start_stop_creates_span (self ) -> None :
4342 handler = self ._make_handler ()
4443 invocation = AgentInvocation (
@@ -59,31 +58,18 @@ def test_start_stop_creates_span(self) -> None:
5958 self .assertEqual (
6059 span .attributes [GenAI .GEN_AI_AGENT_NAME ], "Math Tutor"
6160 )
62- self .assertEqual (
63- span .attributes [GenAI .GEN_AI_PROVIDER_NAME ], "openai"
64- )
65- self .assertEqual (
66- span .attributes [GenAI .GEN_AI_REQUEST_MODEL ], "gpt-4"
67- )
61+ self .assertEqual (span .attributes [GenAI .GEN_AI_PROVIDER_NAME ], "openai" )
62+ self .assertEqual (span .attributes [GenAI .GEN_AI_REQUEST_MODEL ], "gpt-4" )
6863
6964 def test_span_kind_client_by_default (self ) -> None :
7065 handler = self ._make_handler ()
71- invocation = AgentInvocation (agent_name = "Agent" , is_remote = True )
66+ invocation = AgentInvocation (agent_name = "Agent" )
7267 handler .start_agent (invocation )
7368 handler .stop_agent (invocation )
7469 self .assertEqual (
7570 self .span_exporter .get_finished_spans ()[0 ].kind , SpanKind .CLIENT
7671 )
7772
78- def test_span_kind_internal_for_local (self ) -> None :
79- handler = self ._make_handler ()
80- invocation = AgentInvocation (agent_name = "Agent" , is_remote = False )
81- handler .start_agent (invocation )
82- handler .stop_agent (invocation )
83- self .assertEqual (
84- self .span_exporter .get_finished_spans ()[0 ].kind , SpanKind .INTERNAL
85- )
86-
8773 def test_all_attributes (self ) -> None :
8874 handler = self ._make_handler ()
8975 invocation = AgentInvocation (
@@ -114,9 +100,7 @@ def test_all_attributes(self) -> None:
114100 attrs = self .span_exporter .get_finished_spans ()[0 ].attributes
115101 self .assertEqual (attrs [GenAI .GEN_AI_AGENT_NAME ], "Full Agent" )
116102 self .assertEqual (attrs [GenAI .GEN_AI_AGENT_ID ], "agent-123" )
117- self .assertEqual (
118- attrs [GenAI .GEN_AI_AGENT_DESCRIPTION ], "A test agent"
119- )
103+ self .assertEqual (attrs [GenAI .GEN_AI_AGENT_DESCRIPTION ], "A test agent" )
120104 self .assertEqual (attrs [GenAI .GEN_AI_RESPONSE_MODEL ], "gpt-4-0613" )
121105 self .assertEqual (attrs [GenAI .GEN_AI_RESPONSE_ID ], "resp-abc" )
122106 self .assertEqual (attrs [GenAI .GEN_AI_USAGE_INPUT_TOKENS ], 100 )
@@ -142,9 +126,7 @@ def test_cache_token_attributes(self) -> None:
142126 self .assertEqual (
143127 attrs [GenAI .GEN_AI_USAGE_CACHE_CREATION_INPUT_TOKENS ], 25
144128 )
145- self .assertEqual (
146- attrs [GenAI .GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS ], 50
147- )
129+ self .assertEqual (attrs [GenAI .GEN_AI_USAGE_CACHE_READ_INPUT_TOKENS ], 50 )
148130
149131 def test_fail_sets_error_status (self ) -> None :
150132 handler = self ._make_handler ()
@@ -179,8 +161,9 @@ def test_context_manager_error(self) -> None:
179161 raise ValueError ("test error" )
180162
181163 self .assertEqual (
182- self .span_exporter .get_finished_spans ()[0 ]
183- .attributes .get ("error.type" ),
164+ self .span_exporter .get_finished_spans ()[0 ].attributes .get (
165+ "error.type"
166+ ),
184167 "ValueError" ,
185168 )
186169
@@ -209,14 +192,12 @@ def test_fail_without_start_is_noop(self) -> None:
209192
210193
211194class TestAgentInvocationType (TestCase ):
212-
213195 def test_defaults (self ) -> None :
214196 inv = AgentInvocation ()
215197 self .assertEqual (inv .operation_name , "invoke_agent" )
216198 self .assertIsNone (inv .agent_name )
217199 self .assertIsNone (inv .provider )
218200 self .assertIsNone (inv .request_model )
219- self .assertTrue (inv .is_remote )
220201 self .assertEqual (inv .input_messages , [])
221202 self .assertEqual (inv .output_messages , [])
222203 self .assertIsNone (inv .tool_definitions )
0 commit comments