---
title: "Resume after a retry or relaunch"
lesson_id: "03"
---

# Resume after a retry or relaunch

- **Lesson ID:** 03
- **Goal:** Restore a new session from disk and skip finished steps.
- **Human lesson:** [03-resume-after-retry.html](03-resume-after-retry.html)

## Prerequisites

Lesson 02.

## Inputs, outputs, and artifacts

- **Inputs:** A saved checkpoint.
- **Outputs:** The first unfinished step runs. Finished steps do not.
- **Artifacts:** resume and runPlan sketches.

## Agent build steps

1. Create a new LanguageModelSession.
2. Restore transcript only when isResponding is false.
3. Skip steps that already have outputs.
4. 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

- Resume loads the checkpoint, skips finished steps, and creates a new session.
- Do not mutate transcript during a live response.
- Skip steps where outputs such as plan already exist.
- Fall back to saved plan and gathered strings if transcript decode fails.

## Takeaways

- Create a new session. Restore data. Never assume the old object is still in memory.
- Skip work you already have in checkpoint fields.
- Confirm Transcript encode and decode APIs in the Xcode 27 SDK.

## Acceptance checks

- A new session is created.
- Finished steps are skipped.
- Sibling links, progressive .flow diagrams, and the Agent brief link are present.
- [ ] Proceed to [lesson brief](04-background-and-sessions.llms.md).
