30th November, 2026

Loop: A Lean AI Agent Runtime

Open source (Apache-2.0): github.com/soketlabs/loop · Docs: loop.soket.ai · Technical report: Loop-Harness (PDF)

Give an AI coding agent 256 MiB of memory and a single CPU. We did, with nine open-source agent harnesses on the same model and the same 13 coding tasks. Four of them could not finish a single task: the kernel killed every one of their runs for running out of memory.

Loop passed 97% of its runs at that limit, using a median of 103 MiB per task. Across all 2,340 runs in the benchmark, it was the only harness that never ran out of memory.

Loop is the open-source agent runtime we built at Soket AI. It's light enough to run many agents on modest hardware, and strict enough that every tool call an agent makes is checked against a policy and recorded before it runs.

What a harness is, and why it matters

Every AI agent runs the same loop: call the model, run the tools it asks for, add the results to the conversation, repeat. The program that runs this loop is the harness.

One turn of the agent loop: the model asks for a tool, the permission gate checks it and writes a decision record, the tool runs on the host or in a sandbox, and the capped result goes back into the context

The harness sits between the model and your machine, so two things it does shape everything else:

  • It sets the cost of every step. Its CPU time and memory are paid on every turn of every session. On one developer's laptop that hardly matters. On a server where many agents share the machine, memory decides how many fit, and a session that goes over its limit is killed.
  • It decides what the agent is allowed to do. Agents run shell commands and edit files for you. If the harness doesn't enforce a policy, nothing does.

Most harnesses today are written in TypeScript or Python and designed for one developer on one laptop. We built Loop in Rust for a different setting.

The benchmark

We compared Loop with eight open-source coding-agent harnesses: DeepSeek Harness, OMP, Goose, Pi, Cline, Kilo Code, Hermes and OpenCode.

  • Same model for all nine: GLM 5.3, served from one OpenAI-compatible endpoint in our own cluster.
  • Same 13 coding tasks, each graded by an automated test.
  • One CPU per container and a hard memory limit of 256, 512, 1024 or 2048 MiB.
  • 260 runs per harness, 2,340 in all.

Each harness ran with its defaults and with tool approvals switched off, so that no run waited on a human. For Loop, that means the permission gate was set to allow all tool calls and the sandbox was off. These are the numbers for the runtime itself, not for its safety features. We describe those features below.

The in-house benchmark ran on a pre-release build of Loop v0.7.0 (commit 1dc7ef4). The public benchmarks further down ran on the v0.7.0 release.

Result 1: the lowest memory, by a wide margin

Peak memory per task: Loop 103 MiB, Pi 166, Goose 250, DeepSeek Harness 292, Cline 377, OMP 385, Hermes 482, Kilo Code 750, OpenCode 937

Loop's median peak memory was 103 MiB per task. The next lowest, Pi, used 166 MiB (1.6 times as much), and the other seven used 250 to 937 MiB (up to 9.1 times as much).

What that means in practice: on a machine with 16 GiB to spare, peak memory alone would allow about 159 Loop sessions, against about 43 for the median harness in our test. (This is illustrative arithmetic on peak memory; real capacity also depends on CPU, the model server and the tasks.)

It isn't just Rust. Goose is also written in Rust and used 2.4 times Loop's memory. Pi is written in TypeScript and used less memory than Goose. The language helps, but the design choices described under "What keeps Loop lean" matter more.

Result 2: what happens when memory runs out

Runs passed at each memory limit: Loop passed 97% at 256 MiB with 0 of 260 runs killed for memory; Cline, Kilo Code, Hermes and OpenCode passed 0% at 256 MiB, with 66 to 83 of 260 runs killed

Three harnesses passed 97% of their runs at 256 MiB, but Loop's two failures there came from its turn loop, not from running out of memory. Cline, Kilo Code, Hermes and OpenCode passed 98–100% of their runs at 1024 and 2048 MiB, so their failures at 256 MiB come from the memory limit, not from the tasks.

Result 3: faster, and lighter on CPU and tokens

HarnessPassed (%)Time (s)CPU (s)Peak memory (MiB)Tokens (k)
Loop96.2492.410338
DeepSeek Harness99.21017.629270
OMP98.812010.0385145
Goose98.5953.925083*
Pi98.1936.116643
Cline74.613014.337778
Kilo Code73.17623.7750202
Hermes71.911934.8482196
OpenCode67.76021.893798

Passed is the share of all 260 runs. Time, CPU, memory and tokens are medians per passed task at 1024 and 2048 MiB. Time includes waiting for the model. *Goose doesn't report tokens, so we recovered them from its session database.

Time, CPU and tokens per task: Loop 49 seconds, 2.4 CPU seconds and 38k tokens, the lowest of the nine harnesses on all three
  • Time: a median of 49 s per task, ahead of OpenCode (60 s) and Kilo Code (76 s). The other six took 93 to 130 s.
  • CPU: 2.4 s per task. The next best was Goose at 3.9 s; the others used up to 34.8 s. With one CPU per container, this matters: Loop's container was throttled in a median 3% of scheduler periods, against 16–26% for Hermes, Kilo Code and OpenCode.
  • Tokens: a median of 38k per task. Pi was next at 43k; the rest used 70k to 202k, up to 5.3 times as many.

Loop doesn't get there by taking fewer steps. At the median, most of the other harnesses take the same number of turns and tool calls as Loop, or one to three fewer. Loop takes as many steps or slightly more; each step simply costs less.

Accuracy: close, but not first

Loop passed 96.2% of its runs (250 of 260). That is within three points of the four most accurate harnesses (DeepSeek Harness at 99.2%, OMP, Goose and Pi), and well above the four that could not run at 256 MiB (67.7–74.6%). We traced each of Loop's ten failures. None was a memory kill; all ten come from how the turn loop handles truncated model responses, unproductive loops and permission errors.

We also ran early tests of the v0.7.0 release on two public benchmarks, one run per harness, all with GLM 5.3:

  • SWE-bench Lite (300 real GitHub issues from 12 Python projects): Loop resolved 270 (90.0%), Pi 274 (91.3%) and DeepSeek Harness 282 (94.0%). Loop and Pi ran on the same model provider and endpoint, and the gap between them is well within chance. The 12-task gap to DeepSeek Harness, measured on a different provider and day, is small but real.
  • CyberGym (reproducing known vulnerabilities in open-source software): Loop solved 9 of 10 tasks, as did Pi and DeepSeek Harness, and all three missed the same one. Loop ran with the smallest limits of the three: a 128k-token context against 200k and 1M.
Public benchmarks: on SWE-bench Lite, Loop resolved 270 of 300, Pi 274 and DeepSeek Harness 282; on CyberGym, all three solved 9 of 10

On SWE-bench we know where the gap comes from. Tasks whose official fix touches two separate places failed 18.3% of the time, against 4.8% for one-place fixes, because Loop often fixed the first place and stopped. On these longer tasks Loop also took more steps (a median of 46 against 35 and 37) and used more tokens than the other two. Both point to the turn loop, and both are first on the list for the next version.

What keeps Loop lean

We haven't yet measured the effect of each of these on its own. The benchmark above shows the combined result.

No interpreter, no garbage collector. Loop is one native binary, compiled ahead of time with link-time optimisation. Rust's ownership model frees memory as soon as the last owner lets go, so peak memory depends on what a session is actually holding, not on when a collector decides to run. Features a deployment doesn't need, such as trace export, can be left out at compile time.

No thread per task. An agent spends most of its time waiting for the model, a web page or a command. Loop runs on Tokio, Rust's asynchronous runtime: each wait is a lightweight task that suspends until its event arrives, and many tasks share a few worker threads. Waiting costs almost nothing.

Bounded tool output, cut in the right place. One huge tool result makes every later model call more expensive, because it stays in the context. Loop caps built-in tool output at 50,000 bytes and truncates differently by tool: file reads keep the beginning; shell commands keep the end, where errors and summaries usually appear. Web downloads are capped at 2 MiB before they reach the model.

Tool output is capped at 50,000 bytes: file reads keep the beginning, shell commands keep the end and save the full output to a file

Streaming and reused connections. Model responses and tool output are passed on as they arrive, so you can interrupt a turn at any point, and consecutive model calls reuse pooled HTTP connections instead of opening new ones.

Every tool call goes through one gate

Speed matters, but an agent that reads a poisoned file or web page can be steered into doing harm. Loop treats the model as an untrusted party and constrains what it can cause.

One gate, no way around it. Tool calls from the terminal, the desktop app, print mode and MCP clients, plus permission requests from external agents, all pass the same permission gate. It checks every call in a fixed order:

  1. Deny rules and the read-only ceiling
  2. Hooks, which can block or allow
  3. The permission mode: read-only, ask, accept-edits, full-access, or plan (read-only until you approve the agent's plan)

Out of the box, Loop runs in ask mode: reads and searches are allowed, and writes, edits and shell commands ask first.

Inside the permission gate: a tool call passes deny rules, hooks and the permission mode, then a decision record is written before it runs; any step can refuse, and the error goes back to the model

Per-tool permissions and the sandbox are a few lines of settings.json. This project file keeps the default tool permissions and runs every tool inside a gVisor sandbox:

// .loop/settings.json
{
  "toolPermissions": { "read": "allow", "write": "ask", "edit": "ask", "bash": "ask" },
  "sandbox": { "mode": "local", "isolation": "full", "runtime": "runsc" }
}

Global settings live in ~/.loop/agent/settings.json. A project file only applies once you trust the project, and it can make the permission mode stricter, never looser. See the settings reference.

Fails closed. If a call needs approval and no one is there to give it, as in print mode or when Loop serves as an MCP server, the call is refused. A broken or slow hook blocks rather than allows. Permissions aren't part of a tool's definition, so a tool can't grant itself access.

A decision record for every call, written before it runs. Every allow, ask or deny names who acted, the session, the tool, the capability it needs, a short summary of its target, and a hash of its arguments, never the arguments themselves, so no secrets are stored. If the record can't be written, the call doesn't run.

A sandbox as a second layer. If a call is wrongly allowed, isolation still limits what it can reach. On Linux, tools run in a Podman container, and you choose the isolation level: runc or crun containers, gVisor, or a krun microVM, trading startup cost for strength of isolation. On macOS, shell commands run under the built-in Seatbelt sandbox: they can write only to the project and configured paths, have no network unless you enable it, and cannot reach stored credentials or the decision records.

Subagents never outrank their parent. A subagent inherits its parent's policy plus one extra layer of restriction, so it can never have more access than the agent that created it, and it acts for the same user.

A subagent can never have more access than its parent: your policy contains the agent, and the agent contains the subagent, which adds one tightening layer

External agents under the same rules. External agents such as Codex connect over the Agent Client Protocol (ACP), and their permission requests pass the same gate. One caveat: the gate can only decide the requests an external agent actually makes. Codex runs some commands without asking, and Loop sees those only after they've run. Native agents are governed more tightly than external ones today.

Built for critical sectors

Soket AI builds AI for India's critical sectors, and Loop is the runtime for that work. In defence, cybersecurity, finance and government, agents have to:

  • Run on your own infrastructure, often on networks with no internet access. Loop is one binary with no language runtime to install. Copy it onto an isolated network, check it against its published checksum, and point it at locally hosted models through any OpenAI-compatible endpoint. (The Linux sandbox's container image has to be brought across too.)
  • Be contained. Every action passes the gate, and the sandbox limits what a wrongly allowed command can reach.
  • Be auditable. Decision records, sessions and usage logs stay on your machines. Nothing is sent anywhere unless you turn on trace export.
  • Run on modest hardware. On-premises machines are fixed and often small. At 103 MiB per session, more agents fit on the hardware you already have.

Loop can also do security work itself: on CyberGym, it reproduced 9 of 10 real software vulnerabilities end to end.

What else is in the box

  • Any model: any OpenAI-compatible endpoint, including local ones, plus the Anthropic, OpenAI and Gemini APIs.
  • MCP both ways: use tools from Model Context Protocol servers, or run Loop as an MCP server.
  • Sessions you can rewind: sessions are stored as trees, so you can branch from any earlier point or fork a session, and nothing already written is lost.
  • Skills: packaged instructions for specialised tasks. Only each skill's name and description sit in the context until a task needs the full instructions.
  • Surfaces: a terminal interface, print mode for scripts and CI, and a desktop app, all speaking one versioned event protocol.
  • Workflows (from source): a planner, scheduler and event log for running many agent tasks as a graph. The workflow engine isn't in the v0.7.0 release binaries; build with the orchestration feature to try it.
  • Platforms: Linux and macOS. On Windows, use the Linux build under WSL.

What's next

  • Closing the accuracy gap: making the turn loop search more widely before it finishes, so multi-place fixes stop at the second edit, and rereading less context on long tasks.
  • Many agents at once: our numbers so far come from single sessions. Next we'll measure Loop under concurrent load, and grow it into a runtime where many native and external agents share one policy, one sandbox and one audit trail.
  • Fully offline operation as a supported, tested configuration.

Try Loop

curl -fsSL https://loop.soket.ai/install | bash

Loop is open source under Apache-2.0.