@@ -310,29 +310,9 @@ def test_langchain_agent(
310310 assert chat_spans [1 ]["data" ][SPANDATA .GEN_AI_RESPONSE_FINISH_REASONS ] == ["stop" ]
311311
312312 # Verify that available tools are always recorded regardless of PII settings
313- tools_found = False
314313 for chat_span in chat_spans :
315- span_data = chat_span .get ("data" , {})
316- if SPANDATA .GEN_AI_REQUEST_AVAILABLE_TOOLS in span_data :
317- tools_found = True
318- tools_data = span_data [SPANDATA .GEN_AI_REQUEST_AVAILABLE_TOOLS ]
319- assert tools_data is not None , (
320- "Available tools should always be recorded regardless of PII settings"
321- )
322-
323- if isinstance (tools_data , str ):
324- # If serialized as string, should contain tool name
325- assert "get_word_length" in tools_data
326- else :
327- # If still a list, verify structure
328- assert len (tools_data ) >= 1
329- names = [
330- tool .get ("name" ) for tool in tools_data if isinstance (tool , dict )
331- ]
332- assert "get_word_length" in names
333-
334- # Ensure we found at least one span with tools data
335- assert tools_found , "No spans found with tools data"
314+ tools_data = chat_span ["data" ][SPANDATA .GEN_AI_REQUEST_AVAILABLE_TOOLS ]
315+ assert "get_word_length" in tools_data
336316
337317
338318def test_langchain_error (sentry_init , capture_events ):
0 commit comments