> ## 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.

# Use Snapshots in a Sandbox

You can create a new sandbox directly from an existing snapshot. The new sandbox starts from the captured state — the same filesystem and memory filesystem and runtime state, so setup work from the origin sandbox is already available.

## Create a new sandbox from a snapshot

Pass the snapshot\_id to novita.sandbox.create(...) to spawn a new sandbox that starts from the captured state.

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

novita = Novita()
snapshot_id = "<snapshot_id>"

# Create a new sandbox from a previously captured snapshot
new_sandbox = novita.sandbox.create(snapshot_id)

# The state captured in the snapshot is already present
result = new_sandbox.commands.run("python -c 'import requests; print(requests.__version__)'")
print(result.stdout)

new_sandbox.kill()
```

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

const novita = new Novita()
const snapshotId = '<snapshot_id>'

// Create a new sandbox from a previously captured snapshot
const newSandbox = await novita.sandbox.create(snapshotId)

// The state captured in the snapshot is already present
const result = await newSandbox.commands.run("python -c 'import requests; print(requests.__version__)'")
console.log(result.stdout)

await newSandbox.kill()
```


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