Skip to main content
This example shows the complete developer loop: receive code, create a sandbox, write a file, execute it, return output, and always destroy the sandbox.

Prerequisites

  • A running StacyVM server.
  • Docker provider access on the StacyVM host.
  • Python 3.9+.
  • A StacyVM API key if auth is enabled.
The source lives in examples/code-runner-python.

Install

Configure

Run The App

Submit Code

Response

Why This Pattern Works

  • The sandbox gets a short TTL so idle work is cleaned up.
  • The app destroys the sandbox in a finally block.
  • User code is written to a file instead of interpolated into a shell command.
  • Runtime failures are returned as normal execution results.
  • Provider failures return a clear API error.

Production Notes

Before exposing a code runner to users, add authentication to your app, per-user quotas, request size limits, audit logging, and runtime certification for the host you are using.