Requirements: Python 3.10+ or Node.js 20+.
Set up and run the example
1
Create an API key
Open the API Keys page of the console and select Add New Key. Keep the key for the environment setup step.
2
Install the SDK
Install the package for the language the example runs in.
3
Set environment variables
Set two environment variables before running any example. Replace The SDK and the CLI read both variables from the environment.
<your-api-key> with a key from the API Keys page of the console.- macOS and Linux
- Windows (PowerShell)
Selects the Agent Sandbox service for ppio.ai. Without it, the SDK and the CLI connect to their built-in default service instead.
These commands set the variables for the current terminal session only.
4
Run the example
The program creates a sandbox, runs one line of Python inside it, and lists the entries under
/tmp. Save it as main.py or index.mts, then run the saved file.5
Clean up
Close the sandbox when it is no longer needed. Both examples do this by calling
kill() in a finally block.A finished run prints the execution logs, which contain
hello world, followed by the entries under /tmp.Next steps
Create a sandbox
Choose a template and set the timeout, environment variables and metadata.
Agent Sandbox overview
Learn the core concepts: sandboxes, templates and snapshots.