Skip to content

Interview question · Agent Runtime & Sandboxes

Containers, gVisor, Firecracker or Wasm for untrusted generated Python: choose.

The answer starts with two questions, who else shares the machine and what the code must be able to run, and ends with the same list of controls whatever you pick.

hardEssentialNewUpdated Nov 2026

TL;DR: For multi-tenant, untrusted, model-written Python that needs real libraries: a microVM per session (Firecracker or Kata) where the platform supports it, or gVisor where microVMs are impractical, with no credentials inside, deny-by-default egress, a scratch filesystem and hard resource limits. Plain containers are acceptable only for single-tenant or trusted inputs, because every container shares the host kernel. Wasm is excellent for narrow, high-volume functions but usually cannot run arbitrary Python with native packages. Justify the choice by threat, compatibility and start-up cost.

How to approach it

Ask three things before choosing: whose code shares a host (one customer or many), what the code needs (numpy and pandas, system packages, network), and the volume and latency targets. Then compare the four on boundary strength, compatibility, start time and operations, and pick.

A strong answer

The threat. Model-written code is shaped by user uploads and anything else the model read, so treat it as hostile. With many tenants on one host, an escape reaches other customers' data, so the boundary must hold against kernel-level escapes.

The comparison.

ContainergVisorMicroVMWasm
Shares host kernelYesMostly no (user-space kernel)No (own kernel)No (runtime)
Runs arbitrary Python with native packagesYesMostlyYesRarely
Start timeFastFastSub-second to secondsVery fast
Operational effortLowModerateHigher (virtualisation hosts)Moderate
FitsTrusted or single-tenantMulti-tenant, containers' toolingMulti-tenant, strongest general optionNarrow functions

The pick. A microVM per session for a multi-tenant code interpreter running pandas on user files: own kernel, full compatibility, start times hidden by a warm pool. If the platform cannot run microVMs (no nested virtualisation, a managed container service), gVisor is the pragmatic alternative.

The controls that apply whatever you pick.

  • No credentials inside; external access through a broker.
  • Egress denied by default; a package mirror allowed if installs are needed.
  • A scratch filesystem; uploads copied in, nothing mounted from the host.
  • Limits on CPU time, memory, processes, disk and wall-clock, enforced by the runtime.
  • One sandbox per session, destroyed afterwards; never reused across tenants.
  • Instance metadata endpoints blocked.

How you would check it. A test suite of hostile snippets (fork bombs, memory exhaustion, attempts to reach the network or metadata, reads outside the workspace) run against every sandbox image in CI, expecting each to fail safely.

What interviewers probe next

"MicroVMs add start-up time." Firecracker-class microVMs boot in well under a second; the real start cost is workspace and dependencies, solved with snapshots and warm pools.

"Could you use containers with a strict seccomp profile?" That narrows the syscall surface and is a fine extra layer, but the kernel is still shared. For many tenants on one host, it is not the boundary to rely on.

"Where does Wasm fit?" High-volume, short computations with a fixed library set (formula evaluation, data transforms) where its start speed and capability model shine.

What if?

What if · interview follow-ups

Hold your answer as the constraints change

You chose a microVM per session for a multi-tenant code interpreter.

  1. Start here

    What if a customer needs the code to call their internal API?

How it's scored

Weak: "Docker is a sandbox."

Hire: Recognises the shared-kernel risk and picks gVisor or a microVM for multi-tenant code.

Strong Hire: Starts from threat, tenancy and compatibility; compares all four on boundary, compatibility, start time and operations; picks with justification and a fallback; lists the controls that apply regardless; and proves them with hostile-snippet tests in CI.

Common mistakes

  • Treating the model as a trusted author.
  • Reusing sandboxes across sessions or tenants.
  • Credentials in environment variables "because the code needs them".
  • Choosing Wasm without checking that the needed packages run.
You just read a free answer. Every topic opens its first 5 answers to anyone. Sign in and the count per topic goes to 6, and the site remembers where you stopped in each one.Google sign-in · free · no payment details
HOW DID IT GO?
0
READING SIGNED OUT

Signing in raises your free answers from 5 to 6 per topic, adds an applied lesson in every topic and easy practice tests, and the site starts remembering you: mastery per topic, bookmarks, and a next-focus recommendation. Free, no card.

Sign in free
UP NEXT ON YOUR JOURNEY
DISCUSSION · 0

Nobody has commented. Post a correction or another way to answer.