Monitor-Poll Loop
The agent watches an external process it cannot control (CI, deploy, long job) by polling on a cadence matched to the process's rate of change, acting only on state transitions.
When to use
CI runs, deployments, external queues: anywhere the agent waits on the world.
Steps
| Step | What happens | Verification |
|---|---|---|
| Observe | Query current state through the real interface, not cached assumptions. | State read from the source of truth with a timestamp. |
| Compare and decide | Act only on transitions; unchanged state means wait. | Action log shows transitions, not repeated reactions to the same state. |
| Wait or escalate | Sleep the cadence interval; escalate if the process exceeds its expected duration. | A maximum-wait bound exists; infinite patience is unbounded risk. |
Specification
| Verification method | The external process's own status is the ground truth. |
|---|---|
| Recovery behavior | escalate-on-timeout |
| Observability | Poll log with states and timestamps. |
| Inputs | Observable process, Cadence, Duration bound |
| Outputs | Timely reaction to completion or failure |
| Risk level / maturity | low / established |
Failure modes
- Polling faster than the process changes burns budget
- No duration bound means hung processes hang the agent
- Acting on stale cached state
Assessment
Mundane and universally needed. The cadence decision is the craft: match it to how fast the watched thing actually changes, and always carry a timeout.