Skip to content
StinkyCat0Public
forked from jarenm1/kestrel

About

agent sandboxing utility

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

Kestrel

Kestrel

A secure home for your agents.
Cloud agents with everything good about local: your repos, your subscriptions, and builds that run just like on your own machine.
App · Website · Architecture

Kestrel: a secure home for your agents

Kestrel runs Claude Code or Codex on a box you own, driven from a chat in the browser or on your phone. Each thread gets its own workspace, sandbox and, when it needs one, a live desktop you can watch and take over. Close the laptop; the agent keeps going.

  • Your harness, your account. Use your own subscription or API key. Compatible API-key models work across Claude Code, Codex and OpenCode; choose their route in the model picker and switch mid-thread. See harness compatibility.
  • Your repos, your branches. The agent checks out what it needs and works on its own branch. Review the diff in the thread, or let it open the PR.
  • Live desktop. Browsers, Blender, Roblox Studio: watch the GUI apps the agent drives and take control.
  • Sandboxed by default. Every run is locked into bubblewrap with per-thread CPU, memory and disk limits and its own network namespace. Model keys stay on the host; agents only get short-lived tokens.
  • Built-in tools. An MCP server for screenshots, the shell, questions, previews, automations and messaging other threads.
  • No ports to open. The box dials out to a Cloudflare control plane, so it runs anywhere. Kestrel's managed boxes are reached over HTTPS instead.

A thread streaming the agent's tool calls and command output
Tool calls and command output stream into the thread as the agent works.

The agent asking a question with answer options Claude Code slash commands in the composer
The agent asks when it needs you Your harness's slash commands and skills

Use your own machine

Run the box on your own computer and use it from app.kestrel-agent.com and the mobile app:

curl -fsSL https://raw.githubusercontent.com/jarenm1/kestrel/main/scripts/install-box.sh | sh   # or: npx kestrel-box login && npx kestrel-box install

It pairs the machine with your account and installs the box as a service. Linux runs it natively, Windows inside WSL2, macOS inside a Lima VM the installer manages. Details: docs/byo-box.md.

Run it locally

Nothing in the cloud is required. Needs Bun and Node 22 (for wrangler); works on Linux, macOS and Windows.

bun install --frozen-lockfile
CLOUDAGENTS_FAKE_AGENT=1 bun run dev

Open the printed URL (http://localhost:5173/auth/dev-login) to sign in as dev. This starts the Worker (:8788), a box connected to it (:8797, data in .data-dev/) and Vite (:5173); Ctrl+C stops all three. The public landing page is at http://site.localhost:5173/.

  • Fake agent: CLOUDAGENTS_FAKE_AGENT=1 runs a scripted agent that needs no model key. Drop it for a real agent and add a key or subscription in Settings › Connections. Under API keys, choose Add API key, select a provider, then enter and save the key. Saved providers stay visible; remove an unsaved row or disconnect a saved key to return that provider to the menu.
  • Expired GitHub access: click Reconnect GitHub in the warning to authorize access again. After GitHub authorization, you return to the same page, including its query string and fragment, rather than Settings.
  • Sandbox and desktop (Linux + Nix): nix run runs the same stack with the flake's toolchain and turns on the bubblewrap sandbox and the task desktop. Without Nix, agents run unsandboxed and there is no desktop on macOS and Windows. On NixOS use the flake (npm's workerd does not start there).
  • Linux without the Nix dev stack: the desktop needs weston 14 or newer, Xwayland, openbox, hsetroot, xterm, xdotool, ffmpeg with x11grab and libx264, and xdamage-capture. Ubuntu 24.04 ships weston 13; see desktop dependencies for a pinned Nix bundle. Add CLOUDAGENTS_SYSTEMD=0 if you have no user systemd manager.
  • Windows: agent commands run through POSIX sh (from PATH or Git for Windows).
  • Several stacks on one machine: ports shift by (uid - 1000) * 100 + KESTREL_DEV_SLOT * 10, so give each running stack its own KESTREL_DEV_SLOT (0-9). The ports are printed at startup; forward the app port with ssh -L to use a remote dev machine.

Before a PR: bun run typecheck (and bun run build:app if packages/app or packages/mobile changed). Contributing workflow: AGENTS.md.

Repository

Path What
packages/app React SPA (Vite, Tailwind, shadcn/ui, TanStack Query). One build serves the public pages on kestrel-agent.com and the app on app.kestrel-agent.com.
packages/control Cloudflare Worker: GitHub sign-in, control API, the managed-box fleet registry and the legacy relay to the box. Serves the built app.
packages/server The agent box: harnesses in bubblewrap, MCP, credential broker, desktop. Dials out to the control plane. Also the kestrel-box CLI (src/cli).
packages/kestrel-box npm launcher for the kestrel-box binary (not a workspace).
packages/protocol Shared Effect schemas: relay frames, control API, REST.
packages/mobile Expo app (README).
packages/desktop Electron desktop app for the same SPA, with GitHub-release auto-updates (README).

Deeper docs: architecture and ownership, goal state, the box: harnesses, sandbox and limits, bring your own box with cloud overflow (design).

Deploys

  • App and control plane: Workers Builds deploys main (bun run build:app, then wrangler deploy in packages/control). By hand: bunx cf builds create d87f7f0a-5dee-45c5-bb88-e5829c3a7792 --branch main.
  • GitHub sign-in: a GitHub OAuth app with callback https://app.kestrel-agent.com/auth/github/callback; GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET are secrets on Worker kestrel. Only logins in ALLOWED_GITHUB_LOGINS in packages/control/wrangler.jsonc can sign in; update both the production and preview lists to change access. Existing sessions are checked against the list too.
  • Restrictive Wi-Fi / desktop TURN: configure KESTREL_TURN_KEY_ID and secret KESTREL_TURN_API_TOKEN on the control Worker, then update/restart boxes. Registered boxes automatically supply expiring Cloudflare Realtime TURN credentials to viewers, including TLS on port 443; explicit local TURN wins. Provider bandwidth is billed to the operator. See setup and limits.
  • Production box: nix run .#box-auto on the host; it follows main (or KESTREL_BOX_REF) and restarts once the box is idle, so merges don't interrupt agent runs (details).
  • Kestrel's boxes: a managed fleet that operators add and drain; users not yet assigned to a box use the legacy relay (details).
  • Previews: every branch gets https://<branch with / replaced by ->-kestrel.jarenmchugh.workers.dev (own empty Hub, no secrets, no box; UI review only).

About

agent sandboxing utility

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages