System design interview question · hard · isolation · stateful

Code execution sandbox

Design the backend that runs user-requested Python code for a chat assistant. Each conversation gets a sandbox that keeps files and variables between turns, can install packages, and returns stdout, files and charts.

Practice it as a 50-minute mock interview

  1. Requirements & scope (7 min): Think like a product manager, translate design question to technical requirements, narrow the scope and write the non-functional requirements as numbers.
  2. Estimation (3 min): Size the system: estimate the scale it must handle, find the number that drives the design, and name the first bottleneck.
  3. API & data model (5 min): Write concrete endpoints and entities, and pick stores from access patterns.
  4. High-level architecture & Data flow (10 min): Start with the simplest design that works and trace a request end to end.
  5. Deep dives (20 min): Go deep on the 2–3 hardest parts, with alternatives and a reasoned choice.
  6. Failures, ops & evolution (5 min): Walk each component: what if it dies, slows down, or is overloaded?

More system design interview questions