> ## Documentation Index
> Fetch the complete documentation index at: https://novita.ai/docs/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.

<CodeGroup>
  ```python Python icon="python" theme={"system"}
  import os
  from novita_sandbox import Novita

  novita = Novita(api_key=os.getenv("NOVITA_API_KEY", ""))
  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({
    apiKey: process.env.NOVITA_API_KEY || '',
  })
  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()
  ```
</CodeGroup>
