Python SDK for Tenki Sandbox
Project description
Tenki Sandbox Python SDK
Python SDK for Tenki Sandbox: cloud sandboxes for AI agents and code execution.
pip install tenki-sandbox
from tenki_sandbox import Sandbox
with Sandbox.create(project_id="proj_123", cpu_cores=2, memory_mb=4096) as sb:
result = sb.exec("python3", "-c", "print('hello')")
result.check()
print(result.stdout_text)
sb.fs.write_text("/workspace/input.txt", "data")
print(sb.fs.read_text("/workspace/input.txt"))
preview = sb.expose_port(3000, ttl=3600)
print(preview.url)
Auth
Auth resolution:
auth_token=passed toClientorSandbox.createTENKI_AUTH_TOKENTENKI_API_KEY
TENKI_API_ENDPOINT overrides the API URL; legacy TENKI_API_URL is also accepted.
Process API
exec collects stdout/stderr and returns a result:
result = sb.exec("npm", "test", timeout=60, env={"CI": "1"})
print(result.stdout_text)
result.check()
start returns a live process:
proc = sb.start("bash", "-lc", "read name; echo hello $name")
proc.write_stdin("tenki\n")
proc.close_stdin()
for chunk in proc.stdout:
print(chunk.decode(), end="")
proc.wait().check()
Use shell() when you want shell parsing:
sb.shell("python3 -m http.server 3000 >/tmp/server.log 2>&1 &")
Resource APIs
from tenki_sandbox import Client, GiB
client = Client()
volume = client.volumes.create(
workspace_id="ws_123",
name="cache",
size_bytes=10 * GiB,
project_id="proj_123",
)
preview = client.preview_urls.create(
project_id="proj_123",
slug="demo",
session_id=sb.id,
port=3000,
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tenki_sandbox-0.1.0.tar.gz.
File metadata
- Download URL: tenki_sandbox-0.1.0.tar.gz
- Upload date:
- Size: 101.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26f81b8f2924c2c7c3e6e9730822999de09eddb6facda1c449f3de050166b4e8
|
|
| MD5 |
9d11280b90963f503494419a095ca52e
|
|
| BLAKE2b-256 |
978b176f71a69fa24699a97139baf9ec314db3113b01576267f961445e7cf2da
|
Provenance
The following attestation bundles were made for tenki_sandbox-0.1.0.tar.gz:
Publisher:
pypi-publish.yml on TenkiCloud/tenki-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tenki_sandbox-0.1.0.tar.gz -
Subject digest:
26f81b8f2924c2c7c3e6e9730822999de09eddb6facda1c449f3de050166b4e8 - Sigstore transparency entry: 1772095572
- Sigstore integration time:
-
Permalink:
TenkiCloud/tenki-sdk-python@43a666bc4322226aaed3e87dc5c9cdb91b67904d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/TenkiCloud
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
self-hosted -
Publication workflow:
pypi-publish.yml@43a666bc4322226aaed3e87dc5c9cdb91b67904d -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file tenki_sandbox-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tenki_sandbox-0.1.0-py3-none-any.whl
- Upload date:
- Size: 91.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83ac36b86476351dd41203138aac84bec7e4c067e053a1a8cfece7501346f9a6
|
|
| MD5 |
ecd396d1416ffd5e3c8f9069a0e58b32
|
|
| BLAKE2b-256 |
572ef527ae9a43893482fc12d96b54157dbe4580e72c2714e123719b78564e55
|
Provenance
The following attestation bundles were made for tenki_sandbox-0.1.0-py3-none-any.whl:
Publisher:
pypi-publish.yml on TenkiCloud/tenki-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tenki_sandbox-0.1.0-py3-none-any.whl -
Subject digest:
83ac36b86476351dd41203138aac84bec7e4c067e053a1a8cfece7501346f9a6 - Sigstore transparency entry: 1772095687
- Sigstore integration time:
-
Permalink:
TenkiCloud/tenki-sdk-python@43a666bc4322226aaed3e87dc5c9cdb91b67904d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/TenkiCloud
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
self-hosted -
Publication workflow:
pypi-publish.yml@43a666bc4322226aaed3e87dc5c9cdb91b67904d -
Trigger Event:
workflow_dispatch
-
Statement type: