> ## Documentation Index
> Fetch the complete documentation index at: https://docs.novita.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# How long can a Novita Sandbox run?

> A sandbox runs 5 minutes unless you set a timeout. Timeouts are capped by your tier (1, 3, or 4 hours); long-running mode lifts that cap for long-lived jobs.

A sandbox runs for 5 minutes unless you set a `timeout` when you create it. The timeout is capped by your account tier — 1 hour on Free, 3 on Paid, 4 on Enterprise — and long-running mode lifts that cap. You can extend a running sandbox's timeout at any time, or pause it to keep its state without a running clock.

## Details

| Setting | Value |
| - | - |
| Default `timeout` when not set | 5 minutes |
| Maximum `timeout` without long-running mode | Your tier's maximum session duration: Free 1 hour · Paid 3 hours · Enterprise 4 hours by default, adjustable. Larger values are capped. |
| With long-running mode (`metadata={"long_running": "true"}`) | `timeout` can exceed your tier's cap |
| What happens at timeout | Killed by default, or paused if `lifecycle.on_timeout` is `pause` |
| Idle timeout | Optional; fires when no client is connected, and still applies in long-running mode |

Your tier's cap is returned by the [quota API](https://docs.novita.ai/guides/sandbox-quota-limit.md#check-current-quota-usage) as `limit.max_length_hours` (Python) / `limit.maxLengthHours` (JavaScript). A long-running sandbox keeps running until its timeout, an idle timeout, or `kill()`, and bills per second the whole time — always set an explicit `timeout`, and an idle timeout for services that can sleep.

## How to

```python Python icon="python" theme={"system"}
from novita_sandbox import Novita

novita = Novita()

# Pause instead of kill when the timeout fires, and resume on the next request.
sandbox = novita.sandbox.create(
    timeout=60 * 60,
    lifecycle={"on_timeout": "pause", "auto_resume": True},
)
sandbox.set_timeout(60 * 60)  # reset the clock to 1 hour while work is in progress

# Long-lived service: lift the tier cap.
service = novita.sandbox.create(metadata={"long_running": "true"}, timeout=3 * 60 * 60)
```

```js JavaScript & TypeScript icon="js" theme={"system"}
import { Novita } from 'novita-sandbox'

const novita = new Novita()

// Pause instead of kill when the timeout fires, and resume on the next request.
const sandbox = await novita.sandbox.create({
  timeoutMs: 60 * 60 * 1000,
  lifecycle: { onTimeout: 'pause', autoResume: true },
})
await sandbox.setTimeout(60 * 60 * 1000) // reset the clock to 1 hour while work is in progress

// Long-lived service: lift the tier cap.
const service = await novita.sandbox.create({ metadata: { long_running: 'true' }, timeoutMs: 3 * 60 * 60 * 1000 })
```

Learn more: [Timeout handling](https://docs.novita.ai/guides/sandbox-timeout-handle.md) · [Long-running sandboxes](https://docs.novita.ai/guides/sandbox-long-running.md) · [Idle timeout](https://docs.novita.ai/guides/sandbox-idle-timeout.md)

## Related questions

* [Are paused Novita sandboxes billed?](https://docs.novita.ai/guides/sandbox-faq-paused-sandboxes.md)
* [How do I increase my Novita Sandbox concurrency limit?](https://docs.novita.ai/guides/sandbox-faq-concurrency-limit.md)
* [How much does Novita Sandbox cost?](https://docs.novita.ai/guides/sandbox-faq-pricing.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.