Daytona
Mount an AIStor Memory Bucket at /workspace in a Daytona linux-vm sandbox, so the agent's work survives sandbox teardown.
A Daytona sandbox is deleted when the agent's run ends. AIStor Memory mounts a
Memory Bucket at /workspace, so the files the agent works on and the memory
it keeps are stored in your AIStor. The next sandbox mounts the same bucket
and starts where the last one stopped.
Use a Daytona linux-vm sandbox. Many Daytona container sandboxes do
not have /dev/fuse and cannot create it, so the mount fails there. A
linux-vm sandbox has full kernel and device access.
Prerequisites
Use a Memory Bucket
aimem mounts only a Memory Bucket. See
Prerequisites.
- A Daytona API key with the
snapshot:createscope. Alinux-vmsandbox is created from a snapshot. - Python 3 on the machine that runs the example.
- An AIStor endpoint that Daytona's network can reach, and signing credentials for it. Standard Daytona plans allow outbound HTTPS to public host names.
Quick start
Download the example, then run it from that directory:
mkdir aimem-daytona && cd aimem-daytona
base=https://docs.min.io/aimem/examples/daytona
for f in aimem-mount aimem-setup.sh contract.py usage.py; do
curl -fsSLO "$base/$f"
done
chmod +x aimem-mount aimem-setup.sh
DAYTONA_API_KEY=... \
AIMEM_BUCKET=my-project \
AIMEM_ENDPOINT=https://aistor.example.com \
AIMEM_ACCESS_KEY=... \
AIMEM_SECRET_KEY=... \
python3 usage.pyIf the Daytona Python SDK is not installed, usage.py installs it in
~/.cache/daytona-aimem. The example downloads the released aimem binary,
so you do not need to build anything.
When the command returns, the sandbox is still running. The last line on
standard error prints the sandbox ID and confirms that /workspace is the
AIStor Memory mount. To delete the sandbox when the command ends, set
DAYTONA_DELETE_ON_EXIT=1.
What usage.py does
| Step | Action |
|---|---|
| Snapshot | Creates a linux-vm snapshot from a stock OS image (ubuntu:24.04) |
| Sandbox | Creates the sandbox from the snapshot as os_user="root" |
| Install | Uploads and runs aimem-setup.sh, which installs aimem and the aimem-mount wrapper |
| Mount | Runs aimem-mount in a Daytona process session, which mounts the bucket at /workspace |
| Agent commands | Removes the storage credentials, then runs list, read, and write commands through sandbox.process.exec |
| Clean up | Deletes the snapshot; deletes the sandbox only if DAYTONA_DELETE_ON_EXIT=1 |
The bucket name, endpoint, and credentials reach the mount through
/root/aimem.env, a file only root can read. They never appear on a command
line, in env_vars, or in an image layer.
Writes are staged in /tmp/aimem-staging and uploaded to the bucket when the
file is closed.
Options
AIMEM_MOUNTPOINTsets the mount path. The default is/workspace.AIMEM_LOCALsets the staging directory. The default is/tmp/aimem-staging.AIMEM_REGION,AIMEM_PREFIX,AIMEM_AGENT, andAIMEM_ALLOW_OTHER=trueare passed toaimem-mount.- For an offline install, put a Linux
aimembinary inbin/in the example directory.aimem-setup.shinstalls it instead of downloading the release.
How FUSE works here
The sandbox runs as root, so aimem opens /dev/fuse and mounts directly,
with no setuid helper. If the device node is not there yet, aimem-mount
waits for it, and then creates it with mknod, which needs CAP_MKNOD. A
sandbox that has neither the device nor CAP_MKNOD cannot mount.
Reference
usage.py,aimem-setup.sh, andaimem-mount: the example.usage.pyalso needscontract.py, the checks it runs through the mount.- Daytona Sandboxes: the sandbox lifecycle.
- Daytona Python SDK:
CreateSnapshotParams(sandbox_class=SandboxClass.LINUX_VM)andCreateSandboxFromSnapshotParams(os_user="root"). - Daytona Snapshots: VM snapshots and
SandboxClass.LINUX_VM.