@@ -197,14 +197,14 @@ async def _build_prompts_to_run(
197197 logging .critical ("No last MCP tool result available" )
198198 raise
199199 except json .JSONDecodeError as exc :
200- logging .critical (f "Could not parse tool result as JSON: { last_mcp_tool_results [- 1 ][:200 ]} " )
200+ logging .critical ("Could not parse tool result as JSON: %s" , last_mcp_tool_results [- 1 ][:200 ])
201201 raise ValueError ("Tool result is not valid JSON" ) from exc
202202
203203 text = last_result .get ("text" , "" )
204204 try :
205205 iterable_result = json .loads (text )
206206 except json .JSONDecodeError as exc :
207- logging .critical (f "Could not parse result text: { text } " )
207+ logging .critical ("Could not parse result text: %s" , text )
208208 raise ValueError ("Result text is not valid JSON" ) from exc
209209 try :
210210 iter (iterable_result )
@@ -215,7 +215,7 @@ async def _build_prompts_to_run(
215215 if not iterable_result :
216216 await render_model_output ("** 🤖❗MCP tool result iterable is empty!\n " )
217217 else :
218- logging .debug (f "Rendering templated prompts for results: { iterable_result } " )
218+ logging .debug ("Rendering templated prompts for results: %s" , iterable_result )
219219 for value in iterable_result :
220220 try :
221221 rendered_prompt = render_template (
@@ -227,7 +227,7 @@ async def _build_prompts_to_run(
227227 )
228228 prompts_to_run .append (rendered_prompt )
229229 except jinja2 .TemplateError as e :
230- logging .error (f "Error rendering template for result { value } : { e } " )
230+ logging .error ("Error rendering template for result %s: %s" , value , e )
231231 raise ValueError (f"Template rendering failed: { e } " )
232232
233233 # Consume only after all prompts rendered successfully so that
@@ -408,15 +408,15 @@ async def _run_streamed() -> None:
408408 rate_limit_backoff = MAX_RATE_LIMIT_BACKOFF
409409 else :
410410 rate_limit_backoff += rate_limit_backoff
411- logging .exception (f "Hit rate limit ... holding for { rate_limit_backoff } " )
411+ logging .exception ("Hit rate limit ... holding for %s" , rate_limit_backoff )
412412 await asyncio .sleep (rate_limit_backoff )
413413
414414 await _run_streamed ()
415415 complete = True
416416
417417 except MaxTurnsExceeded as e :
418418 await render_model_output (f"** 🤖❗ Max Turns Reached: { e } \n " , async_task = async_task , task_id = task_id )
419- logging .exception (f "Exceeded max_turns: { max_turns } " )
419+ logging .exception ("Exceeded max_turns: %s" , max_turns )
420420 except AgentsException as e :
421421 await render_model_output (f"** 🤖❗ Agent Exception: { e } \n " , async_task = async_task , task_id = task_id )
422422 logging .exception ("Agent Exception" )
@@ -576,7 +576,7 @@ async def on_handoff_hook(context: RunContextWrapper[TContext], agent: Agent[TCo
576576 inputs_dict = inputs ,
577577 )
578578 except jinja2 .TemplateError as e :
579- logging .error (f "Template rendering error: { e } " )
579+ logging .error ("Template rendering error: %s" , e )
580580 raise ValueError (f"Failed to render prompt template: { e } " ) from e
581581
582582 with TmpEnv (env ):
@@ -657,7 +657,7 @@ async def _deploy(ra: dict, pp: str) -> bool:
657657 complete = True
658658 for result in task_results :
659659 if isinstance (result , Exception ):
660- logging .error (f "Caught exception in Gather: { result } " )
660+ logging .error ("Caught exception in Gather: %s" , result )
661661 result = False
662662 complete = result and complete
663663 return complete
@@ -690,13 +690,13 @@ async def _deploy(ra: dict, pp: str) -> bool:
690690 f"** 🤖🔄 Task { task_name !r} failed: { exc } \n "
691691 f"** 🤖🔄 Retrying in { backoff } s ({ remaining } attempts left)\n "
692692 )
693- logging .warning (f "Task { task_name !r } attempt { attempt + 1 } failed: { exc } " )
693+ logging .warning ("Task %r attempt %s failed: %s" , task_name , attempt + 1 , exc )
694694 await asyncio .sleep (backoff )
695695 else :
696- logging .error (f "Task { task_name !r } failed after { TASK_RETRY_LIMIT } attempts: { exc } " )
696+ logging .error ("Task %r failed after %s attempts: %s" , task_name , TASK_RETRY_LIMIT , exc )
697697 except Exception as exc :
698698 last_task_error = exc
699- logging .error (f "Task { task_name !r } failed (non-retriable): { exc } " )
699+ logging .error ("Task %r failed (non-retriable): %s" , task_name , exc )
700700 break
701701
702702 # If all retries exhausted with an exception, save and re-raise
0 commit comments