Skip to content
AX Framework
Recovery pattern

Context Restoration

Let an agent resume a task after interruption by restoring state from a durable identifier.

Problem

Agent sessions end: context windows fill, processes restart, a person picks the task up on another device. Without a way to restore context, work starts over or proceeds on stale assumptions.

Context

Use this pattern when:

  • Tasks span long periods or multiple sessions.
  • A different agent, or a person, may continue the task.

Recommended solution

Issue a durable task or workflow ID at the start of meaningful work. A single request with that ID returns everything needed to continue: the goal, completed steps, current state, pending approvals, and the next action. Keep this summary compact enough to fit an agent's working context.

  1. 01Return a task ID at the start of multi-step work.
  2. 02Expose a compact resume endpoint.
  3. 03Include pending approvals and expiry times.
  4. 04Detect and report state that changed while the task was paused.

Interaction diagram

Interaction diagram for Context Restoration. 1. AI agent to Product · AX layer: GET /tasks/tsk_8/resume. 2. Product · AX layer to AI agent: goal, done[], changed[], next. 3. AI agent to AI agent: Price changed: re-confirm.AI agentProduct · AX layerGET /tasks/tsk_8/resume1goal, done[], changed[], next2Price changed: re-confirm
request response internal step

Example implementation

Illustrative example

Examples use a fictional store and illustrative field names. Adapt the shape to your stack; the qualities matter more than the exact format.

GET /tasks/tsk_8/resumejson
{
  "task": "tsk_8",
  "goal": "Book a return flight LIS → BER on Oct 18 under 250 EUR",
  "completed": ["search_flights", "hold_fare"],
  "pending": [{ "approval": "apr_221", "expiresAt": "2026-10-06T18:00:00Z" }],
  "changedSince": [
    { "field": "fare.total", "from": 214.00, "to": 231.00, "currency": "EUR" }
  ],
  "next": { "action": "confirm_booking" }
}

Accessibility and security

Accessibility

  • The same resume summary can power a "Continue where you left off" view for people.

Security

  • Resume tokens grant access to task context; bind them to the original grant and expire them.

Applies the principles Transparent State and Graceful Failure.