Skip to main content
This legacy page is kept for users who still use the 1.x or beta SDK line. New SDK 2.x integrations should follow the current Sandbox documentation.

Terminology

  • Commit: A commit operation saves the current state of a sandbox as a template, resulting in a new template of type snapshot template.
  • Origin Sandbox: The sandbox instance being committed.
  • Snapshot Template: The template generated after a commit operation.

Feature Description

Committing a Running Sandbox

During the commit process:
  • The origin sandbox will be briefly suspended during committing;
  • The sandbox instance is unavailable during suspension;
  • The suspension duration is close to the time required for a single pause operation.
After committing is complete: Origin Sandbox:
  • The existing pause record will be refreshed to a new pause record, based on the current sandbox state;
  • The origin sandbox continues to run;
  • A new template record is generated.

Committing a Paused Sandbox

During the commit process:
  • The commit process will not trigger the origin sandbox to start;
  • The origin sandbox remains in paused state.
After committing is complete: Origin Sandbox:
  • The existing pause record is not cleared;
  • A new template record is generated.

Parameter Description

ParameterTypeRequiredDescription
sandbox_idstringYesThe ID of the sandbox instance to commit
aliasstringNoSet an alias for the generated template

Return Value

After a successful commit operation, a Template object is returned.

Code Examples

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}")
Additionally, you can also use the Novita Sandbox CLI to commit a specified sandbox instance:
Bash
# 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