Infrastructure · Primitives

TaskLifecycle

Formal state machine governing task progression

Definition

Mechanism

Explicit StateTransition machine governing Task progression through five states: PENDING (created, awaiting assignment), ASSIGNED (claimed by an Agent), RUNNING (actively executing, emitting Heartbeat), COMPLETED (successfully finished, Result attached), FAILED (terminated with Exception, retry decision required). Each transition requires a typed Event: assign, start, complete, fail, cancel. Invalid transitions are rejected. RUNNING state requires periodic Heartbeat; timeout triggers automatic FAILED transition. The attached Risk profile informs retry and escalation policy on failure.

Preconditions

  1. Task exists in PENDING state

Postconditions

  1. Task in terminal state (COMPLETED, FAILED, or CANCELLED)

Invariants

  1. Forward-Only: Tasks must not regress (no COMPLETED to RUNNING via StateTransition)
  2. Single Owner: Exactly one Agent owns a Task in ASSIGNED or RUNNING state
  3. FAILED tasks must include an Exception describing the failure
  4. RUNNING tasks must emit Heartbeat within configured interval

Risks

Failure modes

  1. Heartbeat timeout (agent dies silently — task stuck in RUNNING without timeout enforcement).

  2. State desync (two agents believe they own the same task due to network partition).

  3. Zombie tasks (FAILED tasks never retried or escalated — accumulate in queue).

Relationships

Builds on

Composes with

References

Mind

Agent

Autonomous Goal-Directed Entity

Event

Discrete temporal occurrence

Heartbeat

Liveness detection via periodic signals

Risk

Quantified potential for negative outcome

Task

The atomic unit of intent

Yields

Result

The output of agentic transformation

Nothing in this library builds on this pattern yet.

Reference

Parameters

heartbeat_interval_seconds Integer, [5, 300]
Maximum seconds between heartbeats before RUNNING task is marked FAILED

Signature

  • StateTransition(Task)

Identity

Ref
TaskLifecycle#5591
Sema ID
sema:TaskLifecycle#mh:SHA-256:559124d595219af971fe018e4709077bbe77f3ce7e1769a058cbeffd4a11c38b
Ring
1
Tier
1
Updated
2026-11-11
Supersedes
  • sema:TaskLifecycle#mh:SHA-256:ecd8d6da7668a91bd65d1b20beaf58e8e300f418cb40d00a3453535dfb4bedda
  • sema:TaskLifecycle#mh:SHA-256:3a3ece262c27914b8ff68afdf259cff4f046bf495558a190a43e32d6ee7dd5b8
  • sema:TaskLifecycle#mh:SHA-256:d935155779f500df5554666848f4360d5eba80b106a40b7a4580ce848f420d33
  • sema:TaskLifecycle#mh:SHA-256:6fdd40efd45e106daf0135bb05976d13856a62e681099cfe9b465bf13bd1260d
  • sema:TaskLifecycle#mh:SHA-256:efdc92e2f37217c2a4e04fc94850993dfb6dc3b68458abedd2be1d0c68897cd6