k8eDeepSeek Harness plugin

k8e.sh - OpenSource Agentic AI Sandbox Matrix

Stars
481
Forks
33
License
Apache-2.0
Last commit
Aug 25, 2026
Latest release
v1.35.5-20260824-rc3+k8e1

Overview

k8e.sh - OpenSource Agentic AI Sandbox Matrix

Original README

Cached from the project repository on Sep 3, 2026. This is source content, separate from the Agents.md review above.

View source

Typing SVG



Go Version License Stars Release Arch


k8e.sh β€” Open Source Agentic AI Sandbox Matrix. A single binary under 100MB that turns any Linux host into a secure, isolated execution platform for AI agents β€” gVisor, Kata, or Firecracker isolation, warm-pool fast starts, and an E2B-compatible API. Up and running in 60 seconds.


bash
curl -sfL https://k8e.sh/install.sh | sh -

That's it. Your agentic sandbox matrix is ready. πŸ€–


πŸ“– Table of Contents

#Section
1πŸ€– What is K8E?
2πŸ—οΈ Architecture
3βš™οΈ Components
4πŸš€ Quick Start
5πŸ”’ Sandbox Runtime Setup
6πŸ€– Sandbox CLI
7πŸ–₯️ Advanced Installation
8πŸ†š K8E vs Other Sandbox Platforms
9🀝 Contributing
10πŸ™ Acknowledgments

πŸ€– What is K8E?

K8E is the Open Source Agentic AI Sandbox Matrix β€” a self-hosted sandbox platform for running secure, isolated AI agent workloads at scale, packaged as a single binary under 100MB.

As autonomous AI agents increasingly generate and execute untrusted code, robust sandboxing infrastructure is no longer optional. K8E ships everything needed to spin up a production-grade cluster in under 60 seconds, with first-class primitives for agent isolation, resource governance, and ephemeral execution environments β€” purpose-built for the AI era.

πŸ”’ One cluster. Many agents. Zero trust between them.

Sandbox Capabilities

CapabilityDescription
πŸ”’ Hardware IsolationPluggable runtimes: gVisor (default), Kata Containers, Firecracker microVM
🌐 Network PoliciesCilium eBPF toFQDNs egress control β€” per-session, no proxy process needed; allowed_hosts enforced via --cilium-dns-proxy (KIP-16 M10)
βš–οΈ Resource QuotasCPU/memory caps per agent session to prevent runaway costs
πŸ—‘οΈ Ephemeral WorkspacesAuto-cleanup after agent session ends; per-session workspace isolation for sub-agents (KIP-16 M1)
🧠 Warm PoolPre-booted sandbox pods for sub-500ms session claim latency; application-layer readiness handshake, adaptive sizing, per-session background-run caps
πŸ“Έ Content-Addressed SnapshotsSHA-256 CAS layerstore with zstd compression, chunked multi-layer manifests, incremental --base restore, server-side registry, autosquash (KIP-16 M2)
πŸ“œ Exec TranscriptsFile-backed, windowed, offset-resumable command transcripts β€” k8e-sandbox-cli log (KIP-16 M4)
πŸ“Š ObservabilityPrometheus metrics, disk-only NDJSON event stream, process topology β€” events / ps CLI (KIP-16 M5)
πŸ”„ Sub-agent ReuseSub-agents share the parent pod + workspace; isolated reset (KIP-16 M1)
🧾 CLI CatalogMachine-readable command/flag surface for SDK generation β€” catalog (KIP-16 M9)
🀝 agent-sandbox compatibleWorks with kubernetes-sigs/agent-sandbox
πŸ”„ SKILL + CLIAI agents (claude code, codex, pi) connect via k8e-sandbox-cli CLI commands

πŸ—οΈ Architecture

 AI Agents (Claude Code / Codex / Pi / dsh)
        β”‚  k8e-sandbox-cli / plugin tools    (gRPC over mTLS)
        β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              SANDBOX GATEWAY                 β”‚
β”‚  sessions Β· exec Β· files Β· PTY terminals     β”‚
β”‚  expose Β· allow-hosts Β· snapshots            β”‚
β”‚  warm pool Β· metrics Β· event stream          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚ claims ready pods from the warm pool
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚   SANDBOX POD         β”‚   β”‚   SANDBOX POD  β”‚
   β”‚   gVisor / Kata / FC  β”‚ … β”‚   (isolated)   β”‚
   β”‚   agent's code + fs   β”‚   β”‚                β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        eBPF per-session network policy between all of them

One gateway fronts every operation β€” session lifecycle, streaming exec, filesystem, PTY terminals, service exposure (expose), live egress policy (allow-hosts) and content-addressed snapshots β€” so agents get one audited door instead of raw infrastructure access.


βš™οΈ Components

ComponentPurpose
πŸšͺ Sandbox GatewaySingle gRPC (mTLS) + E2B-compatible HTTP door: sessions, exec, files, PTY terminals, exposure, snapshots
πŸ›‘οΈ gVisor / Kata / FirecrackerPluggable sandbox isolation runtimes (user-space kernel / lightweight VMs / microVMs)
πŸ”· Cilium (eBPF)Per-session network policy & egress control β€” no proxy process
🧠 Warm Pool ControllerPre-booted sandbox pods, adaptive sizing, sub-500ms claims
πŸ€– k8e-sandbox-cliStandalone agent CLI β€” connect, run, expose, snapshots (catalog for SDK generation)
πŸ”Œ dsh plugin family@k8e-sandbox/* npm packages β€” DeepSeek Harness integration with model-surface tools

πŸš€ Quick Start

Install the runtime shim before K8E so it is auto-detected on first startup. gVisor is recommended β€” no KVM required.

bash
1# Download runsc + containerd-shim-runsc-v1 directly from the gVisor release bucket (requires wget)
2ARCH=$(uname -m)   # x86_64 on most servers, aarch64 on ARM
3URL=https://storage.googleapis.com/gvisor/releases/release/latest/${ARCH}
4
5wget ${URL}/runsc ${URL}/runsc.sha512 \
6     ${URL}/containerd-shim-runsc-v1 ${URL}/containerd-shim-runsc-v1.sha512
7
8sha512sum -c runsc.sha512 -c containerd-shim-runsc-v1.sha512   # both must print OK
9chmod +x runsc containerd-shim-runsc-v1
10sudo mv runsc containerd-shim-runsc-v1 /usr/local/bin/
11ls -l /usr/local/bin/runsc /usr/local/bin/containerd-shim-runsc-v1   # verify both installed

K8E detects runsc at startup and automatically injects the gVisor stanza into its containerd config (/var/lib/k8e/agent/etc/containerd/config.toml). Do not run runsc install β€” K8E manages its own containerd configuration.

Need stronger isolation? See Sandbox Runtime Setup for Kata Containers and Firecracker.

Step 2 β€” Install K8E

bash
curl -sfL https://k8e.sh/install.sh | sh -

Step 3 β€” Verify the Sandbox

bash
k8e-sandbox-cli status        # -> {"available": true, ...}
k8e-sandbox-cli run 'echo hello from the sandbox'

(Optionally, with KUBECONFIG=/etc/k8e/k8e.yaml: kubectl -n sandbox-matrix get pods shows the warm-pool pods.)

Step 4 β€” Download Sandbox CLI & Connect Your AI Agent

Download the standalone sandbox CLI, authenticate, and install the skill into your agent:

bash
1# Download sandbox CLI (~44MB) β€” pick your platform suffix
2#   k8e-sandbox-cli-linux-amd64 / linux-arm64 / darwin-amd64 / darwin-arm64 / windows-amd64.exe
3curl -sLO https://github.com/xiaods/k8e/releases/latest/download/k8e-sandbox-cli-linux-amd64
4chmod +x k8e-sandbox-cli-linux-amd64
5
6# Symlink the plain command name to the downloaded file (do not rename)
7ln -s k8e-sandbox-cli-linux-amd64 k8e-sandbox-cli
8
9# Create an API key on the server (default TTL 30 days; use --ttl never for non-expiring)
10k8e sandbox-apikey create my-agent
11# β†’ {"name":"my-agent","key":"k8e-abc123...","ttl_days":30,"expires_at":"..."}
12
13# Connect: authenticate (mTLS) + install /k8e-sandbox skill into agent harnesses
14./k8e-sandbox-cli --endpoint <server-ip>:50051 --apikey k8e-abc123... connect
15
16# Optional multi-cluster profiles (~/.k8e/sandbox/profiles.yaml β€” not server /etc/k8e/config.yaml)
17# See docs/kip-17-sandbox-cli-profiles-and-apikey-ttl.md
18# ./k8e-sandbox-cli --profile prod connect --apikey k8e-...

Local usage: If you're on the same machine as the K8E server, the CLI auto-discovers TLS certs β€” just run k8e-sandbox-cli connect.

Platform binaries: k8e-sandbox-cli-{darwin,linux,windows}-{amd64,arm64} (Windows: k8e-sandbox-cli-windows-amd64.exe, symlink via mklink k8e-sandbox-cli.exe k8e-sandbox-cli-windows-amd64.exe)

One binary, two names: the downloaded k8e-sandbox-cli-linux-amd64 file is the k8e-sandbox-cli command the skill uses. connect symlinks it to ~/.local/bin/k8e-sandbox-cli (on PATH) and installs the /k8e-sandbox skill into your agent harnesses, so every skill example (k8e-sandbox-cli run ...) is the same file you just downloaded.

Then ask your agent naturally:

"Run this Python snippet in a sandbox"

The agent executes k8e-sandbox-cli run automatically β€” no session management needed.

Supported agents: claude code, codex, pi.


πŸ”’ Sandbox Runtime Setup

K8E auto-detects installed runtimes and registers the corresponding RuntimeClass. Choose based on your isolation requirements:

RuntimeIsolationRequirementBoot time
gVisorSyscall interception (userspace kernel)None~10ms
Kata ContainersVM-backed (QEMU)Nested virt or bare metal~500ms
FirecrackerHardware microVM (KVM)/dev/kvm~125ms
bash
1# Download runsc + containerd-shim-runsc-v1 directly from the gVisor release bucket (requires wget)
2ARCH=$(uname -m)   # x86_64 on most servers, aarch64 on ARM
3URL=https://storage.googleapis.com/gvisor/releases/release/latest/${ARCH}
4
5wget ${URL}/runsc ${URL}/runsc.sha512 \
6     ${URL}/containerd-shim-runsc-v1 ${URL}/containerd-shim-runsc-v1.sha512
7
8sha512sum -c runsc.sha512 -c containerd-shim-runsc-v1.sha512   # both must print OK
9chmod +x runsc containerd-shim-runsc-v1
10sudo mv runsc containerd-shim-runsc-v1 /usr/local/bin/
11ls -l /usr/local/bin/runsc /usr/local/bin/containerd-shim-runsc-v1   # verify both installed

Do not run runsc install β€” K8E manages its own containerd config at /var/lib/k8e/agent/etc/containerd/config.toml and auto-injects the gVisor stanza on startup.

Kata Containers

bash
bash -c "$(curl -fsSL https://raw.githubusercontent.com/kata-containers/kata-containers/main/utils/kata-manager.sh) install-packages"
kata-runtime check

Firecracker (requires /dev/kvm)

bash
ls /dev/kvm   # verify KVM is available

# Install firecracker-containerd shim + devmapper snapshotter
# See: https://github.com/firecracker-microvm/firecracker-containerd
mkdir -p /var/lib/firecracker-containerd/runtime
# Place hello-vmlinux.bin and default-rootfs.img here

Apply Changes

Install runtimes before starting K8E for zero-restart setup. If K8E is already running, restart it after installing a new runtime shim:

bash
systemctl restart k8e
kubectl get runtimeclass
# NAME          HANDLER       AGE
# gvisor        runsc         10s
# kata          kata-qemu     10s
# firecracker   firecracker   10s   ← only if /dev/kvm present

πŸ€– Sandbox CLI

k8e-sandbox-cli is a standalone binary (~44MB) that gives AI agents direct access to K8E sandbox infrastructure β€” no server install needed.

AI Agent (claude code / codex / pi)
    β”‚  shell command
    β–Ό
k8e-sandbox-cli run "print('hello')" --lang python
    β”‚  gRPC (TLS)
    β–Ό
sandbox-grpc-gateway:50051
    β”‚
    β–Ό
Isolated Pod (gVisor / Kata / Firecracker)

Install the Skill

On the server, create an API key for secure remote access:

bash
k8e sandbox-apikey create my-agent
# β†’ {"name":"my-agent","key":"k8e-abc123..."}

On the client, download the standalone CLI, log in, and install the skill:

bash
1# 1. Download the platform-specific binary (~44MB)
2#    k8e-sandbox-cli-linux-amd64 / linux-arm64 / darwin-amd64 / darwin-arm64 / windows-amd64.exe
3curl -sLO https://github.com/xiaods/k8e/releases/latest/download/k8e-sandbox-cli-linux-amd64
4chmod +x k8e-sandbox-cli-linux-amd64
5
6# 2. Symlink the plain command name to the downloaded file (do not rename)
7ln -s k8e-sandbox-cli-linux-amd64 k8e-sandbox-cli
8
9# 3. Connect: mTLS auth + install /k8e-sandbox skill into Claude/Codex/Pi
10#    Note: --endpoint and --apikey are global flags, placed before the subcommand
11./k8e-sandbox-cli --endpoint <server-ip>:50051 --apikey k8e-abc123... connect

Platform binaries: k8e-sandbox-cli-{darwin,linux,windows}-{amd64,arm64} (Windows: k8e-sandbox-cli-windows-amd64.exe, symlink via mklink k8e-sandbox-cli.exe k8e-sandbox-cli-windows-amd64.exe)

One binary, two names: the downloaded k8e-sandbox-cli-linux-amd64 file is the k8e-sandbox-cli command the skill uses β€” the symlink is just a plain-name alias to the same file. connect installs the /k8e-sandbox skill, so every skill example (k8e-sandbox-cli run ...) is the same file you just downloaded.

Then in your agent harness:

/k8e-sandbox <goal>

Or ask naturally: "Run this Python snippet in a sandbox" β€” the skill drives k8e-sandbox-cli run.

Available Commands

CommandDescription
k8e-sandbox-cli --profile <name> …Use named profile from ~/.k8e/sandbox/profiles.yaml (KIP-17; not /etc/k8e/config.yaml)
k8e-sandbox-cli connectConnect local/remote gateway and install /k8e-sandbox agent skill
k8e-sandbox-cli connect --skill-onlyRe-install agent skill only (no gateway dial)
k8e-sandbox-cli loginAuthenticate only (mTLS cert; no skill install)
k8e-sandbox-cli run <code>Run code or shell command (auto-creates/manages session)
k8e-sandbox-cli statusCheck sandbox service availability and current session
k8e-sandbox-cli createCreate a new session (custom runtime, egress, manifest, git-repo)
k8e-sandbox-cli destroy <sid>Destroy a session and free resources
k8e-sandbox-cli write <sid> <path>Write file to /workspace (content via stdin)
k8e-sandbox-cli read <sid> <path>Read file from /workspace
k8e-sandbox-cli list <sid>List files in /workspace (filter by --since timestamp)
k8e-sandbox-cli subagent <parent-sid>Spawn child sandbox under parent session (max depth 1)
k8e-sandbox-cli confirm <sid> <action>Gate irreversible action on human approval
k8e-sandbox-cli approve <approval-id>Approve a pending confirm request
k8e sandbox-apikey create <name> [--ttl 30d|never]Create API key (default TTL 30 days)
k8e sandbox-apikey listList API key names + expiry (secrets not shown)
k8e sandbox-apikey delete <name>Delete an API key (server-side)

See pkg/sandboxcli/skills/k8e-sandbox/SKILL.md and docs/kip-17-sandbox-cli-profiles-and-apikey-ttl.md.

Quick Examples

bash
1# Run Python code (auto-creates session)
2k8e-sandbox-cli run "print('hello')" --lang python
3
4# Shell command (default lang=bash)
5k8e-sandbox-cli run "ls -la /workspace"
6
7# TypeScript β€” type annotations run via tsx
8k8e-sandbox-cli run "const nums: number[] = [1, 2, 3]; console.log(nums.reduce((a, b) => a + b, 0))" --lang ts
9
10# Multi-line TypeScript via stdin (interfaces, async/await)
11k8e-sandbox-cli run --lang ts <<'EOF'
12interface User { name: string; age: number }
13
14async function oldest(users: User[]): Promise<User> {
15  return users.reduce((a, b) => (a.age > b.age ? a : b));
16}
17
18const users: User[] = [{ name: "Ada", age: 36 }, { name: "Linus", age: 54 }];
19oldest(users).then((u) => console.log(`Oldest: ${u.name} (${u.age})`));
20EOF
21
22# Multi-line via stdin
23k8e-sandbox-cli run --lang python <<'EOF'
24for i in range(10):
25    print(i)
26EOF
27
28# Default egress: pypi.org, files.pythonhosted.org, registry.npmjs.org,
29#   objects.githubusercontent.com, github.com, raw.githubusercontent.com
30SID=$(k8e-sandbox-cli create | jq -r .session_id)
31k8e-sandbox-cli write $SID /workspace/script.py <<'PYEOF'
32import pandas as pd
33print(pd.__version__)
34PYEOF
35k8e-sandbox-cli run "pip install pandas" --session-id $SID
36k8e-sandbox-cli run "python3 /workspace/script.py" --session-id $SID
37
38# Create session with custom runtime and egress
39SID=$(k8e-sandbox-cli create --runtime firecracker --allowed-hosts pypi.org,github.com | jq -r .session_id)
40
41# Clone git repo at session creation
42SID=$(k8e-sandbox-cli create --git-repo https://github.com/user/repo.git --git-ref main | jq -r .session_id)
43
44# Stream long-running output
45k8e-sandbox-cli run "python3 train.py" --session-id $SID --raw
46
47# Tenant-based cross-process session reuse
48k8e-sandbox-cli run "echo hello" --tenant my-project

Configuration Overrides

The CLI auto-discovers the local cluster via TLS. For remote clusters, use k8e-sandbox-cli login once to set up mTLS credentials. Override when needed:

bash
1# Remote cluster: log in once (creates ~/.k8e/sandbox/{client.crt,client.key,ca.crt})
2k8e-sandbox-cli --endpoint 10.0.0.1:50051 --apikey k8e-abc123... login
3
4# After login, subsequent commands work without --apikey:
5k8e-sandbox-cli run "echo hello"
6
7# Or via environment variables:
8K8E_SANDBOX_ENDPOINT=10.0.0.1:50051 K8E_SANDBOX_APIKEY=k8e-abc123... k8e-sandbox-cli login
9
10# Override endpoint per-command:
11K8E_SANDBOX_ENDPOINT=10.0.0.2:50051 k8e-sandbox-cli run "echo hello"

πŸ–₯️ Advanced Installation

Add a Worker Node

bash
# Get token from server node
cat /var/lib/k8e/server/node-token

# On worker machine
curl -sfL https://k8e.sh/install.sh | \
  K8E_TOKEN=<token> \
  K8E_URL=https://<server-ip>:6443 \
  INSTALL_K8E_EXEC="agent" \
  sh -

Disable Sandbox Matrix

bash
curl -sfL https://k8e.sh/install.sh | INSTALL_K8E_EXEC="server --disable-sandbox-matrix" sh -

Key Environment Variables

bash
K8E_TOKEN=<secret>              # cluster join token
K8E_URL=https://<server>:6443   # server URL (agent nodes)
K8E_KUBECONFIG_OUTPUT=<path>    # kubeconfig output path

πŸ†š K8E vs Other Sandbox Platforms

How K8E compares to mainstream sandboxes for AI agents:

K8E πŸš€E2BDaytonaagent-sandbox (k8s-sig)DIY gVisor/Firecracker
Self-hosted, single binaryβœ… <100MB⚠️ Heavy (per-env VM images)βœ…βŒ needs a K8s cluster❌ you build it
Isolation runtimesβœ… gVisor / Kata / Firecracker β€” pluggableFirecracker microVMsβœ… microVM/containersK8s RuntimeClass (gVisor/Kata/…)one runtime
E2B SDK compatibilityβœ… native (official SDKs unmodified)βœ… native❌ own API❌❌ build your own API
Agent CLI + skill surfaceβœ… k8e-sandbox-cli (+ dsh plugin tools)SDK onlyCLI + SDKCRDs only❌
Warm pool (sub-500ms claims)βœ… built-in, adaptive sizingβœ… managed⚠️⚠️ manual scaling❌ roll your own
Expose agent services via gateway URLβœ… expose + live allow-hosts egress policyβœ… hosted URLs⚠️❌ roll your own Ingress❌
Content-addressed snapshotsβœ… incremental restore + registryβœ… hosted⚠️❌❌
Per-session network policy (eBPF)βœ… Cilium, live-configurablemanaged (fixed)⚠️⚠️ NetworkPolicyhand-written
PTY terminals for agentsβœ… first-class (spawnTerminal)βœ…βœ…βŒβŒ
LicenseApache 2.0Apache 2.0 (hosted core paid)Apache 2.0Apache 2.0β€”

When to choose K8E

  • You want E2B-style sandboxes but self-hosted β€” same official SDKs, your infrastructure, no per-seat pricing.
  • Your agents need a rich tool surface beyond "run code": PTY terminals, snapshots, service exposure, and live egress policy β€” all through one audited gateway.
  • You want pluggable isolation (swap gVisor ↔ Kata ↔ Firecracker per session) instead of being locked to one microVM stack.

🀝 Contributing

bash
git clone https://github.com/<your-username>/k8e.git && cd k8e
git checkout -b feat/my-feature
make && make test
git push origin feat/my-feature

πŸ›‘οΈ Security

Report vulnerabilities via GitHub Security Advisories. Do not open public issues for security bugs.


πŸ“„ License

Apache License 2.0 β€” see LICENSE.


πŸ™ Acknowledgments

ProjectContribution
πŸ„ K3sLightweight Kubernetes foundation that inspired K8E
☸️ KubernetesThe orchestration engine everything is built on
πŸ”· CiliumeBPF-powered networking and per-session egress control
πŸ€– agent-sandboxKubernetes-native agent sandboxing primitives
🌐 CNCFFostering the open-source cloud native ecosystem

k8e.sh β€” Open Source Agentic AI Sandbox Matrix

GitHub Website Docs

If K8E powers your agents, give us a ⭐ β€” it means the world to us!