Prerequisites
You need:- a Blaxel account;
- the Blaxel CLI;
- an Amp access token;
- Node.js 24 or Python 3.10 or newer;
- a Git repository that the sandbox can clone.
The sandbox receives
AMP_API_KEY as an environment variable. The example does not print it.1. Install the Blaxel SDK
Create a local project and install one Blaxel SDK:2. Create the Amp sandbox
Createindex.ts or main.py with the following code:
blaxel/amp:latest image includes Amp, Git, and the Blaxel sandbox API. The sandbox keeps its memory and files when it enters standby.
createIfNotExists reuses a sandbox with the same name. Delete and recreate the sandbox after you rotate AMP_API_KEY.3. Run an Amp task
Add the following code after sandbox creation and repository cloning. In Python, add it insidemain().
4. Continue the thread after reconnecting
Your application can reconnect after the sandbox enters standby. Createcontinue.ts or continue.py with the following code. Replace the environment value with the thread ID from the first task.
5. Open Amp in the sandbox terminal
Connect to the same sandbox when you want an interactive session:6. Troubleshoot common failures
Amp rejects the access token
Confirm thatAMP_API_KEY contains an active Amp access token. Delete and recreate an existing sandbox after you rotate the token.
The repository does not clone
Confirm that the sandbox can access the Git host. For a private repository, provide credentials through your approved secret workflow instead of placing them in the script.Amp cannot reach a required service
Allow the domains required by Amp, your Git host, and your dependency registries in the sandbox network policy.A task exits without a successful result
Check the final structuredresult event. Amp can report an error in the event stream, so do not rely only on the process exit code.
The thread does not continue
Reconnect to the same named sandbox and use the exact thread ID from the first task. A different sandbox does not contain the same repository state.7. Delete the sandbox
Delete the sandbox when you finish:Resources
Amp manual
Learn about Amp modes, threads, and command-line options.
Sandbox processes
Run and monitor more commands with Python or TypeScript.
