Checkpointing and resuming long tasks across serverless limits.

Continuations Playbook

Vercel functions have a hard 800s execution cap. Continuations solve this by checkpointing state and resuming.

Steps

  1. Agent runs with a TimeBudget (soft = 720s).
  2. Before timeout, agent saves Checkpoint to S3/R2.
  3. Emit a ContinuationToken (HMAC-signed).
  4. Client (or scheduler) POSTs to /api/agents/continue with token.
  5. Agent resumes from checkpoint until completion.
sequenceDiagram
    participant Agent
    participant S3
    participant Client
    participant NextAPI

    Agent->>S3: Save checkpoint
    Agent-->>Client: SSE continue:{token}
    Client->>NextAPI: POST /continue {token}
    NextAPI->>S3: Load checkpoint
    NextAPI->>Agent: Resume execution