Sandboxing generated code and defending against prompt injection
MediumSystem design20 minSWEMLEPro outline
The question
Your agent runs code it writes and reads web pages and documents. How do you keep code execution safe, and how do you defend against injected instructions and attempts to leak the system prompt?
What the interviewer is looking for
- Runs code in an isolated sandbox with limits
- Marks external content as untrusted data
- Applies least privilege to tools and confirms risky writes
- Filters outputs for secrets
- Keeps no secrets in the system prompt in the first place
Your answer
Saved in this browser only. Nobody else sees it.
Why this question
Written by BlogLLM in the style of a publicly reported Moonshot AI (Kimi) question type: tool failure handling and retries; sandboxed code execution; prompt injection and system prompt leaks; agent evaluation metrics.
Reported in: mj.mianlingai.com
Practice question written by BlogLLM based on publicly reported interview formats. Not an official Moonshot AI (Kimi) question.