Not Every Agent Hibernates

Hibernation is often presented as the answer to running agents at scale: suspend the idle ones, keep their state, and bring them back when there is work. It sounds like a fleet-wide feature. It is not. Of the four common agent patterns, only two ever suspend. The other two are either removed when their work is done or never stop running until it is.

The previous article ended at the platform layer: how fast a sandbox starts or resumes shapes the wait between model calls, and that is the layer a platform team controls. Before that speed can be tuned, it has to be clear when a sandbox starts, suspends, and resumes at all, and whether an agent has one.

The previous articles in this series followed a single agent run from the inside: what an agent is and when it is worth building, which components run the agent loop, what reaches the inference endpoint, and why the agent resends its context with every call. This article zooms out to the session: which agents need a sandbox, where sandbox start, suspend, and resume fall in the session lifecycle, and which waits give the platform a chance to suspend an agent at all.

From a single run to a session

The agent loop is covered in Anatomy of an Agentic Workload: a trigger starts the harness, the harness calls the model endpoint, executes the tool calls the model returns, adds the results to the context, and repeats until the model gives a final answer. Tools that run code execute in a sandbox. Not every agent needs one: an agent whose tools only call remote APIs, such as a mail or calendar agent, runs without a sandbox, and its harness sends tool calls directly to those APIs. That article follows one run. Agents rarely stop after one. This article adds the terms needed to describe what happens across runs:

  • Turn: one pass through the agent loop, from a user message or event to the answer or question that ends it. A turn can pause on a wait inside it, such as a permission prompt before a tool runs, without ending.
  • Session: the lifetime of one piece of work with an agent, from its first turn to its last, including the waits between turns. The session’s state, such as the conversation history and working files, must persist for the whole session; the harness and sandbox that act on it do not have to run continuously.
  • Suspend: stop an agent’s compute while keeping its state, so it can resume where it stopped. This article uses hibernate as a synonym.
  • Snapshot: a capture of a sandbox’s memory and files, written to storage when it is suspended and read back when it resumes.
  • Release: stop a sandbox and discard it, keeping nothing that was inside it.
  • Sandbox platform: the system that creates, suspends, and restores sandboxes for a fleet of agents. Its controller creates sandboxes, from a warm pool of pre-started sandboxes when one is configured.
  • Platform router: the shared component of the sandbox platform that receives triggers, such as API requests, events, and user replies, and delivers each to the agent it addresses. A trigger for a suspended agent starts its resume. One router serves all agents, so a suspended agent keeps no compute of its own running to wait for its trigger.

The harnesses and sandboxes run on what this article calls the agent cluster. The model endpoints run separately, on a model cluster or at a model provider, with their own lifecycle.

Four agent patterns

Agents range from bounded requests to extended tasks and recurring responsibilities. They differ most in how long they run and what state must persist once their work stops. A short-lived agent handles a bounded task, one with a defined end that finishes in seconds to minutes. A long-running agent keeps its goal or identity for hours to months, and appears in three patterns. A single deployment can combine them.

PatternStarted byActive durationWhat must persist
Short-livedA request, schedule, or another agentSeconds to minutesUsually only the returned result
Long-horizon autonomousA goal set by a userHours to weeks of continuous workWorking state, files, progress
Event-drivenExternal events over timeShort bursts, idle in betweenIdentity, memory, subscriptions
Human-in-the-loopA user, with approval pointsMostly waiting on peopleTask state while paused

Documented examples of each pattern:

How each pattern spends a session

The timelines below show one session per pattern: when its turns run, what triggers each turn, and what the session waits on between turns. Segment widths show order and proportion, not measured durations.

Turns and waits by agent pattern: two patterns work without pause; two spend most of the session waiting

Short-lived agent. A request, a schedule, or a parent agent triggers one turn, or a few in quick succession. The session ends when the agent returns its result, so demand follows the arrival rate and the turn duration.

Long-horizon autonomous agent. A user sets a goal, and the harness continues without further input as one long turn or a self-started chain. Waits occur only inside the turn, so the sandbox stays allocated. Published runs lasted 42 hours (J. H. Neves) and more than three weeks (Cursor).

Published long-horizon agents are mostly coding agents. SWE-Marathon, a benchmark for runs of several hours, consists of 20 software engineering and adjacent technical tasks, and agent attempts averaged 27.2 million tokens each. Each task comes with an executable environment and a multi-layer verification suite. That combination is the likely reason coding dominates: it gives an agent what a long unattended run needs, a sandbox to work in and tests that tell it whether it is making progress without a person checking. Domains without automatic checks tend to add approval points, which pushes them toward the human-in-the-loop pattern.

Event-driven agent. An event or a schedule triggers each short turn, and the waits between turns are long in comparison. The agent does not control its resume time, and a shared schedule or event source can resume many agents at the same moment. A design example from Cloudflare assumes agents that are active 1% of the time, which is an illustration and not a measurement.

Human-in-the-loop agent. A person triggers each turn and may approve actions inside it. Both waits last from seconds to days and end unpredictably.

PatternTurns per sessionWait between turnsSuspend opportunity
Short-livedOne or a fewNone or very shortNone: removed after the result
Long-horizon autonomousOne long turn or a self-started chainNoneNone: runs until the run ends
Event-drivenMany, shortLongBetween events; resumes in bursts
Human-in-the-loopSeveralSeconds to daysBetween turns; independent resumes

An idle sandbox is not always a suspendable one. During a model call, the sandbox uses almost no CPU, but the turn needs it again within seconds or minutes (Not All AI Agents Are Equal). A session that waits for a person or an event between turns leaves its sandbox at the same low CPU use. Low CPU use alone therefore does not show whether a sandbox is idle inside a turn or between turns.

Sub-agents

An agent of any pattern can start other agents, called sub-agents, to handle part of its task. Most sub-agents are short-lived: each runs one turn inside its parent’s turn, in a fresh context, and ends after returning a summary. The parent waits while its sub-agents work, so its sandbox stays allocated, and the number of sessions understates the number of concurrent turns. A lead research agent, for example, typically starts three to five sub-agents in parallel (Anthropic), and in multi-week coding runs, planners start sub-planners for specific areas of the codebase. A parent can also keep a sub-agent alive and address it repeatedly; that sub-agent then behaves like an event-driven agent whose events come from its parent.

When an agent can be suspended

Suspending an agent makes sense only while its session waits between turns. Inside a turn, the harness is in the middle of its loop, and its open connections, such as database sessions or MCP connections, do not survive a suspend (Agent Substrate). Between turns, nothing is in progress, so the agent can be suspended once the wait lasts longer than the idle timeout: a setting of the sandbox platform that sets how long a sandbox may stay idle, with no turn running, before the platform suspends it.

Short-lived agent: no suspend opportunity. The session ends with its turn. The harness exits, and the sandbox is removed or returned to a warm pool. No state must survive. A new request does not resume this agent; it starts a new one, in a sandbox the platform’s controller creates or takes from a warm pool.

Long-horizon autonomous agent: no suspend opportunity. The run is one continuous turn or a self-started chain. The controller creates the sandbox and starts the agent once, when the user sets the goal. The harness and sandbox run until the run ends, and are then removed.

Event-driven agent: suspended between events. The waits between turns are long compared with the turns. When a wait outlasts the idle timeout, the agent is suspended and resumed at the next event. Resumes are expected to arrive in bursts when a shared schedule or event source fires.

Human-in-the-loop agent: suspended while the person has not replied. Waits between turns last from seconds to days, so only the waits that outlast the idle timeout lead to a suspend. Resumes are expected to be mostly independent. An approval requested inside a turn is a different case. The harness is paused in the middle of its loop, so the agent keeps running, with its sandbox and memory held, for as long as the person takes to approve, even hours. Whether an approval falls inside a turn depends on the harness: a permission prompt that blocks the loop keeps the agent running, while a harness that saves its state and ends the turn at the approval point turns the approval into a wait between turns, which can be suspended (LangChain).

Suspend happens between turns, after the idle timeout

A wait shorter than the idle timeout keeps the sandbox running, even when a suspend is possible. The timeout therefore sets how many event-driven and human-in-the-loop agents are suspended at any moment, and how long idle agents hold memory before they are.

What remains while an agent is suspended

Where the harness runs determines the footprint of a suspended agent. With the harness inside the sandbox, that footprint is a snapshot of the pod’s memory and files in object storage, with no CPU or memory allocated on a host. With the harness outside, it is the session state in an external store, plus the CPU and memory allocated to the harness pod when each agent has its own. Multiplied by the number of suspended agents, that footprint is the capacity the agent cluster keeps allocated to agents that do no work. It also sets what a resume costs: restoring a memory image, or starting a harness and creating a sandbox.

What a suspended agent leaves on a host and in storage

Harness inside the sandbox. The harness, the session state, and the tools run in one pod. When the agent is suspended, the platform snapshots the pod’s memory and files to object storage and stops the pod, so the agent keeps no CPU or memory on the host; only the snapshot remains. Agent Substrate works this way and restores an agent in under a second. Snapshot and restore time grows with the pod’s memory and file footprint, divided by the throughput of the storage path the image is written to and read from. E2B, for example, takes about four seconds per GiB of RAM to pause a sandbox (Fly.io).

Harness outside the sandbox. The harness runs in its own pod, calls the sandbox like any other tool, and writes the session state to an external store. When the agent is suspended, the sandbox is released without a snapshot, provided the working files are stored outside it, on Git or a volume. Whether the harness keeps running depends on how it is deployed. A harness pod per agent stays live and keeps its CPU and memory allocated while the agent waits. A shared, stateless harness, as in Anthropic’s Managed Agents, runs nothing for the agent between turns and starts again from the session store at the next trigger.

Agent without a sandbox. An agent whose tools only call remote APIs has no sandbox to snapshot or release. While it is suspended, only its session state remains in storage, plus its harness pod if each agent has its own.

The diagram below follows an event-driven agent through each phase, for both placements. A human-in-the-loop agent passes through the same phases, triggered by a reply instead of an event. The harness-outside rows assume a shared, stateless harness; with a harness pod per agent, the harness row stays running in every phase.

Event-driven agent: after the idle timeout, only storage and a shared router remain

What this means for the platform

Resource demand follows concurrent turns and suspended agents, not the number of agents. Three findings decide how a fleet of agents must be served:

  • The pattern decides whether an agent is suspended. Short-lived and long-horizon agents are not. Event-driven and human-in-the-loop agents are, between turns, after the idle timeout. Event-driven agents resume in bursts; human-in-the-loop agents mostly independently.
  • Harness placement decides what a suspended agent costs. It sets the footprint the agent leaves on a host and in storage, and the work needed to bring it back.
  • An approval inside a turn is not an idle agent. It keeps the agent running, with its sandbox and memory allocated, unless the harness ends the turn at the approval point.

So hibernation is not a fleet-wide property. Sizing for it starts from the share of agents that follow the event-driven and human-in-the-loop patterns, not from the total agent count.

Three inputs still lack public measurements: the ratio of active to waiting time per pattern, the number of agents that resume together, and the footprint of a suspended agent. Until they are measured, they remain assumptions. The next article, Sandbox Performance Decides the KV Cache Hit, returns to the tool wait: how sandbox startup, resume, and snapshot speed shape the gap between model calls, and why warm pools, resumes, and snapshots are inference capacity decisions.

Posts in this series