Beer Can Labs
Contracts / createRun and the run lifecycle
Contract

createRun and the run lifecycle

Wake, run and stop an agent. Every wake path goes through createRun.

Signature

createRun(state: LandlordState, …)
// finishRun, blockRun, unblockRun, activeRun,
// deliverToMailbox, resetAgent, applyKillSwitch,
// reconcileRuns
type Runtime  // dockerRuntime, ecsRuntime

packages/landlord/src/lifecycle.ts ↗

Rules

  • Every wake path goes through createRun.
  • A replayed messageId returns the existing run with 200.
  • The functions take LandlordState; the queue pollers and the Timekeeper’s fire take createRun as a callback, so the package never imports the control plane.
  • A conformance test fails on a second copy of these rules.

Where it appears