Scheduling put your agents on a clock. But some work cannot wait for the clock: it has to happen the instant something occurs. That is the other half of autonomy, the reflex, and it is what this short chapter adds.
9.16.1Scheduled is proactive, triggered is immediate
A scheduled agent asks, "is it time yet?" A triggered agent asks, "did the thing happen?"
The first is a heartbeat, steady and periodic. The second is a reflex, dormant until an event pokes it, then instant. A serious system has both: the heartbeat does the rounds, the reflex catches the fire the moment it starts.
9.16.2Some problems can't wait for the next sweep
A payment fails. A key expires. An error spikes. If your only mechanism is a schedule, the damage runs until the next tick fires.
Reflexes exist for exactly the events where the gap between "it happened" and "we responded" has to be near zero. You do not schedule a smoke detector to check for fire each morning; you wire it to react the instant there is smoke.
Here is the whole reflex on one event:
- An error lands in the ledger.
- The reflex wakes and pulls the real context: the stack trace, the recent changes, the live state.
- Safe and reversible? It makes the fix, proves it with a test, and ships it through review.
- Costs money or touches user data? It stops, files a decision card, and waits for you.
Investigating is always safe, so that part runs on its own; only the risky call waits for you.
9.16.3Triggers listen to the ledger
A reflex is an agent watching the event stream for one specific line. Something has to do the watching, and the simplest version is a small watcher on a tight loop. It reads new lines in the ledger every few seconds, and when a line matches, it runs the right agent.
Bigger setups let the tool that raised the alert, the automatic warning something is wrong, call a web address itself. The idea is the same, a rule that maps an event to an agent:
Watch out: the same event can arrive twice, and a reflex that fires twice can charge the customer twice. Have it mark the event handled before it acts. Have a scheduled job skip if its last run is still going. That way nothing ever runs on the same thing twice.
This is why the ledger comes first: without one honest stream of events, there is nothing to watch. With it, any event can become a trigger.
9.16.4Together they cover the whole clock
Heartbeat plus reflex is complete coverage of time. The scheduled agents handle the rhythm of the work, the routine that happens on a cadence. The triggered agents handle the surprises, the events that arrive on their own and demand a response now.
Between the two, nothing falls through: if it happens on a clock, the heartbeat has it; if it just happens, a reflex catches it.
Hint: reach for reflexes once you have a ledger and a few events that genuinely cannot wait for the next scheduled run.
9.16.5Wire your first reflex
This prompt gives your system its first reflex:
Do this now: paste the prompt and wire one reflex to the single event you would hate to catch a day late.