Agent¶
The Owlette agent is a Python Windows service that runs in the background, monitoring your processes, collecting system metrics, and syncing everything to the cloud. It's the core of the Owlette system — every machine you want to manage needs an agent installed.
What the Agent Does¶
| Function | Frequency | Description |
|---|---|---|
| Process monitoring | Every 5s | Checks if configured processes are running, detects crashes and stalls |
| Auto-restart | On crash | Restarts crashed processes using Task Scheduler or CreateProcessAsUser |
| Heartbeat | Every 30s | Marks the machine as online in Firestore |
| Metrics | Every 60s | Reports CPU, memory, disk, and GPU usage |
| Commands | Event-driven | Listens for and executes commands from the dashboard |
| Config sync | Event-driven | Syncs configuration changes between GUI, service, and cloud |
How It Runs¶
The agent runs as a Windows service managed by NSSM (Non-Sucking Service Manager). NSSM ensures the service starts automatically on boot and restarts on failure.
NSSM (Service Manager)
└── owlette_runner.py (Bridge)
└── owlette_service.py (Main Service Loop)
├── firebase_client.py (Cloud Sync)
│ ├── auth_manager.py (OAuth Tokens)
│ ├── firestore_rest_client.py (REST API)
│ └── connection_manager.py (State Machine)
├── shared_utils.py (Config, Logging, Metrics)
├── installer_utils.py (Remote Deployment)
├── health_probe.py (Health Monitoring)
├── process_launcher.py (Process Launch Strategy)
├── session_exec.py (User Session Execution)
└── project_utils.py (Project Distribution)
owlette_gui.py (Configuration GUI — separate process)
owlette_tray.py (System Tray Icon — separate process)
Service Lifecycle¶
Startup¶
- Initialize logging (RotatingFileHandler, 10 MB per file, 5 backups)
- Upgrade config schema if needed (automatic migration)
- Initialize Firebase client (lazy, soft-fail if no credentials)
- Recover running processes (adopt PIDs from previous session)
- Launch system tray icon as user process
- Enter main loop
Main Loop (every 5 seconds)¶
- Check all configured processes — detect crashes, stalls, exits
- Auto-restart any crashed processes (if autolaunch enabled)
- Process any pending commands from Firestore
- Check for Firebase state changes (enable/disable)
Shutdown¶
- Mark machine offline in Firestore
- Stop Firebase client and background threads
- Clean up resources
Key Directories¶
| Path | Contents |
|---|---|
C:\ProgramData\Owlette\ |
Installation root |
C:\ProgramData\Owlette\agent\src\ |
Python source code |
C:\ProgramData\Owlette\agent\config\ |
config.json and credentials |
C:\ProgramData\Owlette\logs\ |
Service and GUI log files |
C:\ProgramData\Owlette\python\ |
Embedded Python interpreter |
C:\ProgramData\Owlette\nssm\ |
NSSM service manager binary |
In This Section¶
- Installation — How to install the agent (automatic, remote, manual)
- Configuration — GUI tool, config.json, process settings
- Process Monitoring — State machine, crash detection, auto-restart
- System Tray — Tray icon behavior and menu
- Remote Commands — All commands the agent accepts
- Self-Update — Remote agent updates
- Troubleshooting — Common issues and log locations