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

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.7b2
File Size Uploaded Provenance Actions
novita_sandbox-1.2.7b2.tar.gz 382.0 kB Without provenance Details for novita_sandbox-1.2.7b2.tar.gz

Built distribution (wheel)

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

Total release size: 829.1 kB

Release files / novita_sandbox-1.2.7b2.tar.gz

Download URL novita_sandbox-1.2.7b2.tar.gz
Size 382.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8c291be2581f03c76ec80dd8424958364864b8c619d75ab84d4750afeeabfcbe
BLAKE2b-256 checksum
How to use checksums
abfca536757cf842fca1fbae775c4cc768e5d8f0c2ead4ec3117553f7cd6d814
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-1017-azure

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

Download URL novita_sandbox-1.2.7b2-py3-none-any.whl
Size 447.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
35f3e2fffd8bf9b2efb8e04d135317c399882cd9d236e7d22bc852884464d941
BLAKE2b-256 checksum
How to use checksums
205ede563b6dd2fe5a5cfec78efcf7a4d6fe72945355def02c9829f33c286e9f
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-1017-azure

Security for novita-sandbox 1.2.7b2

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