Agent runtime

Task Lifecycle

The defined states an AI agent task moves through — received, in-progress, awaiting-approval, completed, failed, expired — and the events that drive each transition.

Operating principle

Production AI is not a prompt. It is a system of context, tools, permissions, traces, evals, and feedback loops.

What it is

The task lifecycle is the explicit state machine for an agent task. Instead of treating tasks as 'fire and forget,' the runtime tracks every task through defined states: received, in-progress, awaiting-approval, awaiting-tool, completed, failed, cancelled, expired. Each transition is logged. Each state has expected next-states and SLAs.

Why it matters

Without an explicit lifecycle, long-running tasks become unobservable: you can't tell whether a task is still running or stuck, whether an approval is awaiting human or has timed out, whether a tool call is mid-retry or abandoned. Explicit states make all of that queryable.

How it works

The runtime persists task state; transitions emit events; approval inboxes track 'awaiting-approval' tasks with SLAs; expired tasks follow declared default actions. Substrates like Temporal and Inngest build durable-execution patterns around this lifecycle. Bespoke runtimes implement it explicitly with a database-backed state machine.

Related resources