Encased — AI agent security

Runtime connections · review starting points

Connect the worker. Preserve the boundary.

Five Docker-oriented starting points for running an AI agent worker while keeping credentials, action approval and external effects on the trusted customer side.

These examples are not qualified integrations. They preserve reviewable starting boundaries; they do not install a complete broker, prove containment or replace independent Linux testing. The nine reference Docker probes for Python 0.3.2 passed on 10 November 2026 in a builder-run Linux test (9 passed, 0 failed, 0 skipped). This does not qualify these connection patterns; independent review remains pending.

The shared rule: untrusted code does not dispatch effects

01 · Worker

Credentialless and constrained

Run untrusted agent code without provider keys, general internet, Docker control or broad host mounts.

02 · Broker

Customer-side and fail-closed

A reviewed host service validates the frozen operation, obtains the workspace decision and holds the credentials.

03 · Effect

Explicitly approved

Only an allowed registered action may dispatch. Pending, denied, malformed or unavailable decisions must not execute.

Reference worker + host broker

Docker Compose

Where it fits

A single disposable Linux host running the reference worker and a separately reviewed host broker.

Containment boundary

The worker gets no route to the internet. Only the per-run broker directory crosses the container boundary; the host broker holds credentials and performs permitted effects.

Qualification limit: Compose starts the worker only. It does not install or qualify the broker, choose socket permissions, review images or prove containment. Build, push and pull the worker by manifest digest before using this file.

isolation-worker.Dockerfile

# Build with: docker build --build-arg BASE=repository@sha256:<64-hex-digest> .
ARG BASE
FROM ${BASE}
WORKDIR /opt/agent
COPY . /opt/agent
RUN pip install --no-cache-dir . && useradd --uid 10001 --create-home agent
USER 10001:10001
ENTRYPOINT ["python", "examples/isolated_agent.py"]

compose.yaml

services:
  worker:
    image: ${WORKER:?Set a reviewed repository@sha256 worker digest}
    network_mode: none
    read_only: true
    cap_drop: [ALL]
    security_opt:
      - no-new-privileges:true
    pids_limit: 128
    mem_limit: 512m
    cpus: 1.0
    tmpfs:
      - /tmp:size=64m,mode=1777
    volumes:
      # Dedicated per-run directory containing only the broker socket.
      # Set host ownership/mode for worker UID 10001 and the broker first.
      - ./run:/run/encased:rw

Replace every example registry and digest with the exact reviewed artefact. Never paste credentials into a Dockerfile, build argument, image or evidence log.

Additional host-kernel boundary

gVisor

Where it fits

A proposed runtime hardening trial on a supported disposable Linux host, after recording the baseline Docker run.

Containment boundary

runsc interposes an application kernel between the worker and host. Encased remains responsible for action decisions; network-none and credential absence remain separate controls.

Qualification limit: This is not a qualified gVisor pairing. The command deliberately mounts no broker socket: gVisor host Unix-socket support needs a narrowly scoped reviewed exception and fresh tests before any broker exchange.

isolation-worker.Dockerfile

# Build with: docker build --build-arg BASE=repository@sha256:<64-hex-digest> .
ARG BASE
FROM ${BASE}
WORKDIR /opt/agent
COPY . /opt/agent
RUN pip install --no-cache-dir . && useradd --uid 10001 --create-home agent
USER 10001:10001
ENTRYPOINT ["python", "examples/isolated_agent.py"]

Offline runsc review command

export WORKER='registry.example/encased-worker@sha256:REPLACE_WITH_REVIEWED_64_HEX_DIGEST'
docker run --rm --name encased-gvisor-review \
  --runtime=runsc \
  --network=none \
  --read-only \
  --cap-drop=ALL \
  --security-opt=no-new-privileges \
  --pids-limit=128 \
  --memory=512m \
  --cpus=1 \
  --tmpfs /tmp:size=64m,mode=1777 \
  "$WORKER"

Replace every example registry and digest with the exact reviewed artefact. Never paste credentials into a Dockerfile, build argument, image or evidence log.

Remote sandbox evaluation

E2B

Where it fits

Evaluating a managed remote sandbox without placing provider credentials or the customer-side broker inside untrusted code.

Containment boundary

E2B may isolate remote code execution; Encased action approval and broker effects must remain outside that sandbox. Internet and inbound access require their own explicit settings.

Qualification limit: No E2B integration or equivalence to Linux network-none is claimed. The reference local socket cannot cross to a separate customer host unchanged; request identity, replay refusal, cancellation and failure handling need a reviewed bridge.

isolation-worker.Dockerfile

# Build with: docker build --build-arg BASE=repository@sha256:<64-hex-digest> .
ARG BASE
FROM ${BASE}
WORKDIR /opt/agent
COPY . /opt/agent
RUN pip install --no-cache-dir . && useradd --uid 10001 --create-home agent
USER 10001:10001
ENTRYPOINT ["python", "examples/isolated_agent.py"]

E2B review checklist — not executable configuration

# Build a custom sandbox template using E2B's current official workflow.
# Use the adjacent Dockerfile only as a starting point.
# Before any synthetic trial, verify and record:
# 1. Internet access is disabled in the actual sandbox settings.
# 2. Inbound access is restricted.
# 3. No provider, registry or broker credentials exist in the sandbox.
# 4. No local /run/encased/broker.sock is assumed to exist.
# 5. Any future broker bridge authenticates requests, binds action identity,
#    refuses replays and fails closed on timeout or cancellation.

Replace every example registry and digest with the exact reviewed artefact. Never paste credentials into a Dockerfile, build argument, image or evidence log.

Offline pod + default-deny policy

Kubernetes

Where it fits

A cluster review environment where a platform engineer can verify admission, runtime, network policy and node boundaries.

Containment boundary

The pod has no service-account token, host network, privileges or writable root filesystem. The accompanying policy denies pod traffic; no broker channel is opened by this example.

Qualification limit: A NetworkPolicy works only with an enforcing CNI and correct policy coverage. This offline pod has no broker exchange and is not a production deployment. Cluster, node, admission and image supply-chain controls need separate review.

isolation-worker.Dockerfile

# Build with: docker build --build-arg BASE=repository@sha256:<64-hex-digest> .
ARG BASE
FROM ${BASE}
WORKDIR /opt/agent
COPY . /opt/agent
RUN pip install --no-cache-dir . && useradd --uid 10001 --create-home agent
USER 10001:10001
ENTRYPOINT ["python", "examples/isolated_agent.py"]

worker-pod.yaml — substitute WORKER with envsubst before applying

apiVersion: v1
kind: Pod
metadata:
  name: encased-worker-review
  labels:
    app: encased-worker-review
spec:
  automountServiceAccountToken: false
  hostNetwork: false
  containers:
    - name: worker
      image: ${WORKER}
      securityContext:
        runAsNonRoot: true
        runAsUser: 10001
        allowPrivilegeEscalation: false
        readOnlyRootFilesystem: true
        capabilities:
          drop: [ALL]
        seccompProfile:
          type: RuntimeDefault
      resources:
        requests:
          cpu: 250m
          memory: 256Mi
        limits:
          cpu: "1"
          memory: 512Mi
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: encased-worker-deny-all
spec:
  podSelector:
    matchLabels:
      app: encased-worker-review
  policyTypes: [Ingress, Egress]

Replace every example registry and digest with the exact reviewed artefact. Never paste credentials into a Dockerfile, build argument, image or evidence log.

Per-run host-private broker channel

Local Socket

Where it fits

The reference single-host design, with a host-private broker and a fresh directory for each synthetic run.

Containment boundary

The worker can request a typed registered operation through the per-run socket. It cannot run Docker, reach the host network or dispatch effects itself; the broker freezes, checks and performs allowed operations.

Qualification limit: The directory and broker are not created by this command. A reviewed setup must restrict access to the worker UID and broker, bind each request to its run and stop dispatch on errors, denial, timeout or pending review.

isolation-worker.Dockerfile

# Build with: docker build --build-arg BASE=repository@sha256:<64-hex-digest> .
ARG BASE
FROM ${BASE}
WORKDIR /opt/agent
COPY . /opt/agent
RUN pip install --no-cache-dir . && useradd --uid 10001 --create-home agent
USER 10001:10001
ENTRYPOINT ["python", "examples/isolated_agent.py"]

Per-run local-socket worker command

export WORKER='registry.example/encased-worker@sha256:REPLACE_WITH_REVIEWED_64_HEX_DIGEST'
export ENCASED_RUN_DIR="$PWD/run"
install -d -m 700 "$ENCASED_RUN_DIR"
# First have the reviewed host-broker setup create broker.sock here and
# restrict this per-run directory to the broker and worker UID 10001.
docker run --rm --name encased-socket-review \
  --network=none \
  --read-only \
  --cap-drop=ALL \
  --security-opt=no-new-privileges \
  --pids-limit=128 \
  --memory=512m \
  --cpus=1 \
  --tmpfs /tmp:size=64m,mode=1777 \
  --mount "type=bind,source=$ENCASED_RUN_DIR,target=/run/encased" \
  "$WORKER"

Replace every example registry and digest with the exact reviewed artefact. Never paste credentials into a Dockerfile, build argument, image or evidence log.

Next step

Test the exact host and images before making a claim

Start with the unmodified reference run on a disposable Ubuntu host. Preserve raw logs, exit codes, package hashes and repository manifest digests. A passing author-run suite is useful evidence, not independent approval or production certification.