Pause the agent using psutil for cross-platform support. Returns: Tuple of (success, message)
(self)
| 441 | return False, f"Failed to stop agent: {e}" |
| 442 | |
| 443 | async def pause(self) -> tuple[bool, str]: |
| 444 | """ |
| 445 | Pause the agent using psutil for cross-platform support. |
| 446 | |
| 447 | Returns: |
| 448 | Tuple of (success, message) |
| 449 | """ |
| 450 | if not self.process or self.status != "running": |
| 451 | return False, "Agent is not running" |
| 452 | |
| 453 | try: |
| 454 | proc = psutil.Process(self.process.pid) |
| 455 | proc.suspend() |
| 456 | self.status = "paused" |
| 457 | return True, "Agent paused" |
| 458 | except psutil.NoSuchProcess: |
| 459 | self.status = "crashed" |
| 460 | self._remove_lock() |
| 461 | return False, "Agent process no longer exists" |
| 462 | except Exception as e: |
| 463 | logger.exception("Failed to pause agent") |
| 464 | return False, f"Failed to pause agent: {e}" |
| 465 | |
| 466 | async def resume(self) -> tuple[bool, str]: |
| 467 | """ |
no test coverage detected