@@ -355,7 +355,7 @@ async def _finalize_and_return(result: RunResult) -> RunResult:
355355 f"Detected duplicate tool call loop: '{ call .name } ' called "
356356 f"{ repeat_count } times with identical arguments within "
357357 f"the last { self .config .duplicate_tool_call_window } "
358- f "tool calls: { call . arguments } "
358+ "tool calls with identical arguments. "
359359 ),
360360 steps_count = steps_count ,
361361 total_input_tokens = total_input_tokens ,
@@ -367,9 +367,7 @@ async def _finalize_and_return(result: RunResult) -> RunResult:
367367 raise DuplicateToolCallLoopError (call .name , repeat_count )
368368 return res
369369
370- logger .info (
371- "Executing tool '%s' with args: %s" , call .name , call .arguments
372- )
370+ logger .info ("Executing tool '%s'" , call .name )
373371 result = await self .registry .execute (
374372 call ,
375373 timeout_s = self .config .tool_timeout_s ,
@@ -392,7 +390,7 @@ async def _finalize_and_return(result: RunResult) -> RunResult:
392390 )
393391
394392 if self .trace is not None and hasattr (self .trace , "record" ):
395- with contextlib . suppress ( Exception ) :
393+ try :
396394 trace_record = StepTrace (
397395 run_id = run_id ,
398396 step_no = steps_count ,
@@ -405,6 +403,13 @@ async def _finalize_and_return(result: RunResult) -> RunResult:
405403 output_tokens = response .usage .output_tokens ,
406404 )
407405 await self .trace .record (trace_record )
406+ except Exception as exc :
407+ logger .warning (
408+ "Could not record tool trace (run_id=%s, step_no=%s): %s" ,
409+ run_id ,
410+ steps_count ,
411+ exc ,
412+ )
408413 else :
409414 # No tool calls: this is the final answer, a provider refusal, or
410415 # an empty completion. Only a non-empty answer is a success; the
0 commit comments