Overview
The Koyeb Sandbox SDK provides a Python interface for programmatically creating, managing, and interacting with Koyeb sandboxes — ephemeral compute environments designed for isolated code execution on the Koyeb platform.
Why use sandboxes?
A code sandbox is an isolated, ephemeral environment designed to safely run, test, and experiment with code without affecting other systems or requiring complex setup. It provides developers with a virtualized or containerized execution space where dependencies, environment variables, and runtime contexts can be fully controlled and discarded after use.
You should use a code sandbox to:
- Execute untrusted or user-generated code securely
- Prototype applications quickly
- Test APIs or libraries in clean environments
- Demonstrate functionality without configuring local infrastructure
Sandboxes are especially valuable in platforms for AI model evaluation, online coding environments, CI/CD pipelines, and educational tools that require safe, reproducible, and on-demand compute environments.
The Koyeb Sandbox SDK
The Koyeb Sandbox SDK includes both synchronous (Sandbox) and asynchronous (AsyncSandbox) classes, allowing developers to:
- Launch new sandbox instances
- Wait for readiness and TCP proxy availability
- Expose or unexpose internal ports
- Execute background processes and list or terminate them
- Access sandbox filesystem and execution interfaces
- Clean up resources automatically
Get started with sandboxes
Sandboxes are available for users on the Starter, Pro, or Scale plans. Learn more about Koyeb subscription plans (opens in a new tab).
Here's how to get started:
- Walk through the quicksart
- Learn about the lifecycle of a sandbox
- Take actions on files
- Run commands in your sandbox