@@ -254,44 +254,6 @@ def generate_next_action(self, instruction: str, obs: Dict) -> Tuple[Dict, List]
254254 generator_message += f"Step { i + 1 } : \n { action } \n "
255255 generator_message += "\n "
256256
257- # Save code agent result to text file
258- try :
259- import os
260- from datetime import datetime
261-
262- # Create logs directory if it doesn't exist
263- logs_dir = "logs"
264- if not os .path .exists (logs_dir ):
265- os .makedirs (logs_dir )
266-
267- # Generate filename with timestamp
268- timestamp = datetime .now ().strftime ("%Y%m%d_%H%M%S" )
269- filename = (
270- f"logs/code_agent_result_step_{ self .turn_count + 1 } _{ timestamp } .txt"
271- )
272-
273- with open (filename , "w" ) as f :
274- f .write (f"CODE AGENT RESULT - Step { self .turn_count + 1 } \n " )
275- f .write (f"Timestamp: { datetime .now ().isoformat ()} \n " )
276- f .write (
277- f"Task/Subtask Instruction: { code_result ['task_instruction' ]} \n "
278- )
279- f .write (f"Steps Completed: { code_result ['steps_executed' ]} \n " )
280- f .write (f"Max Steps: { code_result ['budget' ]} \n " )
281- f .write (f"Completion Reason: { code_result ['completion_reason' ]} \n " )
282- f .write (f"Summary: { code_result ['summary' ]} \n " )
283- if code_result ["execution_history" ]:
284- f .write (f"\n Execution History:\n " )
285- for i , step in enumerate (code_result ["execution_history" ]):
286- f .write (f"\n Step { i + 1 } :\n " )
287- f .write (f"Action: { step ['action' ]} \n " )
288- if "thoughts" in step :
289- f .write (f"Thoughts: { step ['thoughts' ]} \n " )
290-
291- logger .info (f"Code agent result saved to: { filename } " )
292- except Exception as e :
293- logger .error (f"Failed to save code agent result to file: { e } " )
294-
295257 # Log the code agent result section for debugging (truncated execution history)
296258 log_message = f"\n CODE AGENT RESULT:\n "
297259 log_message += (
0 commit comments