Sandboxed Code Execution as an API

OnlineCompiler.io is a sandboxed code execution platform for 12 languages, with a REST API, WebSocket support, an embeddable widget, and MCP support for AI agents.

Category

Product Engineering / Open-Source SaaS Platform

Project Type

Internal product / open-source platform

Audience

Startups, SMBs, and self-hosted software users

The Problem

Running arbitrary user code is a problem most teams would rather not own. Doing it safely means container isolation, resource limits, and careful handling of anything that touches the network or filesystem, which is a lot of infrastructure to build for what is usually a small product feature.

OnlineCompiler.io turns that into an API call. Education platforms, documentation sites, and AI agents can execute code without operating the sandbox themselves.

What We Built

  • sandboxed execution across 12 programming languages
  • REST API for synchronous execution
  • WebSocket support for streaming output
  • embeddable widget for documentation and learning sites
  • MCP support so AI agents can execute code as a tool
  • resource limits and execution timeouts

Why This Was More Than a Code Runner

Executing untrusted code as a service means the security model is the product. Every design decision follows from containing what runs.

isolating untrusted code without making cold starts unusable

streaming output over WebSockets while keeping the sandbox sealed

supporting 12 language toolchains with predictable behaviour

exposing execution to AI agents through MCP safely

keeping per-execution cost low enough for an API product

Technology Stack

PythonFastAPIDockerKubernetesWebSocketsRedisPostgreSQLAWS

Outcome

  • live in production at onlinecompiler.io
  • supports 12 languages behind one API
  • MCP support makes it directly usable as an AI agent tool
  • embeddable widget extends it beyond the API surface

Need Sandboxed Execution or a Developer API?

If you need a senior engineering partner for a self-hosted platform, operational product, or full-stack SaaS build, MicroPyramid can help.

Book a Discovery Call See Open Source Work