@@ -1004,12 +1004,14 @@ def _parse_llm_response(self, response: str) -> Dict[str, Any]:
10041004 f"str or dict, got { type (arguments_raw ).__name__ } "
10051005 )
10061006
1007- parsed_calls .append ({
1008- "thought" : "" ,
1009- "goal" : "" ,
1010- "tool" : name ,
1011- "tool_args" : tool_args ,
1012- })
1007+ parsed_calls .append (
1008+ {
1009+ "thought" : "" ,
1010+ "goal" : "" ,
1011+ "tool" : name ,
1012+ "tool_args" : tool_args ,
1013+ }
1014+ )
10131015 logger .debug (
10141016 "[PARSE] Native tool_calls: returning %d parsed calls" ,
10151017 len (parsed_calls ),
@@ -2573,7 +2575,7 @@ def process_query(
25732575 "This agent prefers either a single tool call per response, "
25742576 "or a structured JSON 'plan' containing an ordered array of steps. "
25752577 "Please either: (A) output a single tool call JSON object, "
2576- " or (B) output a JSON plan in the format: {\ " plan\ " : [{\ " tool\ " : \ " name\ " , \ " tool_args\ " : {...}}]}. "
2578+ ' or (B) output a JSON plan in the format: {"plan": [{"tool": "name", "tool_args": {...}}]}. '
25772579 "If you don't need to call a tool, answer in plain text."
25782580 ),
25792581 }
@@ -2601,7 +2603,9 @@ def process_query(
26012603 # sequentially in this same LLM turn (one LLM turn -> N tool turns).
26022604 if isinstance (parsed , list ):
26032605 # Record assistant turn containing multiple tool_calls
2604- conversation .append ({"role" : "assistant" , "content" : {"tool_calls" : parsed }})
2606+ conversation .append (
2607+ {"role" : "assistant" , "content" : {"tool_calls" : parsed }}
2608+ )
26052609 # Preserve raw assistant response for history
26062610 messages .append ({"role" : "assistant" , "content" : response })
26072611
@@ -2611,7 +2615,9 @@ def process_query(
26112615
26122616 tool_name = call ["tool" ]
26132617 tool_args = call ["tool_args" ]
2614- logger .debug (f"Sequential native tool call: { tool_name } { tool_args } " )
2618+ logger .debug (
2619+ f"Sequential native tool call: { tool_name } { tool_args } "
2620+ )
26152621
26162622 # Display the tool call in real-time
26172623 self .console .print_tool_usage (tool_name )
@@ -2658,11 +2664,19 @@ def process_query(
26582664 self .console .pretty_print_json (tool_result , "Result" )
26592665 self .console .print_tool_complete ()
26602666
2661- previous_outputs .append ({"tool" : tool_name , "args" : tool_args , "result" : truncated_result })
2667+ previous_outputs .append (
2668+ {
2669+ "tool" : tool_name ,
2670+ "args" : tool_args ,
2671+ "result" : truncated_result ,
2672+ }
2673+ )
26622674 step_results .append (tool_result )
26632675
26642676 # Share tool output with subsequent LLM calls
2665- messages .append (self ._create_tool_message (tool_name , truncated_result ))
2677+ messages .append (
2678+ self ._create_tool_message (tool_name , truncated_result )
2679+ )
26662680
26672681 # Error handling
26682682 is_error = isinstance (tool_result , dict ) and (
@@ -2681,7 +2695,9 @@ def process_query(
26812695 or tool_result .get ("suggested_fix" )
26822696 or f"Command failed with return code { tool_result .get ('return_code' )} "
26832697 )
2684- logger .warning (f"Tool execution error in sequential calls (count: { error_count } ): { last_error } " )
2698+ logger .warning (
2699+ f"Tool execution error in sequential calls (count: { error_count } ): { last_error } "
2700+ )
26852701 if not tool_result .get ("error_displayed" ):
26862702 self .console .print_error (last_error )
26872703 self .execution_state = self .STATE_ERROR_RECOVERY
0 commit comments