All-in-One (AIO) Sandbox Example
This example demonstrates how to create and access an All-in-One (AIO) Sandbox via Agent-Sandbox.
Create an AIO Sandbox
Apply the sandbox manifest with AIO Sandbox runtime. You can find the latest version here.
kubectl apply -f aio-sandbox.yaml
# sandbox.agents.x-k8s.io/aio-sandbox-example created
They can then check the status of the applied resource. Verify sandbox and pod are running:
# wait until the sandbox is ready
kubectl wait --for=condition=Ready sandbox aio-sandbox-example
kubectl get sandbox
# NAME AGE
# aio-sandbox-example 41s
kubectl get pod aio-sandbox-example
# NAME READY STATUS RESTARTS AGE
# aio-sandbox-example 1/1 Running 0 49s
The AIO Sandbox has multiple tools pre-installed, including VNC, VSCode, Jupyter and Terminal in one unified environment.
Accessing the AIO Sandbox Server
Port forward the aio-sandbox server port.
# set ingress host and port
export INGRESS_HOST="localhost"
export INGRESS_PORT="8080"
# port forward to the aio-sandbox pod
kubectl port-forward --address ${INGRESS_HOST} pod/aio-sandbox-example ${INGRESS_PORT}:8080
Setup GATEWAY_URL environment variable:
export GATEWAY_URL="http://${INGRESS_HOST}:${INGRESS_PORT}"
echo "$GATEWAY_URL"
# http://localhost:8080
Connect to the aio-sandbox on a browser via http://<INGRESS_HOST>:<INGRESS_PORT>
Access the AIO Sandbox via Python SDK
# set up a virtual environment if needed
python3 -m venv venv
source venv/bin/activate
# install the agent-sandbox package
pip install agent-sandbox==0.0.18
Note: The
agent-sandboxPython SDK installed above is for controlling tools inside the AIO sandbox (e.g., browser, shell, file system). If you want to programmatically provision or manage sandbox infrastructure (Kubernetes resource lifecycle), use the complementaryagentic-sandbox-clientPython SDK. These two SDKs can be used together for a complete infrastructure + application workflow.
Run the basic python example:
python3 main.py
More examples
For more examples of using the AIO Sandbox, refer to agents-infra/sandbox examples.
Cleanup
To remove the sandbox and related resources when you are done, run:
kubectl delete -f aio-sandbox.yaml
# Cleanup sandbox_screenshot.png from main.py if needed
rm sandbox_screenshot.png
References
Feedback
Was this page helpful?