Opening an anticipator
Register the protective actions it may choose between, and (optionally) tune its timing window.Teaching it the rhythm — disturbance
Call disturbance(t) each time the disturbance actually occurs, passing the time
(in seconds) it happened. After min_events observations it locks onto the period.
ready flips to True once it has learned enough to act on.
Recording what worked — outcome
When you deploy a protective action, tell the anticipator whether it saved the
outcome. This is how it learns which action is best; over time best_action
reflects what actually protects you.
The decision — protect
Ask, at a given time t, whether to protect right now:
protect() returns a ProtectResult. The
predicted time of the next hit, the period, and the confidence are withheld so
the rhythm model can’t be reconstructed — you get the actionable answer only.
Inspecting and closing
A full anticipation loop
The anticipator and a token session compose cleanly: run a
session to govern task progress while an anticipator guards against a periodic
disturbance in the same loop. See
Building deep.
Next
Usage & metering
Every call is counted — read it back.
Building deep
Control-loop integration, rate limits, and error handling.