Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Novita Agent Sandbox SDK for Python

A Python SDK for Novita Agent Sandbox environments that provides code execution, desktop automation, and cloud computing capabilities. Compatible with e2b.

📖 Documentation • 🔑 Get API Key

Features

  • Code Interpreter: Execute Python, JavaScript, and other languages in isolated environments
  • Desktop Automation: Control desktop applications and GUI interactions
  • Cloud Computing: Scalable sandbox environments for various computing tasks
  • Data Visualization: Built-in charting and visualization capabilities
  • File System Operations: Complete file system management and monitoring

Installation

pip install novita-sandbox

Quick Start

Authentication

Get your Novita API key from the key management page.

Core Sandbox

The basic package provides a way to interact with the sandbox environment.

from novita_sandbox.core import Sandbox
import os

# Using the official template `base` by default
sandbox = Sandbox.create(
    template="base",
    api_key=os.getenv("NOVITA_API_KEY", "")
)

# File operations
sandbox.files.write('/tmp/test.txt', 'Hello, World!')
content = sandbox.files.read('/tmp/test.txt')

# Command execution
result = sandbox.commands.run('ls -la /tmp')
print(result.stdout)

sandbox.kill()

Security on legacy clusters

This beta package targets legacy clusters. Sandbox.create() and Sandbox.beta_create() keep secure=False as their default; explicitly passing None uses the same default. Pass secure=True to require an access token for system communication. The SDK stores the returned envd token and sends it with system requests.

Public access to sandbox URLs is controlled separately:

from novita_sandbox.core import Sandbox

sandbox = Sandbox.create(
    "base",
    domain="sandbox.novita.ai",
    secure=True,
    network={"allow_public_traffic": False},
)

# Connect resumes a paused sandbox and refreshes its traffic token.
sandbox.connect(secure=True, allow_public_traffic=False)
traffic_token = sandbox.traffic_access_token

if sandbox.reset(resume=True, secure=True, allow_public_traffic=False):
    traffic_token = sandbox.traffic_access_token

Creation uses network={"allow_public_traffic": ...}. Connect and reset accept the top-level allow_public_traffic argument, which takes precedence over the older network argument. Omitting secure or allow_public_traffic on connect and reset leaves those settings to the server. Only allow_public_traffic is supported in legacy network configuration.

Instance connect and reset reuse the API key, domain, and request settings from the sandbox. Connect replaces or clears traffic_access_token from its response; reset updates it only when a token is returned. Empty reset responses and conflicts preserve the existing token. Reset still returns a boolean, with False indicating a conflict. Cloned sandboxes also retain their returned traffic tokens and legacy composite sandbox IDs.

The same options are supported by AsyncSandbox with await. Class calls such as Sandbox.connect(sandbox_id, ...) and Sandbox.reset(sandbox_id, ...) remain available.

Code Interpreter

The Code Interpreter sandbox provides a Jupyter-like environment for executing code using the official code-interpreter-v1 template.

from novita_sandbox.code_interpreter import Sandbox
import os

sandbox = Sandbox.create(
    api_key=os.getenv("NOVITA_API_KEY", "")
)

# Execute Python code
result = sandbox.run_code('print("Hello, World!")')
print(result.logs)

sandbox.kill()

Desktop Automation

The Desktop sandbox allows you to control desktop environments programmatically using the official desktop template.

from novita_sandbox.desktop import Sandbox
import os

desktop = Sandbox.create(
    api_key=os.getenv("NOVITA_API_KEY", "")
)

# Take a screenshot
screenshot = desktop.screenshot()

# Automate mouse and keyboard
desktop.left_click(100, 200)
desktop.press('Return')
desktop.write('Hello, World!')

desktop.kill()

Documentation

For comprehensive guides, API references, and examples, visit our official documentation.

Development

Install

poetry install --with dev --extras "all" 

Test

make test
make test-unit  # offline; no API key needed
make test-core
make test-code-interpreter
make test-desktop

Metadata

Release files for novita-sandbox 1.2.7b3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for novita-sandbox 1.2.7b3
File Size Uploaded Provenance Actions
novita_sandbox-1.2.7b3.tar.gz 382.0 kB Without provenance Details for novita_sandbox-1.2.7b3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for novita-sandbox 1.2.7b3
File Interpreter ABI Platform Actions
novita_sandbox-1.2.7b3-py3-none-any.whl Python 3 none any Details for novita_sandbox-1.2.7b3-py3-none-any.whl

Total release size: 829.1 kB

Release files / novita_sandbox-1.2.7b3.tar.gz

Download URL novita_sandbox-1.2.7b3.tar.gz
Size 382.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a9bed55025908770bc3f36743d3de91c112d372a49eff912a3cf3315562ce450
BLAKE2b-256 checksum
How to use checksums
773449e5c150e110b7df72962648128e5438f6c460478fdae0a2602fc897a058
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.2 CPython/3.12.16 Linux/7.0.0-1019-azure

Release files / novita_sandbox-1.2.7b3-py3-none-any.whl

Download URL novita_sandbox-1.2.7b3-py3-none-any.whl
Size 447.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
057cd9dbf9961802563c09f92c62ef7c714eace7464c0ffeb3d759edf7a48f05
BLAKE2b-256 checksum
How to use checksums
127f6c1e0b1225b1ca1d2fa858cc18540716e2741fb2da2f1e9fe09dad44145d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.2 CPython/3.12.16 Linux/7.0.0-1019-azure

Security for novita-sandbox 1.2.7b3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page