@@ -204,14 +204,14 @@ async def _build_prompts_to_run(
204204 logging .critical ("No last MCP tool result available" )
205205 raise
206206 except json .JSONDecodeError as exc :
207- logging .critical (f "Could not parse tool result as JSON: { last_mcp_tool_results [- 1 ][:200 ]} " )
207+ logging .critical ("Could not parse tool result as JSON: %s" , last_mcp_tool_results [- 1 ][:200 ])
208208 raise ValueError ("Tool result is not valid JSON" ) from exc
209209
210210 text = last_result .get ("text" , "" )
211211 try :
212212 iterable_result = json .loads (text )
213213 except json .JSONDecodeError as exc :
214- logging .critical (f "Could not parse result text: { text } " )
214+ logging .critical ("Could not parse result text: %s" , text )
215215 raise ValueError ("Result text is not valid JSON" ) from exc
216216 try :
217217 iter (iterable_result )
@@ -222,7 +222,7 @@ async def _build_prompts_to_run(
222222 if not iterable_result :
223223 await render_model_output ("** 🤖❗MCP tool result iterable is empty!\n " )
224224 else :
225- logging .debug (f "Rendering templated prompts for results: { iterable_result } " )
225+ logging .debug ("Rendering templated prompts for results: %s" , iterable_result )
226226 for value in iterable_result :
227227 try :
228228 rendered_prompt = render_template (
@@ -234,7 +234,7 @@ async def _build_prompts_to_run(
234234 )
235235 prompts_to_run .append (rendered_prompt )
236236 except jinja2 .TemplateError as e :
237- logging .error (f "Error rendering template for result { value } : { e } " )
237+ logging .error ("Error rendering template for result %s: %s" , value , e )
238238 raise ValueError (f"Template rendering failed: { e } " )
239239
240240 # Consume only after all prompts rendered successfully so that
@@ -429,7 +429,7 @@ async def deploy_task_agents(
429429
430430 except BackendMaxTurnsError as e :
431431 await render_model_output (f"** 🤖❗ Max Turns Reached: { e } \n " , async_task = async_task , task_id = task_id )
432- logging .exception (f "Exceeded max_turns: { max_turns } " )
432+ logging .exception ("Exceeded max_turns: %s" , max_turns )
433433 except BackendUnexpectedError as e :
434434 await render_model_output (f"** 🤖❗ Agent Exception: { e } \n " , async_task = async_task , task_id = task_id )
435435 logging .exception ("Agent Exception" )
@@ -625,7 +625,7 @@ async def on_handoff_hook(context: RunContextWrapper[TContext], agent: Agent[TCo
625625 inputs_dict = inputs ,
626626 )
627627 except jinja2 .TemplateError as e :
628- logging .error (f "Template rendering error: { e } " )
628+ logging .error ("Template rendering error: %s" , e )
629629 raise ValueError (f"Failed to render prompt template: { e } " ) from e
630630
631631 with TmpEnv (env , context = {"globals" : global_variables }):
@@ -707,7 +707,7 @@ async def _deploy(ra: dict, pp: str) -> bool:
707707 complete = True
708708 for result in task_results :
709709 if not isinstance (result , bool ):
710- logging .error (f "Caught exception in Gather: { result } " , exc_info = result )
710+ logging .error ("Caught exception in Gather: %s" , result , exc_info = result )
711711 result = False
712712 complete = result and complete
713713 return complete
@@ -740,13 +740,15 @@ async def _deploy(ra: dict, pp: str) -> bool:
740740 f"** 🤖🔄 Task { task_name !r} failed: { exc } \n "
741741 f"** 🤖🔄 Retrying in { backoff } s ({ remaining } attempts left)\n "
742742 )
743- logging .warning (f "Task { task_name !r } attempt { attempt + 1 } failed: { exc } " )
743+ logging .warning ("Task %r attempt %s failed: %s" , task_name , attempt + 1 , exc )
744744 await asyncio .sleep (backoff )
745745 else :
746- logging .error (f"Task { task_name !r} failed after { TASK_RETRY_LIMIT } attempts: { exc } " )
746+ logging .error (
747+ "Task %r failed after %s attempts: %s" , task_name , TASK_RETRY_LIMIT , exc
748+ )
747749 except Exception as exc :
748750 last_task_error = exc
749- logging .error (f "Task { task_name !r } failed (non-retriable): { exc } " )
751+ logging .error ("Task %r failed (non-retriable): %s" , task_name , exc )
750752 break
751753
752754 # If all retries exhausted with an exception, save and re-raise
0 commit comments