INNER CODE UNIT · Python

_check_heartbeat_age

Dicklesworthstone/claude_code_agent_farm · claude_code_agent_farm.py:512

    def _check_heartbeat_age(self, agent_id: int) -> Optional[float]:
        """Check age of heartbeat file in seconds"""
        if not self.heartbeats_dir:
            return None
        
        heartbeat_file = self.heartbeats_dir / f"agent{agent_id:02d}.heartbeat"
        if not heartbeat_file.exists():
            return None
        
        try:
            mtime = heartbeat_file.stat().st_mtime
            age = time.time() - mtime
            return age
        except Exception:
            return None
    
    def needs_restart(self, agent_id: int) -> Optional[str]:
        """Determine if an agent needs to be restarted and why

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…