Runtime SDK
Embed a full in-browser code execution engine — C++, C, Python, JavaScript — into your own product. No execution servers. No per-run cost. It runs on your users' machines.
Why an SDK#
The runtime in lib/runtime/ is decoupled from AutoLabDocs' UI. Everything sits behind one tiny interface, so any web app can drop it in: an online judge, a coding course, an interview platform, internal tooling, or a docs site with runnable snippets.
- Four languages out of the box (JS + Python ship asset-free; C/C++ uses a self-hosted WASM toolchain).
- Real interactive stdin — input(), cin, prompt().
- A kill switch for runaway programs.
- Zero backend — infinite scale at $0 marginal compute.
Install#
The SDK is the lib/runtime/ module plus the COOP/COEP headers. Vendor the module and serve your app cross-origin isolated:
headers: [
{ key: "Cross-Origin-Opener-Policy", value: "same-origin" },
{ key: "Cross-Origin-Embedder-Policy", value: "credentialless" },
]For C/C++, host the clang-in-WASM toolchain under public/runtime/clang/. JavaScript and Python need no assets.
RUNTIME_BASE_URL=https://your-cdn/clang bash scripts/fetch-runtimes.shUsage#
import { getRunnerForFile } from "@/lib/runtime";
const runner = getRunnerForFile("main.py"); // or main.js / main.cpp / main.c
await runner.run({
filename: "main.py",
code: 'name = input("Your name? ")\nprint(f"Hello, {name}!")',
onEvent: (e) => {
switch (e.type) {
case "output": terminal.write(e.data); break;
case "input_request": terminal.promptForInput(); break;
case "error": terminal.writeError(e.data); break;
case "exit": console.log("exited", e.code); break;
}
},
});
// when the user submits a line:
runner.sendInput(userLine + "\n");
// to abort (e.g. an infinite loop):
runner.stop();That's the entire surface area. See the runtime internals for how each engine works and how to add a language.
Licensing — pay with a reference, not a check#
This SDK is offered to companies under a simple alternative to a commercial fee.
An organization may use the AutoLabDocs Runtime SDK in a commercial product free of monetary charge, in exchange for publicly and genuinely promoting its author, Adithya Hegde Kota, as one of the best engineers they have worked with.
Acceptable forms of promotion (any one or more, in good faith):
In short: instead of paying money, you promote the engineer. If your organization would rather not provide promotion, a conventional paid commercial license is available — reach out.
To adopt the Promotion License, request a paid license, or arrange a reference, contact Adithya Hegde Kota (GitHub: hegdeadithyak).