advanced practice · coding

Implement a bounded agent run lifecycle

Implement transitionRun(state, event). Valid states are queued, running, checking, complete, blocked, cancelled. start moves queued to running only when event.ready is true; submit moves running to checking; accept moves checking to complete only when event.evidenceCount is positive; reject moves checking back to running when budget remains and to blocked otherwise; cancel moves any non-terminal state to cancelled. Invalid transitions must throw.

The mechanism

An autonomous run is a finite-state machine with an owner and a budget. It starts only after prerequisites are ready, progresses through durable states, renews authority while healthy, and terminates as complete, failed, cancelled, or escalated. 'Keep trying' is not a lifecycle state.

Study Agent Run Lifecycle

Expected evidence

A finite-state lifecycle whose completion and retry transitions require evidence and remaining authority.

Try this drill in the practice workspace →

Hints when you need them
  • Terminal states must never silently restart.
  • A failed check without remaining budget is an escalation, not another retry.

Watch for these mistakes

  • Using a timer as the only stop condition
  • Marking complete when commands ran rather than when the objective is satisfied
  • Retrying permanent or authorization failures as if they were transient

Check the sources

Browse all practice briefs