Max Restarts
Prevent infinite restart loops by limiting how many times a supervisor will restart a failing agent.
Configuration
naos supervisor create main --strategy one-for-one --max-restarts 3
supervisors:
main:
strategy: one-for-one
maxRestarts: 3
restartWindow: 60 # seconds
How It Works
The supervisor counts restarts within the restart window:
Time 0s: Agent fails → Restart 1/3
Time 10s: Agent fails → Restart 2/3
Time 20s: Agent fails → Restart 3/3 (max reached)
Time 25s: Agent fails → NOT restarted, marked as failed
Restart Window
The restart window determines the time period for counting restarts. After the window expires, the count resets.
Window: 60 seconds, Max: 3
Time 0s: Agent fails → Restart 1/3
Time 10s: Agent fails → Restart 2/3
Time 70s: Agent fails → Restart 1/3 (window reset!)
Defaults
| Setting | Default |
|---|---|
| maxRestarts | 3 |
| restartWindow | 60 seconds |
What Happens at Max
When max restarts is reached:
- The agent is marked as
failed - The supervisor logs the event
- The agent is NOT restarted again
- An audit entry is created
naos supervisor status main
# Children:
# worker-1 ● running 0 restarts
# worker-2 ✗ failed 3 restarts (max reached)