Skip to main content

Pattern · Safety

Least privilege and sandboxing

Give each tool the narrowest access, and run generated code in a locked-down sandbox.

Say it in the interview

I would give each tool its own narrow role, with read-only views and row filters for data, and run generated code in a container with no network, no secrets and hard CPU and time limits, so the worst case stays small.

When to use it

  • Agents that query data or run code
  • Tools that touch production systems

How it works

  1. Agent → Query tool (read-only role, row filters)
  2. Agent → Code runner (container, no network, no secrets, CPU and time caps)
  3. Agent → No delete tool, no shell on the host
  4. Code runner (container, no network, no secrets, CPU and time caps) → Only charts and CSVs come out

Trade-offs

  • Limits the blast radius of any failure
  • More setup per tool

Pitfalls interviewers probe

  • One admin key shared by every tool
  • A sandbox with network access

Practise it on these questions

Today's AI turns are used

Lessons, roadmaps, videos, practice cards and the code playground stay free with your account, with no limit.