Skip to content

How we sandbox AI agents with three-tier approvals

The two halves of running an AI agent safely on a shared cloud — a locked-down pod with a narrow network, and a permission model where destructive actions wait for one specific human approval.

Fullsea engineering6 min read

  • security
  • agents
  • kubernetes

When you ask Fullsea's builder for an app, a real agent — Claude Code — runs commands, installs packages, writes files and calls our API on your behalf. That raises two separate questions, and it helps to keep them apart:

  1. What can the agent's process touch? It runs arbitrary code: npm install executes other people's install scripts. The answer has to hold even if the agent, or a package, does something hostile.
  2. What can the agent do to your account? It holds a token that can create and delete things. The answer has to hold even when the agent is simply wrong.

The first is a sandbox. The second is a permission model. Here is how each works today.

The sandbox: one pod per project

Each builder project gets its own Kubernetes pod in a namespace reserved for agents, with its workspace on a persistent volume. The pod's settings are the strictest Kubernetes offers:

  • runs as an unprivileged user (uid 1000), with a read-only root filesystem — only the workspace, the home directory and /tmp are writable;
  • every Linux capability dropped, privilege escalation off, the runtime's default seccomp profile;
  • no service-account token mounted and no service links, so nothing inside can talk to the Kubernetes API as anyone;
  • limits on CPU, memory and scratch disk, and a hard lifetime after which the pod is replaced;
  • the gVisor runtime when the cluster offers it, which puts a user-space kernel between the agent and the host.

The pod's main process does nothing but wait. Each agent session is started inside it through the Kubernetes exec API, so restarting an agent — after a crash, or when you change your Claude connection — does not recreate the pod or touch the workspace. An idle agent is stopped, and an idle pod exits on its own; the next prompt starts a fresh one on the same volume.

The credential never lands anywhere

The agent needs an Anthropic credential, and that credential is exactly what a malicious package would look for. It is not in the pod spec, not in a Kubernetes Secret, not in a command-line argument and not in the process list. It is written as the first line of the agent's standard input, read by a tiny wrapper that rebuilds the environment from scratch — PATH, HOME, LANG, PORT and the credential, nothing else — and then replaces itself with the agent. No Fullsea or Kubernetes variables leak in.

In our live test against the cluster, the agent process saw exactly those five variables; its effective, permitted and bounding capability sets were empty; and the credential appeared in neither ps, the pod object nor any Secret.

A narrow network

The agent needs the internet — package registries, documentation, your Git host — and Fullsea's own API for its tools. It needs nothing else. The agents' namespace starts from deny everything and then allows:

  • DNS;
  • the internet, minus every private and link-local range (10/8, 172.16/12, 192.168/16, 100.64/10 and 169.254/16 — the last one covers cloud metadata endpoints) and minus port 25, so no spam leaves from a sandbox;
  • Fullsea's API, explicitly, for the tools.

The live test checks both sides: the npm registry and our API answer; another tenant's pod, the Kubernetes API, the cluster's registry on the LAN and 169.254.169.254 do not.

Builds are sandboxed too

When the agent deploys, the workspace is built into an image by a rootless BuildKit job — one job per build, in its own namespace, with CPU, memory and time limits and the same network policy. A RUN step in someone's Dockerfile cannot reach the cluster, the LAN or a metadata endpoint either. We will be honest about the trade-off: rootless BuildKit needs relaxed seccomp and AppArmor profiles and two capabilities to map user ids. We contain that with one short-lived job per build, hard limits, a deadline and the deny-by-default network.

The permission model: three tiers

The agent talks to Fullsea through MCP with a token scoped to you, the project and the session; it expires and is revoked when the agent stops. Through it the agent has the same tools as the dashboard, and every tool has a tier.

Tier Examples Behaviour
1 — read list apps, read logs and metrics, inspect a schema runs at once
2 — routine create an app or database, deploy, restart, set variables, take a backup runs within the plan's limits and says what it changed
3 — destructive delete an app, database, volume or stack; restore a backup; remove a domain; unset variables waits for a person

Tiers are not only per tool. Some calls escalate to Tier 3 because of their arguments:

  • Large scale-ups — raising memory by a gigabyte or more, or by more than half of what the plan holds. Accidentally quadrupling a bill is destructive too.
  • Destructive SQL — the agent runs SQL through the database's own client, and a classifier reads each statement first. Reads run in a read-only session; DROP, TRUNCATE, DELETE, ALTER and an UPDATE without a WHERE need approval, and client commands such as COPY are refused outright.
  • Opening a database to the internet, or widening the address ranges allowed to connect. Closing and narrowing stay routine.

Calls that would be refused anyway — a size the plan does not include, a quota the change does not fit — are never sent for approval. Asking a person to approve something that cannot happen trains them to click without reading.

What an approval is

When a Tier-3 call arrives from the builder, Fullsea records a pending approval with two parts:

  • a summary in one sentence — "Scale the app api from small × 1 to large × 1 (512 → 2048 MiB of memory)";
  • an impact — the target, what is removed, what data is lost for good, whether it can be undone, and the effect on the plan and the bill.

The chat shows them on an Approve / Reject card, and the tool call waits for up to five minutes. Approve and the call continues; reject and the agent is told you declined, and carries on without it. If nobody answers in time, the agent is told to try again later, and the approval stays open.

Each approval is bound to a subject that names the exact change: this app, scaled to this size; this database, running this SQL (by its hash); this backup, restored into this target. Approving one change never approves another, whatever name the agent used, and a retried call finds the same approval instead of asking twice. Unused approvals expire after a day, and stopping a turn expires its pending ones.

Your own agent, connected with an API key, cannot show a card in our UI. For it, a Tier-3 call without confirm: true changes nothing and returns the same impact in words; the agent is expected to show it to you and only then confirm.

Money has a guardrail too

A turn on Fullsea's Claude key is paid from your AI credit. Before a turn starts, a small amount is reserved; while it runs, every cost update is checked against what you had available when the turn began, and the turn is stopped — with a sentence saying why — before it overspends. When it ends, the reservation settles to what it actually cost.

Why both halves

A sandbox alone would let a well-contained agent delete your production database through a perfectly legitimate API call. Approvals alone would let a compromised package read the credential from the environment. Together, the agent's process can reach only what a package installer needs, and its token can do only what you would do — with the irreversible parts waiting for you to read what they do and say yes.

Build something real today.

Describe an app and Fullsea builds it, deploys it with its database and keeps it running.