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.
- 01Return a task ID at the start of multi-step work.
- 02Expose a compact resume endpoint.
- 03Include pending approvals and expiry times.
- 04Detect and report state that changed while the task was paused.
Interaction diagram
Example implementation
Illustrative exampleExamples use a fictional store and illustrative field names. Adapt the shape to your stack; the qualities matter more than the exact format.
{
"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.
Related patterns
Applies the principles Transparent State and Graceful Failure.