@@ -268,6 +268,77 @@ def list_messages(
268268 logger .info (message .as_dict ())
269269
270270
271+ @app .command ()
272+ def run_thread (
273+ agent_id : str = typer .Option (
274+ "agent_xxx" ,
275+ "--agent-id" ,
276+ "-a" ,
277+ help = "The ID of the agent to run" ,
278+ ),
279+ thread_id : str = typer .Option (
280+ "thread_xxx" ,
281+ "--thread-id" ,
282+ "-t" ,
283+ help = "The ID of the thread to run" ,
284+ ),
285+ verbose : bool = typer .Option (
286+ False ,
287+ "--verbose" ,
288+ "-v" ,
289+ help = "Enable verbose output" ,
290+ ),
291+ ):
292+ # Set up logging
293+ if verbose :
294+ logger .setLevel (logging .DEBUG )
295+
296+ logger .info ("Running thread..." )
297+
298+ project_client = AzureAiFoundryWrapper ().get_ai_project_client ()
299+ run = project_client .agents .runs .create (
300+ thread_id = thread_id ,
301+ agent_id = agent_id ,
302+ )
303+
304+ logger .info (f"Run created: { run .as_dict ()} " )
305+
306+
307+ @app .command ()
308+ def get_run (
309+ thread_id : str = typer .Option (
310+ "thread_xxx" ,
311+ "--thread-id" ,
312+ "-t" ,
313+ help = "The ID of the thread to run" ,
314+ ),
315+ run_id : str = typer .Option (
316+ "run_xxx" ,
317+ "--run-id" ,
318+ "-r" ,
319+ help = "The ID of the run to retrieve" ,
320+ ),
321+ verbose : bool = typer .Option (
322+ False ,
323+ "--verbose" ,
324+ "-v" ,
325+ help = "Enable verbose output" ,
326+ ),
327+ ):
328+ # Set up logging
329+ if verbose :
330+ logger .setLevel (logging .DEBUG )
331+
332+ logger .info ("Getting run..." )
333+
334+ project_client = AzureAiFoundryWrapper ().get_ai_project_client ()
335+ run = project_client .agents .runs .get (
336+ thread_id = thread_id ,
337+ run_id = run_id ,
338+ )
339+ logger .info (run .as_dict ())
340+
341+
271342if __name__ == "__main__" :
272343 load_dotenv (
273344 override = True ,
0 commit comments