daytona in Python, @daytonaio/sdk in TypeScript) and
should run on InstaBox instead. A Daytona sandbox is an InstaBox machine: a full Linux VM with a
persistent disk at /data, created from a template or a snapshot. Most calls map one to one. The
differences are in What has no equivalent.
Concept map
Move your code
1
Install the SDK and set the key
Create an API key on API keys in the dashboard. See API keys.The TypeScript steps need SDK 0.8.0 or later, the first version with
sbx.ports.Remove DAYTONA_API_KEY, DAYTONA_API_URL and DAYTONA_TARGET. InstaBox machines have no region to
pick.2
Create a machine
create waits until the machine runs. The machine pauses itself after idle
minutes, which replaces Daytona’s auto-stop. To set another idle time on a paid plan, pass
auto_suspend_after_seconds (Python) or autoSuspendMs (TypeScript).3
Run commands and code
result is InstaBox’s stdout. InstaBox also returns stderr on its own. In Python, a
non-zero exit is a result, as in Daytona: read exit_code. In TypeScript, sbx.commands.run throws
CommandExitError on a non-zero exit, and the error carries exitCode, stdout and stderr.4
Move files
client.files.write(box.id, path, open("in.txt", "rb")).
To copy a whole directory, use client.files.upload(box.id, "local_dir", "/data/home/app") and
download. For create_folder, move_files, find_files, replace_in_files and
set_file_permissions, run mkdir -p, mv, grep, sed or chmod with exec.5
Run git
git command too: git -C /data/home/repo add -A, commit, push. For a
private repository, give the machine a token from your secret store as an env value. See
Environment and secrets.6
Serve a port at a URL
Start the server detached, so it keeps running after the command returns. Then publish the port.
sbx.ports needs @insforge/instabox-sdk 0.8.0 or later. Older versions have no ports, so call
the API as the Python tab does. The Python SDK has no ports call yet, so the Python tab calls the API with httpx, which
pip install instabox-sdk installs. The URL answers once the server listens, so retry the first
request for a few seconds. A port is public by default, like a Daytona sandbox with public=True. For a link only some people
can open, publish it with "access": "private" (TypeScript { access: 'private' }). Share the
returned tokenUrl, or send Authorization: Bearer <token> from scripts. A visit to the URL wakes a
machine that paused itself. See Public and private ports.7
Stop, pause and delete
Find machines by label
Bring your image
Daytona builds snapshots from images. InstaBox imports a Docker or OCI image from a registry as a snapshot, then creates machines from it:Sandbox.create('py312') takes the snapshot name. A Dockerfile must be built and pushed to
a registry first. To save a machine you set up by hand, use client.snapshots.create(box.id, "my-env").
See Custom images and Snapshots.
What has no equivalent
Let your coding agent do the port
Paste this prompt into your coding agent, in your repository:Troubleshooting
A background server stops when the command returns
A background server stops when the command returns
Start it with
setsid nohup <cmd> >/tmp/log 2>&1 < /dev/null &, so it leaves the command’s session.
In TypeScript, use sbx.commands.run(cmd, { background: true }).The port URL answers 503
The port URL answers 503
The machine is paused by you, stopped, or the server in it is not listening yet. Resume or start the
machine, then check the server with
curl localhost:<port> through exec.Create fails with template_not_allowed or spec_not_allowed
Create fails with template_not_allowed or spec_not_allowed
The free plan creates from only, and each plan has fixed sizes. See
Sizes and create options.
A command has no git, Node.js or Python
A command has no git, Node.js or Python
The default template,
agent-browser, has all three. A machine from an imported image has what the
image has, so install the tool in the image or with exec.Python SDK
Every Python call and error.
SDK quick start
The same steps in TypeScript and HTTP.