> ## 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 is Novita Sandbox isolated?

> Each sandbox has its own filesystem, processes, and network. SDK access is token-protected by default, and URLs, egress, and secrets are all controllable.

Each Novita Sandbox is a separate runtime with its own filesystem, processes, and network, so code in one sandbox can't see another sandbox or your machine. SDK access is token-protected by default, and you can make URLs private, restrict outbound traffic, and keep secrets out of the sandbox.

## Details

| Layer | What isolates it | Default |
| - | - | - |
| Runtime | Each sandbox has its own filesystem, process space, and network stack | Always on |
| SDK access (commands, files, PTY, upload/download URLs) | Per-sandbox access token, attached by the SDK automatically | On since SDK v2.0.0 (`secure`) |
| Service URLs (`https://{port}-{sandboxId}.{domain}`) | Traffic access token in the `Sandbox-Traffic-Access-Token` header | Public unless `allowPublicTraffic` is `false` |
| Outbound network | Disable internet access, or allow / deny domains and CIDRs | Internet access on |
| Credentials | [Secrets](https://docs.novita.ai/guides/sandbox-secret.md): the sandbox sees only a placeholder; the real value is injected into HTTPS headers for allowed hosts | Opt in |
| Data lifetime | Ephemeral disk is deleted when the sandbox is killed, including on timeout unless the lifecycle pauses it | Always on |

`secure` and `allowPublicTraffic` are fixed while a sandbox is running. To change them, start a new sandbox.

## How to

Create a locked-down sandbox: private URLs, egress limited to one API, and an API key passed as a secret.

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

novita = Novita()
sandbox = novita.sandbox.create(
    network={
        "allow_public_traffic": False,
        "allow_out": ["api.openai.com"],
        "deny_out": ["0.0.0.0/0"],
    },
    secret_envs={"OPENAI_API_KEY": "openai-key"},  # name of an existing Secret
)
print("Traffic token:", sandbox.traffic_access_token)
```

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

const novita = new Novita()
const sandbox = await novita.sandbox.create({
  network: {
    allowPublicTraffic: false,
    allowOut: ['api.openai.com'],
    denyOut: ['0.0.0.0/0'],
  },
  secretEnvs: { OPENAI_API_KEY: 'openai-key' }, // name of an existing Secret
})
console.log('Traffic token:', sandbox.trafficAccessToken)
```

Learn more: [Secured access](https://docs.novita.ai/guides/sandbox-secured-access.md) · [Internet access](https://docs.novita.ai/guides/sandbox-internet-access.md) · [Secrets](https://docs.novita.ai/guides/sandbox-secret-sandbox-use.md)

## Related questions

* [Can I restrict internet access from a Novita Sandbox?](https://docs.novita.ai/guides/sandbox-faq-internet-access.md)
* [How do I keep API keys safe inside a Novita Sandbox?](https://docs.novita.ai/guides/sandbox-faq-secrets.md)
* [Which regions does Novita Sandbox run in?](https://docs.novita.ai/guides/sandbox-faq-regions.md)


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