kern
run LLM-generated code locally, no cloud, no daemon
Working when we checked on .
What is kern?
Kern Sandbox runs LLM-generated code in throwaway containers on the user's own Linux machine, isolating it from host files unless explicitly handed over. It targets developers using AI coding agents and tools like Claude Code, Cursor, LM Studio, LangChain and any MCP client. Each call runs in a fresh OCI-image container with no network by default, memory and PID caps, and a mandatory timeout, and reports typed faults like timeout, oom or escape_blocked. It is rootless with no daemon, VM, cloud or account, available via pip and npm as open-source Apache-2.0 software.
kern pricing
Pricing model: Free
Free and open source (Apache-2.0 license)
kern pros
- Rootless, no daemon, no socket, no VM, no cloud, no account required
- Works with MCP clients (Claude Code, Cursor, LM Studio, Zed), LangChain and pi
- Runs each call in a fresh container with no network, memory/PID caps and mandatory timeout
- Typed fault reporting distinguishes timeout, oom, exec_failed and other outcomes
- Precompiled image library and prewarm pool make imports about 3x cheaper
- Refuses mounts over 17 credential directories with no opt-out
kern cons
- Not a boundary against deliberately hostile code; microVM or gVisor recommended there
- Linux only; on macOS or Windows it must run inside a Linux VM, WSL or via ssh
- Workspace is unbounded by default and can fill the host disk unless workspace_max_bytes is set
- Memory and PID caps require the host to delegate a cgroup
Frequently asked questions about kern
What does Kern Sandbox do?
It runs model-written code—tool calls, snippets, notebook cells, CI steps—in fresh, isolated containers on the user's own machine, so the code cannot reach host files unless they are explicitly handed over via /workspace.
Which tools and clients does it integrate with?
It ships an MCP stdio server (kern-mcp) for clients like Claude Code, Cursor, Claude Desktop, LM Studio and Zed, plus a LangChain StructuredTool (kern_code_tool), a pi binding (kern-pi), and Python and Node APIs.
What platforms does kern run on?
Linux x86_64 and aarch64 are supported natively; the pip wheel includes the kern binary. On macOS or Windows it must be run inside a Linux VM, via WSL, or over ssh.
Is there a time limit on sandbox runs?
Yes. A bare Sandbox uses a 30-second deadline and the timeout is mandatory—no value disables it. A run stopped by the deadline reports a timeout fault.
Can sandboxed code access the network?
No network is allowed by default. egress_allow opens only the named hosts, and network=True opens everything including the host's loopback, where unauthenticated services may live.
How does kern report why a run stopped?
Every result includes a fault field read from a pipe kern writes, not stdout, so code cannot fake it. Values include timeout, oom, exec_failed, startup_failed, killed, workspace_full and escape_blocked, with stable exit codes.
How is kern secured?
It runs rootless with seccomp on, capabilities dropped, no host mounts and no network by default. Mounts over the host's own directories, kern's state and 17 credential directories like .ssh and .aws are refused with no opt-out.
Can sandboxed code keep state between calls?
Yes. A kept-open Sandbox shares /workspace across calls, and kernel() keeps one warm interpreter so variables carry between steps, like a notebook.
How do you install kern?
Run pip install -U kern-sandbox inside a Python venv on Linux; the wheel carries the kern binary including kern doctor and kern ps. There is also an npm package, kern-sandbox, with the same API.
Is kern safe for running hostile code?
No. Namespaces, cgroups and seccomp are intended for your own or semi-trusted code. For deliberately hostile code, the documentation recommends a microVM or gVisor instead.