create() method provisions a brand-new sandbox container within Fermion’s secure cloud infrastructure.When invoked, it initializes a clean Linux environment, configures your session, and establishes a WebSocket connection for real-time interaction. Depending on the parameters you provide, the sandbox can be either ephemeral (short-lived and automatically destroyed on disconnect) or persistent (saved for later reuse). You can also optionally clone a Git repository during provisioning, allowing you to start from existing codebases or templates.
The provisioning process typically completes within a few seconds, after which the sandbox is ready to execute commands, perform file operations, or run servers. This method returns a unique
snippet_id, which can be stored and reused to reconnect to the same environment later.
async create(should_backup_filesystem: bool, git_repo_url: Optional[str] = None) -> Dict[str, str]
Description:Creates and provisions a new sandbox container.
This process includes:
- Creating a playground snippet
- Starting a session
- Waiting for container provisioning (polling with ~500 ms intervals)
- Establishing a WebSocket connection
- Waiting for the container to be ready
- Optionally cloning a Git repository
Parameters:
Returns:
Dict[str, str] : Dictionary containing playgroundSnippetId key with the unique snippet ID for this sandbox session.Store this ID to reconnect or recreate the same environment later.
