General Introduction
Arrakis is a sandboxed environment designed for AI intelligences to provide a secure, customizable environment. Developed by Abhishek Bhardwaj, hosted on GitHub, and licensed under the AGPL v3, Arrakis isolates AI code and secures the host through lightweight virtual machine (MicroVM) technology. Each sandbox has Ubuntu built-in, starts with its own code execution service and VNC server, and supports a graphical interface. The tool provides Python SDK and REST API to facilitate developers to manage the sandbox. It also supports snapshotting and backtracking, so that AI can be restored to its previous state in case of an error.Arrakis is ideal for developers who need to run code securely or test multi-step processes.
Function List
- secure isolation: Use MicroVM technology to isolate AI code and protect the host and other tasks.
- Snapshots and Backtracking: Supports saving the sandbox state and restoring it to facilitate AI testing of multi-step tasks.
- Python SDK: Provided
py-arrakis
, programmable control sandbox. - REST API: By
arrakis-restserver
Provide interfaces to manage the sandbox. - Graphical User Interace (GUI) (computing): Each sandbox has a built-in VNC server and Chrome with GUI support.
- Network Configuration: Automatic network setup with support for port forwarding and SSH access.
- Customized environments: By
Dockerfile
Adjust the sandbox software and configuration. - MCP Compatible: Support MCP Clients (e.g. Claude Desktop) for easy integration.
Using Help
The installation and use of Arrakis requires a few steps. Here are detailed instructions to help you get started quickly.
Installation process
- Checking system requirements
Arrakis is only supported on Linux systems because it relies on the/dev/kvm
Virtualization. You can check for virtualization support with the command:
stat /dev/kvm
If an error is returned, the host is not supported and virtualization needs to be enabled.
- download and install
Run the following command on Linux to download the pre-built file:
curl -sSL https://raw.githubusercontent.com/abshkbh/arrakis/main/setup/setup.sh | bash
The download generates arrakis-prebuilt
folder containing binaries and images.
- Starting the REST Server
Go to the folder and start the service:
cd arrakis-prebuilt
sudo ./arrakis-restserver
The service runs by default in the 127.0.0.1:7000
. Required sudo
as it relates to virtual machine management.
- Install the Python SDK (optional)
If you want to control the sandbox with Python, install the SDK:
pip install py-arrakis
Main Functions
Creating a Sandbox
- Using the CLI
Create a sandbox:
./arrakis-client start -n my-sandbox
Returns IP and status information for the sandbox.
- Using Python
Created with the SDK:
from arrakis_client import SandboxManager
manager = SandboxManager('http://127.0.0.1:7000')
sandbox = manager.start_sandbox('my-sandbox')
print(sandbox.info())
running code
- CLI method
Execute commands in the sandbox:./arrakis-client run -n my-sandbox --cmd "echo Hello World"
- Python way
Run it with the SDK:sandbox.run_cmd('echo Hello World')
The output is returned to the terminal.
Using the graphical interface
Each sandbox starts up with its own VNC server and Chrome. get connection information:
- Use the CLI:
./arrakis-client info -n my-sandbox
Returns something like
port_forwards: [{'host_port': '3000', 'guest_port': '5901', 'description': 'gui'}]
The - Use Python:
print(sandbox.info()['port_forwards'])
- Connect the VNC:
Connecting with a VNC client (e.g. noVNC)主机IP:3000
The graphical interface can be seen.
Snapshots and Backtracking
- Save Snapshot
Use the CLI:./arrakis-client snapshot -n my-sandbox -o snap1
Use Python:
snapshot_id = sandbox.snapshot('snap1')
- Restore Snapshot
Destroy the sandbox first:./arrakis-client destroy -n my-sandbox
Reinstatement:
./arrakis-client restore -n my-sandbox --snapshot snap1
Or with Python:
sandbox.destroy() sandbox = manager.restore('my-sandbox', snapshot_id)
Customized Sandboxes
- locate
rootfs/Dockerfile
The - Edit to add software, for example:
RUN apt-get update && apt-get install -y vim
- Restart the sandbox:
./arrakis-client start -n my-sandbox --rootfs custom-rootfs
SSH Access
Each sandbox supports SSH:
- Get IP:
./arrakis-client info -n my-sandbox
Returns something like
ip: "10.20.1.2/24"
The - Log in:
ssh elara@10.20.1.2
default user
elara
Passwordelara0000
The
Example of operation flow
Trying to get AI to write files and test backtracking in a sandbox:
- Start the sandbox:
./arrakis-client start -n test-sandbox
- Run command:
./arrakis-client run -n test-sandbox --cmd "echo '第一步' > /tmp/test.txt"
- Save the snapshot:
./arrakis-client snapshot -n test-sandbox -o step1
- Modify the file:
./arrakis-client run -n test-sandbox --cmd "echo '第二步' > /tmp/test.txt"
- Restore snapshots:
./arrakis-client destroy -n test-sandbox ./arrakis-client restore -n test-sandbox --snapshot step1
- Check the file:
./arrakis-client run -n test-sandbox --cmd "cat /tmp/test.txt"
The output should be
第一步
The
For more details, check out GitHub's README.md
The
application scenario
- AI Code Debugging
Developers run untrustworthy code with Arrakis to isolate risk. Backtrack after errors to check for problems. - teaching experiment
The teacher builds a sandbox for students to practice AI programming, which they can manipulate at will without affecting the mainframe. - Multi-step task testing
Enterprises use Arrakis to test AI automated processes, such as web operations or file processing, with support for snapshot recovery.
QA
- Does Arrakis support Windows?
is not supported and currently only runs on Linux because of the dependency on thecloud-hypervisor
The - How do I stop the sandbox?
expense or outlay./arrakis-client stop -n 名称
Stop, ordestroy
Delete. - How much space does a snapshot take up?
Depending on the content of the sandbox, usually a few hundred MB. it is recommended to clean up unused snapshots.