Outcome lifecycle
Outcomes are state machines. Understanding settlement tells you exactly when events are accepted and when an outcome resolves.
States
An outcome is always in one of three states:
| State | Description |
|---|---|
OPEN | Accepting events. The success condition has not locked yet. |
CONFIRMED | The success condition locked true. Terminal state. |
FAILED | The condition became impossible or a window closed without success. Terminal state. |
Transitions
All transitions happen in one of three ways:
-
Create and events. You open the outcome with
POST /v1/outcomes, which snapshots the task contract. Then eachPOST /v1/eventsfor thatoutcome_keyis appended to the event log and the condition is re-evaluated. An outcome confirms as soon as its condition locks true. For a simple condition, that is the moment the event arrives. -
Settlement. A scheduled job runs every minute and resolves outcomes whose deadline has passed. The condition is evaluated at the deadline:
OPENbecomesCONFIRMEDif the condition is true, otherwiseFAILED. This is how time windows settle, for example "resolved and quiet for 24 hours". -
Early fail. Some events make a condition impossible. A condition with
NOT escalatedcan never be true again after anescalatedevent arrives. When that happens the outcome moves toFAILEDright away instead of waiting for the deadline.
When an outcome settles
A deadline comes from the condition itself. The G, F and IDLE operators each set one.
GandFwindows run from the moment the outcome opens.G(0,24h](...)sets a deadline 24 hours out.IDLEslides its deadline forward on every reset event, so the outcome settles a fixed time after the last one.IDLE(agent_turn, 5m)settles 5 minutes after the finalagent_turn.
A condition with no window and no IDLE never settles on its own. It stays OPEN until it locks true or becomes impossible. Add a window or an IDLE clause when you want a deadline. The longest any window can run is 180 days.
See Conditions for the full language.
Event submission rules
- Only
OPENoutcomes accept events. - Events for
CONFIRMEDorFAILEDoutcomes return202and are discarded. The outcome is not reopened. - For comparisons, the latest
properties.valuefor eachactionis used. - The condition is re-evaluated on every accepted event.