{ "schema_version": 1, "diagram_type": "lifecycle", "meta": { "title": "Agent Run Lifecycle", "subtitle": "State machine for planning, tool execution, human approval, retries, and terminal outcomes", "output": "examples/lifecycle-agent-run.html", "viewBox": [980, 660] }, "lanes": [ { "id": "main", "label": "Lifecycle phases" }, { "id": "waiting", "label": "Interruptions" }, { "id": "exceptions", "label": "Recovery loop" }, { "id": "terminal", "label": "Terminal exits" } ], "states": [ { "id": "queued", "type": "start", "label": "Queued", "sublabel": "request accepted", "lane": "main", "col": 0, "step": "01", "tag": "entry" }, { "id": "planning", "type": "active", "label": "Planning", "sublabel": "build task graph", "lane": "main", "col": 1, "step": "02", "tag": "model" }, { "id": "executing", "type": "active", "label": "Executing", "sublabel": "tool calls", "lane": "main", "col": 2, "step": "03", "tag": "work" }, { "id": "reviewing", "type": "decision", "label": "Reviewing", "sublabel": "quality gate", "lane": "main", "col": 3, "step": "04", "tag": "check" }, { "id": "completed", "type": "success", "label": "Completed", "sublabel": "final response", "lane": "main", "col": 4, "step": "05", "tag": "done" }, { "id": "approval", "type": "waiting", "label": "Needs Approval", "sublabel": "human gate", "lane": "waiting", "col": 0, "tag": "pause" }, { "id": "blocked", "type": "waiting", "label": "Blocked", "sublabel": "missing input", "lane": "waiting", "col": 1, "tag": "wait" }, { "id": "failed", "type": "failure", "label": "Failed", "sublabel": "recoverable error", "lane": "exceptions", "col": 0, "yOffset": 78, "tag": "retryable" }, { "id": "cancelled", "type": "failure", "label": "Cancelled", "sublabel": "user stopped", "lane": "terminal", "col": 0, "tag": "terminal" }, { "id": "expired", "type": "failure", "label": "Expired", "sublabel": "timeout", "lane": "terminal", "col": 1, "tag": "terminal" } ], "transitions": [ { "from": "executing", "to": "approval", "variant": "security", "fromSide": "bottom", "toSide": "top", "route": "straight" }, { "from": "reviewing", "to": "blocked", "variant": "default", "route": "drop" }, { "from": "executing", "to": "failed", "variant": "security", "fromSide": "left", "toSide": "top", "via": [[320, 157], [320, 342], [402, 342]] }, { "from": "blocked", "to": "expired", "variant": "security", "fromSide": "bottom", "toSide": "top", "route": "straight" }, { "from": "approval", "to": "cancelled", "variant": "security", "fromSide": "bottom", "toSide": "top", "via": [[320, 336], [320, 430], [402, 430]] } ], "cards": [ { "dot": "emerald", "title": "Main Path", "items": [ "The run has five ordered phases from queue to completion", "The primary lifecycle is carried by one horizontal rail", "Completion is a phase, not a detached side box" ] }, { "dot": "amber", "title": "Human + Input Gates", "items": [ "Approval pauses execution without ending the run", "Blocked waits for missing user input", "Wait states can resume back into planning or execution" ] }, { "dot": "rose", "title": "Terminal + Recovery", "items": [ "Failed loops back while retry budget remains", "Cancelled and Expired are exits from the lifecycle", "Terminal exits do not point back into active execution" ] } ] }