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

# Legacy-Sandbox-Snapshot-Vorlage

export const SandboxBetaVersionWarning = () => {
  if (typeof document === "undefined") {
    return null;
  } else {
    return <Warning>The following legacy features require the legacy SDK and CLI versions listed in <Link href="/docs/de/guides/sandbox-legacy-e2b-compatible" target="self">Legacy SDKs & CLI</Link>. Please note that legacy features may be less stable than production releases. If you encounter any issues while using these features, please <Link href="https://meetings-na2.hubspot.com/junyu" target="_blank">contact us</Link>.</Warning>;
  }
};

<Warning>
  Diese Legacy-Seite wird für Benutzer beibehalten, die noch die 1.x- oder Beta-SDK-Reihe verwenden. Neue SDK-2.x-Integrationen sollten der aktuellen Sandbox-Dokumentation folgen.
</Warning>

<SandboxBetaVersionWarning />

## Terminologie

* **Commit**: Eine Commit-Operation speichert den aktuellen Zustand einer Sandbox als Vorlage, wodurch eine neue Vorlage vom Typ Snapshot-Vorlage entsteht.
* **Ursprungs-Sandbox**: Die Sandbox-Instanz, für die der Commit ausgeführt wird.
* **Snapshot-Vorlage**: Die nach einer Commit-Operation erzeugte Vorlage.

## Funktionsbeschreibung

### Commit einer laufenden Sandbox

**Während des Commit-Prozesses:**

* Die Ursprungs-Sandbox wird während des Commits kurzzeitig angehalten;
* Die Sandbox-Instanz ist während der Unterbrechung nicht verfügbar;
* Die Dauer der Unterbrechung liegt nahe an der Zeit, die für eine einzelne Pause-Operation erforderlich ist.

**Nachdem der Commit abgeschlossen ist:**

**Ursprungs-Sandbox:**

* Der vorhandene Pause-Datensatz wird auf einen neuen Pause-Datensatz aktualisiert, basierend auf dem aktuellen Sandbox-Zustand;
* Die Ursprungs-Sandbox läuft weiter;
* Ein neuer Vorlagendatensatz wird erzeugt.

### Commit einer pausierten Sandbox

**Während des Commit-Prozesses:**

* Der Commit-Prozess löst keinen Start der Ursprungs-Sandbox aus;
* Die Ursprungs-Sandbox bleibt im pausierten Zustand.

**Nachdem der Commit abgeschlossen ist:**

**Ursprungs-Sandbox:**

* Der vorhandene Pause-Datensatz wird nicht gelöscht;
* Ein neuer Vorlagendatensatz wird erzeugt.

## Parameterbeschreibung

| Parameter    | Typ      | Erforderlich | Beschreibung                                                          |
| ------------ | -------- | ------------ | --------------------------------------------------------------------- |
| `sandbox_id` | `string` | Ja           | Die ID der Sandbox-Instanz, für die der Commit ausgeführt werden soll |
| `alias`      | `string` | Nein         | Legt einen Alias für die generierte Vorlage fest                      |

## Rückgabewert

Nach einer erfolgreichen Commit-Operation wird ein `Template`-Objekt zurückgegeben.

## Codebeispiele

<CodeGroup>
  ```python Python icon="python" theme={"system"}
  from novita_sandbox.core import Sandbox

  # Commit an existing sandbox by ID to create a template snapshot
  # sandbox_id: str - Required. The ID of the sandbox to commit
  # alias: Optional[str] - Optional alias name for the created template
  # Note: Default timeout is 10 minutes for commit operation
  template = Sandbox.commit(
      sandbox_id="existing-sandbox-id",
      alias="my-template-alias"
  )
  print(f"Template ID: {template.template_id}")
  print(f"Build ID: {template.build_id}")
  ```

  ```js TypeScript icon="js" theme={"system"}
  import { Sandbox } from '@novita-sandbox/core'

  // Commit an existing sandbox by ID to create a template snapshot
  // sandboxId: string - Required. The ID of the sandbox to commit
  // opts?: { alias?: string } - Optional commit options
  const template = await Sandbox.commit('existing-sandbox-id', {
    alias: 'my-template-alias'
  })
  console.log(`Template ID: ${template.templateId}`)
  console.log(`Build ID: ${template.buildId}`)
  ```
</CodeGroup>

Zusätzlich können Sie auch die Novita Sandbox CLI verwenden, um für eine angegebene Sandbox-Instanz einen Commit auszuführen:

```bash Bash icon="terminal" theme={"system"}
# Basic commit - creates a template snapshot from a sandbox
novita-sandbox-cli sandbox commit <sandboxID>

# Commit with alias - assign a friendly name to the template
novita-sandbox-cli sandbox commit <sandboxID> --alias my-template-alias

```
