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:

StateDescription
OPENAccepting events. The success condition has not locked yet.
CONFIRMEDThe success condition locked true. Terminal state.
FAILEDThe condition became impossible or a window closed without success. Terminal state.

Transitions

All transitions happen in one of three ways:

  1. Create and events. You open the outcome with POST /v1/outcomes, which snapshots the task contract. Then each POST /v1/events for that outcome_key is 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.

  2. Settlement. A scheduled job runs every minute and resolves outcomes whose deadline has passed. The condition is evaluated at the deadline: OPEN becomes CONFIRMED if the condition is true, otherwise FAILED. This is how time windows settle, for example "resolved and quiet for 24 hours".

  3. Early fail. Some events make a condition impossible. A condition with NOT escalated can never be true again after an escalated event arrives. When that happens the outcome moves to FAILED right 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.

  • G and F windows run from the moment the outcome opens. G(0,24h](...) sets a deadline 24 hours out.
  • IDLE slides 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 final agent_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 OPEN outcomes accept events.
  • Events for CONFIRMED or FAILED outcomes return 202 and are discarded. The outcome is not reopened.
  • For comparisons, the latest properties.value for each action is used.
  • The condition is re-evaluated on every accepted event.

On this page