Skip to main content

GROTTE Python SDK

EU-sovereign code execution sandboxes for AI agents and developer workflows. Built by Parallactic AI SAS.

Install

pip install grotte

Quick start

from grotte import Sandbox

sbx = Sandbox.create("base")
result = sbx.commands.run("echo Hello GROTTE")
print(result.stdout)        # Hello GROTTE
sbx.kill()

Async variant:

from grotte import AsyncSandbox

sbx = await AsyncSandbox.create("base")
result = await sbx.commands.run("echo Hello GROTTE")
print(result.stdout)
await sbx.kill()

Authentication

Set your API key as an environment variable:

export GROTTE_API_KEY=grt_your_key_here

Get your API key at app.grotte.dev.

API

Sandbox

sbx = Sandbox.create(template="base", timeout=60)

# Run a command
result = sbx.commands.run("ls -la")
result.stdout    # str
result.stderr    # str
result.exit_code # int

# File operations
sbx.files.write("/tmp/hello.txt", "hi")
content = sbx.files.read("/tmp/hello.txt")
files = sbx.files.list("/tmp")

sbx.kill()

Lifecycle control

# Extend the sandbox before it expires
sbx.set_timeout(600)        # set absolute timeout, seconds
sbx.refresh_ttl(60)         # add 60s to the current TTL

# Pause + resume (paused sandboxes keep filesystem state)
sbx.pause()
restored = Sandbox.connect(sbx.sandbox_id)

# Snapshot the running filesystem to a reusable template
snap = sbx.create_snapshot()
fresh = Sandbox.create(snap.snapshot_id)

Pass lifecycle={"on_timeout": "pause", "auto_resume": True} to Sandbox.create() to make the sandbox auto-pause on timeout and auto-resume on the next request.

Network isolation

Cut egress at runtime — useful for executing untrusted or AI-generated code without giving it internet access.

sbx = Sandbox.create("base")
sbx.set_network(internet_access=False)
sbx.commands.run("curl --max-time 3 https://example.com")  # times out
sbx.set_network(internet_access=True)                      # restore

To start a sandbox with no network from creation, pass allow_internet_access=False to Sandbox.create() (works the same as network={"deny_out": ["0.0.0.0/0"]}).

Templates

Available sandbox environments:

Template Description
base Ubuntu 22.04 + bash
python-3.12 Python 3.12 environment
node-22 Node.js 22 environment

Configuration

sbx = Sandbox.create(
    template="base",
    timeout=60,                # max sandbox lifetime, seconds
    api_key="grt_…",           # override env var
)

License

MIT · Based on E2B SDK by FoundryLabs, Inc. See NOTICE for full attribution and a summary of significant changes.

Metadata

Release files for grotte 0.2.0

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

Source distribution (sdist)

Source distribution for grotte 0.2.0
File Size Uploaded Provenance Actions
grotte-0.2.0.tar.gz 161.1 kB Without provenance Details for grotte-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for grotte 0.2.0
File Interpreter ABI Platform Actions
grotte-0.2.0-py3-none-any.whl Python 3 none any Details for grotte-0.2.0-py3-none-any.whl

Total release size: 464.2 kB

Release files / grotte-0.2.0.tar.gz

Download URL grotte-0.2.0.tar.gz
Size 161.1 kB
Tags Source
SHA-256 checksum
How to use checksums
dce4a446c4c46a2b5cadfef38ce0ae4ae4664939d3d8a4fcb24883c14d6b4abe
BLAKE2b-256 checksum
How to use checksums
68ebf8d46eb59ccee84bce0461f699a390b0f0bbe164ef57211cf87a8d6030b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.0 CPython/3.12.3 Linux/6.17.0-23-generic

Release files / grotte-0.2.0-py3-none-any.whl

Download URL grotte-0.2.0-py3-none-any.whl
Size 303.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d40b29dc3cb0425f8a24804af4db729c2cfe6574349ad134dc840691da1c357
BLAKE2b-256 checksum
How to use checksums
e2ba77164897efd035500ead971f42d4056d2bf50e8cd96955443a04cc2d4ac8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.0 CPython/3.12.3 Linux/6.17.0-23-generic

Security for grotte 0.2.0

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.

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