· Engineering
Introducing Allen 1.0: A Fast, Durable Rust Agent Harness

Today we are releasing Allen 1.0, an open-source Rust agent harness under dual MIT OR Apache-2.0 licensing on GitHub and crates.io. It is the harness we run in production for SentryTower.
Most AI agent frameworks break down once you run them in production. Prompt-based guardrails slip under untrusted tool output, crashed workers can fire webhooks or pull requests twice, and spawning a Node or Bun runtime per session eats 164–540 MiB of RAM and half a second before the first turn starts. We built Allen so teams can embed a lightweight, memory-safe, durable harness that boots in milliseconds.
TL;DR
- Lightweight and memory-safe: A single Allen actor runs in 7.66 MiB RSS (
7.83 MiBas a spawned RPC child),1,000concurrent idle actors fit in 38.80 MiB, and every Allen crate enforces#![forbid(unsafe_code)]with zero garbage-collection pauses. - Sub-5 ms startup and microsecond overhead: An Allen worker boots in 4.99 ms—96× faster than Pi
0.84.1and 256× faster than Oh My Pi19.1.0—evaluates policy checks in 0.33 µs, and completes an in-memory turn loop in 12.3 µs. - Durable append-only execution: Every conversation turn, tool claim, spend row, and command receipt commits atomically inside a lease-fenced
StepCommittransaction; interrupted external writes fail closed asUnknownon recovery until reconciled. - Compiled FSM agentic loop: Session lifecycles, human approval pauses, role separation, and exact integer microdollar spend caps run as Rust state machines rather than prompt instructions, with zero-I/O policy code compiling cleanly to
wasm32. - Single-owner Tokio actors: Each live session and SQLite store owns a dedicated Tokio task behind a bounded
mpscmailbox, eliminating mutex stalls andSQLITE_BUSYraces while letting hosts steer, branch, pause, or cancel runs mid-turn. - Minimal supply chain: Resolves to 129 workspace normal crates (
24inallen-policy,56inallen-runtime) with zeroreqwest, zerohyper, zero OpenSSL, and DNS-pinned SSRF protection overhttparseandrustls.

--release, tools/allen-bench --compare-clis): Allen is an embeddable Tokio actor harness (7.66 MiB in-process, 7.83 MiB spawned RPC child, +32.8 KiB/session at 1,000 idle actors), shown alongside idle headless RPC processes for standalone coding CLIs Pi 0.84.1 (164.03 MiB) and Oh My Pi 19.1.0 (539.84 MiB). Full methodology and latency numbers appear below.Real rules, not prompt suggestions
System prompts cannot stop an agent from approving its own changes, widening permissions, or exceeding a budget when repository files or web pages steer the next turn. Floating-point cost counters also drift across long-running sessions.
Allen compiles session rules and spend limits into Rust state machines checked before any tool runs:
- Compiled session and turn state machines: Session lifecycles (
Draft,Opening,Ready,Closed) and turn states (Idle,ApplyingControl,Running,Waiting,Stopping) move through explicit transitions checked by the compiler and runtime. Insidedecide_next_step, Allen evaluates cancellation, hard spend caps, time limits, human approvals, and bounded synthesis turns in a fixed precedence order so states stay consistent. - Exact integer budgets and separated roles: The pure policy core (
allen-typesandallen-policy) tracks spend in integer microdollars (MicroUsd, where$1 = 1_000_000) and substitutes conservative fallback rates when a response reports no cost or dips below published model floors. AnExecutionRolematrix separates authorities, builders, and independent read-only verifiers so agents that write changes never approve their own work. - Residency checks and strict JSON parsing: Before outbound calls leave the harness,
policy_codecattaches routing and zero-data-retention (ZDR) headers and rejects duplicate top-level JSON keys that can split policy checks from downstream parsers. For multi-provider endpoints, streaming decoders buffer up to1 MiBof deltas untilProviderRegistryconfirms the answering provider, dropping unverified streams before delivery. - Shared
wasm32policy execution: Layer 0 (allen-types,allen-policy),allen-protocol, and default-freeallen-model(withdefault-features = falsedisablinghttp) contain zero Tokio tasks, sockets, clocks, or SQL drivers and compile towasm32-unknown-unknown. Edge proxies and backend workers run the exact same checks.
Durable execution that survives crashes
Long-running agents trigger real side effects such as opening pull requests, posting webhooks, and updating tickets. When a worker crashes mid-request or loses its lock, blind retries risk firing the same write twice while blind failures throw away progress.
Allen stores messages, tool calls, tool results, and control events in an append-only tree of SessionEntry records linked by parent_entry_id. Each step commits conversation entries, external effect state transitions, spend rows, and idempotent command receipts together inside one atomic StepCommit transaction fenced by monotonic OwnerFence leases and optimistic SessionRevision checks. Stale leases or mismatched revisions roll back the entire step.
Before dispatching an external side effect, the harness writes a Prepared journal record and moves it to Claimed. If the worker dies before finishing, startup recovery advances the lease fence and marks the effect Unknown, blocking re-execution until the host reconciles external state (ReconcileObserved or ReconcileAbsent).
use allen_types::journal::{EffectEvent, EffectState, transition_effect};
// Interrupted `Claimed` effects transition to `Unknown` on crash recovery
// and block re-claims until the host reconciles external state.
let unknown = transition_effect(EffectState::Claimed, EffectEvent::RecoverCrash)?;
assert!(transition_effect(unknown, EffectEvent::Claim).is_err());
let observed = transition_effect(unknown, EffectEvent::ReconcileObserved)?;
assert_eq!(observed, EffectState::Observed);Single-owner Tokio actors instead of shared locks
Running many concurrent agent sessions over shared mutexes leads to lock contention, stale reads, and SQLITE_BUSY failures under parallel writes.
Allen gives each live session its own single-owner Tokio task (SessionRuntime) fed by a bounded mpsc mailbox. The durable SQLite backend (allen-store-sqlite) uses the same design: SqliteAgentStore owns one SQLx SQLite connection behind a 256-slot bounded mpsc channel configured with WAL journal mode, foreign keys, PRAGMA synchronous = FULL, BEGIN IMMEDIATE transactions, and SHA-256 checked migrations. Writes serialize cleanly through the mailbox with zero SQLITE_BUSY races, while WAL mode lets external readers query live snapshots concurrently.
Reading commands sequentially from one bounded mailbox also makes session control straightforward: host services can steer an active run mid-turn, cancel work immediately, switch conversation branches cleanly, pause for human approvals (Running -> Waiting -> Running), and transfer single-writer ownership (TakeControl / ReleaseControl) without restarting the actor.
Benchmarks and minimal supply chain
Every crate in National-Compute/allen enforces #![forbid(unsafe_code)] and [workspace.lints.rust] warnings = "deny" on Rust edition = "2024" (MSRV 1.94), keeping all Allen code safe Rust without garbage-collection pauses (third-party dependencies such as Tokio, rustls, and SQLite sit outside the Allen crate boundary).
The dependency graph stays small enough to audit directly with cargo tree -e normal: allen-policy resolves to 24 normal crates (2 workspace + 22 third-party; allen-types is 23), allen-runtime resolves to 56 (6 workspace + 50 third-party), and the full workspace resolves to 129 (10 workspace + 119 third-party). At the HTTP boundary, allen-http speaks streaming HTTP/1.1 and TLS over httparse and rustls with zero reqwest, zero hyper, and zero OpenSSL C bindings. Outbound requests resolve DNS up front, block private, loopback, and cloud metadata IPs (169.254.169.254) across redirects, and pin the validated SocketAddr to stop DNS rebinding. Local credentials load from 0600 files without shell expansion, and trajectory exports redact SecretString values.

To put Allen's overhead in context, we benchmarked our embeddable harness (--release, rustc 1.100.0) on an Apple M2 Max (macOS 27.2.1) alongside standalone process-per-session coding CLIs Pi 0.84.1 and Oh My Pi 19.1.0 (tools/allen-bench --compare-clis). Host applications supply their own concrete shell runners, mutating Git tools, and OS sandboxes when embedding Allen, whereas Pi and Oh My Pi bundle full CLI toolchains and spawn an OS process per worker. Both CLI tools were measured idle under --mode rpc --no-session --no-tools --offline with an isolated temporary HOME and zero API keys (Oh My Pi also pinned --model anthropic/claude-sonnet-4-5 behind a loopback proxy blocking telemetry sockets so startup settled offline), excluding active LLM token streams (1 MiB delta buffers), conversation histories, and spawned MCP tool subprocesses:
- Memory footprint (
ps -o rss=): One in-process Allen actor uses 7.66 MiB (7,840 KiB) and one spawned RPC worker uses 7.83 MiB (8,016 KiB), compared with 164.03 MiB (167,968 KiB) for one Pi 0.84.1 RPC process (21.4×one in-process Allen actor) and 539.84 MiB (552,800 KiB) for one Oh My Pi 19.1.0 RPC process (70.5×). Even bare interpreter runtimes with zero agent code loaded start higher: Python 3.13 +asynciotakes 22.13 MiB and Node.js v24 takes 41.36 MiB. - Scaling across 1,000 concurrent sessions: An idle Tokio process uses
6.81 MiB,10sessions use8.36 MiB,100in-memory sessions use11.36 MiB,100durable SQLite WAL sessions (PRAGMA synchronous = FULL) use 12.80 MiB, and 1,000 idleInMemoryStoreactors inside one Tokio process fit in 38.80 MiB (+32.8 KiB/session). - Startup and hot-path latency: Spawned child RPC startup to
get_stateready takes 4.99 ms median (4.48–5.27 ms) in Allen, versus 479.47 ms for Pi (~96×slower) and 1,279.11 ms for Oh My Pi (~256×slower). Across2,000measured iterations (200warmup), Layer 0 policy/budget/effect checks run in 0.33 µs median (0.46 µsp99), split-chunk SSE metadata scanning runs in 4.00 µs, in-memorySessionRuntime::run_onceturns (without network or disk I/O) run in 12.3 µs (15.0 µsp99), five-dialect loopback HTTP SSE decoding runs in 94.8 µs (146.2 µsp99), and atomicSqliteAgentStore::commit_stepWAL writes complete in 169.7 µs (612.5 µsp99 under SQLite's macOS defaultPRAGMA fullfsync = OFF, versus 4.24 ms for a raw 512-byteFile::sync_data()F_FULLFSYNCdrive barrier). - Binary and package footprint: The standalone
allen-benchbinary strips to 7.38 MiB, versus 143 npm packages (173package.jsonfiles, 176.07 MiB plus Node.js v24) for Pi0.84.1and a 225.49 MiB compiled Bun executable (225.63 MiBCellar) for Oh My Pi19.1.0.
Reproduce these measurements or profile hot paths with samply, macOS xctrace, or Linux perf using tools/allen-bench:
cargo run --manifest-path tools/allen-bench/Cargo.toml --release -- --scenario all --compare-clisFour clean layers, zero lock-in
Allen splits the harness into four downward-only dependency layers so runtime policy, transport security, persistence, and tool execution stay cleanly separated:

- Layer 3 (
allen-harness,allen-runtime): Runs the session actor loop, exports redactedATIF v1.8trajectory logs, compacts context safely, and adds prompt assembly, approval hooks, confined markdown skill loading (SKILL.md), HTTP and environment-cleared stdio MCP discovery, and read-only Git plus gated GitHub tools. Host services plug in custom executors, stores, telemetry, skill workspaces, and write gates through open traits (Tool,AgentStore,UsageMetricsSink,SkillWorkspace,PublicRepoWriteGate). - Layer 2 (
allen-model,allen-credentials): Handles five streaming model formats (Anthropic Messages, OpenAI Responses, OpenAI Chat Completions, OpenAI Codex Responses, and Google Gemini) with residency verification alongside0600layered credentials and OAuth refresh. - Layer 1 (
allen-store,allen-store-sqlite,allen-http,allen-protocol): DefinesAgentStoreand its multi-worker race suite, implements the single-writer SQLite WAL actor, enforces DNS-pinned SSRF checks on HTTP egress, and provideswasm32-ready wire envelopes and sync deltas. - Layer 0 (
allen-types,allen-policy): Holds zero-I/O validated IDs, integerMicroUsdspend math, FSM transitions,SecretStringredaction, role gates, and duplicate-key JSON checks.
See docs/workspace-layout.md for the complete dependency graph, feature flags, and crate READMEs.
Open harness, closed multi-tenant operations
Teams running autonomous workflows against source repositories and internal APIs need to read the code handling credentials, egress, and approvals. At the same time, most teams prefer managed multi-tenant infrastructure over running advisory-locked Postgres clusters, metered settlement gateways, and container fleets themselves.
National Compute runs Allen 1.0 in production for SentryTower (sentrytower.com), pairing the open MIT OR Apache-2.0 harness with closed multi-tenant operations infrastructure:
- Multi-tenant PostgreSQL state backend: connection-pooled advisory-locked migrations, row-level job claiming, and multi-replica session concurrency.
- OpenTelemetry usage pipeline: live metric sinks streaming token, tool, and spend accounting into billing and operational dashboards.
- Metered model gateway and credit settlement: loopback key isolation, per-request credit reservation, and usage settlement ledgers.
- Host-isolated OS sandboxes and mutation executors: container isolation, concrete shell runners, worktree-mutating Git executors (
commit,push), and application interfaces.
Dual MIT OR Apache-2.0 licensing gives teams explicit patent protection with zero BSL or FSL conversion timers. Out of the box, Allen ships with SQLite persistence, DNS-pinned HTTP, five-dialect model streaming, web tools, MCP discovery, approval hooks, confined skill reading, and read-only Git plus gated GitHub tools—and hosts implement local shell or commit executors over traits without modifying Allen.
Get started
Allen 1.0 is available now on GitHub and published at 1.0.0 on crates.io. The workspace passes automated layer-boundary and wasm32-unknown-unknown checks (scripts/check-boundaries.sh), zero-warning clippy and rustdoc, and 309 automated unit, integration, and doc tests:
git clone https://github.com/National-Compute/allen.git
cd allen
bash scripts/check-boundaries.sh
cargo test --locked --workspace --all-featuresCheck the Quickstart for Cargo setup and a runnable minimal turn loop, or browse the specification in docs/standard/.