Skip to the entry

What idle time costs when an agent waits for its model

Answer
An agent's environment is billed for every second it is open, including the seconds it waits for the model, a person or a slow page. In the worked example, two thirds of a run's compute pays for waiting, and environments left open overnight cost more than a month of runs.

An environment billed by time is paid for every second it is open, busy or not. An agent spends much of each run waiting: for the model to answer, for a person to approve a step, for a page to load. Those seconds are billed at the same rate as the seconds where the agent's commands are running.

How much of an agent run is idle?

How much of a run is idle depends on your agent, so measure it; a common pattern is that each step waits for the model longer than the action itself takes. A worked example with example numbers: 20 steps, each with a 6-second model call while the environment waits and a 3-second action in the environment.

Table: Worked example of busy and idle time in one agent run, with example numbers

PartSumSecondsShare
Actions (busy)20 x 36033%
Model calls (idle)20 x 612067%
Run, open time60 + 120180100%

What does the idle part cost?

The idle part costs its share of the run's compute, unless the provider bills only the resources in use. As a worked example with a real price, take Promigence's published per-second rates of 0.0504 USD per vCPU-hour and 0.0162 USD per GiB-hour (read 2026-11-26): a 2 vCPU, 4 GiB environment comes to 0.1656 USD an hour.

Table: Cost of the example run, at Promigence's published rates

SumPer run10,000 runs a month
Whole run180 x 0.1656 / 36000.00828 USD82.80 USD
Idle part120 x 0.1656 / 36000.00552 USD55.20 USD

The idle share is often a small amount next to the model's token bill (see the compute vs model token calculator), but it grows with every environment that stays open longer than it needs to.

What a waiting second costs depends on how a provider bills: under pricing by the size you hold it costs the same as a busy second, and under pricing by the resources in use it can cost less, so the same run can split differently elsewhere. Read each provider's terms for a running environment and for a paused one before you compare.

What does an environment left open overnight cost?

An environment left open overnight costs its hourly price for every hour until someone or something closes it. A worked example: 50 environments of 2 vCPU and 4 GiB that agents or developers leave open from 18:00 to 08:00, 14 hours, at the 0.1656 USD an hour above.

14 h x 0.1656 USD x 50 environments = 115.92 USD for one night

That is more than a month of the example agent runs above. Forgotten environments are usually the largest idle cost, and the easiest to remove.

How do I measure idle time in my own runs?

Measure idle time by logging when each command in the environment starts and ends, then subtracting the busy time from the run's open time.

  1. Record the time the environment is opened and closed.
  2. Wrap each command the agent runs so it logs its start and end in seconds. date +%s prints seconds since the Epoch and date +%s%N adds nanoseconds (date(1) manual, read 2026-11-26):
run_logged() {
  s=$(date +%s%N); "$@"; rc=$?; e=$(date +%s%N)
  echo "$(( (e - s) / 1000000 )) ms $*" >> /tmp/agent-commands.log
  return $rc
}
  1. After the run, add up the milliseconds in the log, convert to seconds, and compare with the open time.

How do I reduce what idle time costs?

Reduce idle cost by stopping the meter while nothing happens, either with a provider's pause or with your own clean-up rules.

  1. Pause on idle with Promigence. Promigence describes auto-pause on idle as opt-in (promigence sandbox autopause): the sandbox pauses itself once it has sat idle and wakes on the next request, and paused time is not billed, according to its FAQ (read 2026-11-26). Its limits page states the term in its own words: a paused sandbox "is not billed by the second". Applied to the overnight example, 50 environments paused at 18:00 and resumed at 08:00 bill none of those 14 hours by the second, so the 115.92 USD for that night comes off the compute bill.
  2. Pause or stop on idle with the other named providers. E2B can pause a sandbox at its timeout and resume it on the next request, and its compute billing stops once a sandbox is paused; Daytona stops a sandbox after 15 minutes of inactivity by default or, for sandbox classes that support pausing, pauses it after 60 minutes when neither interval is set, and bills either state for disk only; Google Cloud's pause releases a sandbox's compute; Modal's idle_timeout ends a Sandbox that has gone quiet; and an AWS AgentCore session ends at its timeout, 15 minutes by default. The table below has the sources, all read 2026-11-26.
  3. Close every environment when its run ends, in a finally block or an exit trap, so a crashed script does not leave it open.
  4. Set an idle timeout that closes environments with no activity for a few minutes.
  5. Set a maximum lifetime for every environment, so nothing runs for days by mistake.
  6. Size for the work, not the wait. If the environment idles most of the time, a smaller size may finish the actions nearly as fast for less per hour. Test it.

Table: How AWS, Daytona, E2B, Google Cloud and Modal bill an environment once it is paused, stopped or timed out (read 2026-11-26)

ProviderPaused, stopped or timed outSource
AWS (Amazon Bedrock AgentCore Code Interpreter and Browser)A session ends at its timeout, 15 minutes by defaultCode Interpreter sessions
DaytonaStopped and paused sandboxes are billed for reserved disk only, and a sandbox stops after 15 minutes of inactivity by defaultBilling, Sandboxes
E2BCompute billing stops immediately once a sandbox is paused, killed or timed out; a sandbox can pause at its timeout instead of being killed (onTimeout: 'pause') and wake on the next request with autoResumeBilling and limits, How long does a sandbox live?
Google Cloud (Gemini Enterprise Agent Platform sandboxes)Pausing releases the sandbox's compute, and paused sandboxes cost significantly less than running onesManage sandboxes
ModalAn idle_timeout ends a Sandbox after a period with no running command, no stdin and no open tunnel connectionSandboxes guide

The waits inside a single run are short, so whichever way you pause, check how quickly an environment pauses and resumes on your own workload before counting on it between model calls.

What we read for this article

Common questions

Do I pay for an agent environment while it waits for the model?

Under time-based pricing, yes. The environment is billed for every second it is open, whether a command is running or the agent is waiting for the next model response.

How do I measure idle time in an agent run?

Log a timestamp when each command starts and ends inside the environment. Idle time is the run's total open time minus the sum of command times.

How do I cut the cost of idle time?

Close environments as soon as a run ends, set an idle timeout, size environments for the work rather than the wait, and, where your provider supports it, pause environments during long waits and check how paused time is billed.

Is a paused sandbox billed?

It depends on the provider, so read its terms. Promigence's FAQ and limits page say paused time is not billed by the second. E2B's billing page says compute billing stops immediately once a sandbox is paused, Daytona's billing page bills a paused or stopped sandbox for its reserved disk only, and Google Cloud's sandbox guide says paused sandboxes cost significantly less than running ones.

Is idle time a problem for scripted tests too?

Less so. A scripted test rarely waits on a model, but it can wait on slow pages, fixed sleeps and environments that are not closed after the run.