Sandboxes that run longer than one hour

E2B sandboxes stop when their timeout expires. The timeout starts at 5 minutes and can be raised up to the limit of your plan. On getrollouts.dev that limit is 24 hours on every paid account, without a monthly fee. The code is the same E2B SDK code you already use.

Set the timeout when you create the sandbox

from e2b_code_interpreter import Sandbox

sbx = Sandbox.create(timeout=24 * 3600)        # up to 24 hours on getrollouts.dev

The timeout is in seconds. On E2B the Hobby plan allows sessions of up to 1 hour and longer sessions need the Pro plan ($150.00 per month, see e2b.dev/pricing). Here you only pay for the seconds the sandbox runs. On the free trial sessions last up to 1 hour; any top-up unlocks 24 hours.

Extend it while the sandbox runs

A long timeout is convenient, but a forgotten sandbox then keeps running and costs money. A safer pattern for agents is a short timeout that the agent extends after every step. If the agent crashes, the sandbox stops on its own soon after.

sbx = Sandbox.create(timeout=15 * 60)        # stops 15 minutes after the last sign of life

for step in agent_steps():
    sbx.set_timeout(15 * 60)                 # each step pushes the end 15 minutes out
    run_step(sbx, step)

sbx.kill()

Pause between steps

Agents that wait for a human, a webhook or the next day do not need a running sandbox. Pause it: memory, running processes and files are kept, and nothing is billed while it is paused. Resuming takes under a second. Paused sandboxes are kept 30 days after their last pause (7 days on the free trial).

sandbox_id = sbx.sandbox_id
sbx.pause()                                  # state kept, billing stops

# hours later, maybe in another process
sbx = Sandbox.connect(sandbox_id)            # resumes in under a second
sbx.set_timeout(15 * 60)

What a long session costs

A code interpreter sandbox (2 vCPU, 2 GiB RAM) running for a full day costs $2.54 here, billed per second. For a month of sessions around the clock compared with E2B Pro, see the comparison with E2B.

Try it free   Read the docs

Works with the official E2B SDKs after setting E2B_API_KEY and E2B_DOMAIN=getrollouts.dev. getrollouts.dev is an independent service and not affiliated with E2B.