---
title: "Why long jobs die"
lesson_id: "01"
---

# Why long jobs die

- **Lesson ID:** 01
- **Goal:** Name backgrounding, cancel, and process death. State that a live session is not enough.
- **Human lesson:** [01-why-long-jobs-die.html](01-why-long-jobs-die.html)

## Prerequisites

LanguageModelSession on iOS 27 or macOS 27. Xcode 27.

## Inputs, outputs, and artifacts

- **Inputs:** A multi-step agent job.
- **Outputs:** The rule that progress must live on disk.
- **Artifacts:** Progressive .flow diagrams and environment setup.

## Agent build steps

1. List the three stop points.
2. Say transcript access helps save, but does not write the file.
3. Link [Make several agents agree first](../on-device-multi-agent-consensus/), [Talk to tools with MCP](../on-device-mcp-server-client/), and [Stop prompt attacks and leaks](../on-device-guardrails/).

## Constraints

iOS 27 or later, or macOS 27 or later, and Xcode 27. Plain spoken English. No metaphor, quizzes, Mermaid, or em dashes. LanguageModelSession does not survive process death. Persist a checkpoint and the transcript yourself. Confirm transcript mutability and BGTaskScheduler names in the installed docs.

## Key concepts

- Long agent jobs are step lists: plan, tool, judge, tool.
- Three stop points are background, cancel, and process death.
- The session and transcript live in memory until you persist them.
- Reading the transcript does not auto-save to disk.

## Takeaways

- If the only copy of progress is the live session, backgrounding restarts the job.
- The engine records finished steps and starts at the next one.
- Disk checkpoint plus a new session on relaunch is the durable pattern.

## Acceptance checks

- Process death is named.
- Sibling links, progressive .flow diagrams, and the Agent brief link are present.
- [ ] Proceed to [lesson brief](02-checkpoint-progress.llms.md).
