File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -133,14 +133,16 @@ async def _run_agent(
133133 )
134134
135135 await client .create_session (initial_state )
136- await client .run_async ()
137136 try :
138- session_json_path = os .path .join (session_dir , "session.json" )
139- with open (session_json_path , "w" ) as f :
140- json .dump (client .get_session_data (), f , indent = 2 )
141- logger .info (f"Saved session data to { session_json_path } " )
142- except Exception as se :
143- logger .warning (f"Failed to save session data for { node_id } : { se } " )
137+ await client .run_async ()
138+ finally :
139+ try :
140+ session_json_path = os .path .join (session_dir , "session.json" )
141+ with open (session_json_path , "w" ) as f :
142+ json .dump (client .get_session_data (), f , indent = 2 )
143+ logger .info (f"Saved session data to { session_json_path } " )
144+ except Exception as se :
145+ logger .warning (f"Failed to save session data for { node_id } : { se } " )
144146 return client .get_state ()
145147
146148 def _process_results (
You can’t perform that action at this time.
0 commit comments