Agents handle long tasks by not holding them in their heads. The task's state lives in a record outside the model: what is done, what is waiting, and why. The agent wakes on an event or a timer, reloads that state, and re-checks its authority before each action, because its certificate or the facts may have changed while it waited.
What counts as a long-running task?
Anything that outlives a single session with the model. A commercial insurance renewal that waits weeks for a broker's documents. A debt case that moves through letters, calls and a payment plan over months. A supplier onboarding that stalls on a missing certificate. The agent's active work may be minutes; the task spans days or weeks.
The model itself has no memory between calls. Everything that carries the task forward has to be stored somewhere the agent can reload, which is covered in how AI agents remember context between tasks.
How does a long task actually run?
The common pattern:
- The task record holds state. Steps completed, outputs produced, what the task is waiting for, and a deadline.
- The agent sleeps. Nothing runs while it waits. No model is kept busy.
- An event or timer wakes it. A document arrives, a payment lands, or a follow-up date is reached.
- The agent reloads. It reads the task record and fetches fresh facts from source systems.
- Each action is checked again. The platform evaluates the agent's bounds at that moment, not as they stood when the task began.
- Progress is written back before the agent sleeps again.
Steps should be safe to repeat. If the agent crashes after sending a letter but before recording it, the retry must not send a second letter. Idempotency keys on each action handle this.
What changes while a task waits?
More than teams expect.
- The agent's certificate. Certificates lapse after a fixed period. A task begun under a valid certificate may resume after it has lapsed, and the agent's depth falls accordingly.
- The facts. The customer pays, moves house or complains. A step planned against old facts may now be wrong.
- The people. The approver named at the start may have left or changed role. Held actions must route to whoever holds that responsibility now.
- The rules. Limits and policies change. The action is judged against current ones.
This is why re-checking authority at each wake is not optional. A long task is a series of short ones, each needing its own verdict.
What may the agent do, and what stays with a person?
| During a long task | Agent | Person |
|---|---|---|
| Send scheduled reminders and chasers | Yes, within its depth | Sets the schedule and tone |
| Resume after an event | Yes, after reloading state | None |
| Change the plan when facts change | Draft the new plan | Approves if it adds capabilities |
| Escalate a stalled task | Flag it at a set deadline | Decides what to do |
| Close the task with a final irreversible step | Prepare it | Releases it |
What does this look like in practice?
Take a regional insurer renewing a commercial property policy. The agent starts the renewal sixty days out: it drafts a request to the broker for updated property values and a claims history. Then it waits.
Three weeks later the broker's documents arrive and wake the task. The agent reloads, reads the documents and finds the declared rebuild value has risen sharply. Re-quoting is within its depth, so it drafts the new terms. But the agent's underwriting certificate lapsed during the wait, so its depth for quoting dropped and the platform holds the draft for an underwriter rather than issuing it. The underwriter approves, and the agent sends the quote. Every wake, check and hold sits in one task record.
What does the platform layer have to do?
- Store task state outside the model, with the full history of steps.
- Wake agents on events and timers, not keep them running.
- Re-evaluate bounds at every action.
- Enforce deadlines and budgets, so a task cannot run indefinitely; see how to budget for running AI agents.
- Keep records for as long as the rules require; how long to keep AI agent logs under the EU AI Act covers that question.
Long tasks also stress planning, discussed in whether AI agents can plan multi-step tasks reliably. The full design is in the governed agentic operating system guide.
Questions people ask
Does a long task need a long context window?
No. A long task needs good state storage. Each wake loads a summary of the task and the facts it needs now, not the entire history.
What happens if the agent is replaced mid-task?
The new agent reads the same task record. It acts under its own certificate and depth, which may differ from its predecessor's, so some steps may now be held.
How do you stop a long task being forgotten?
Give every task a deadline and an owner. If the deadline passes without progress, the platform raises it to the owner rather than letting it sleep.