Why Agent Harnesses Keep Coming Back to TypeScript
Western teams building agent harnesses face the same trade-off between TS-driven iteration speed and native performance. The article gives a concrete decision rule: pick TS when your product already lives on Node.js or Electron, and move to Rust only when startup, memory, or system-level constraints start hurting.
Agent harnesses deal with sessions, tool calls, context, and user interruptions, not model training. That workload is mostly async I/O, event handling, and UI, which is exactly what Node.js and TypeScript are good at, so teams shipping Claude Code, Gemini CLI, OpenCode, and Pi all settled on TS. The article breaks down the concrete reasons: the event loop suits waiting on network and tool processes, shared types keep tool execution, message protocol, and UI in sync, and the surrounding ecosystem supplies SDKs and plugins without reimplementation.
The type system alone doesn't verify external model output, so harnesses pair TS with runtime validators like Zod. Tool parameters are described to the model, validated on input, and typed in code from one schema, which reduces drift but does not replace permission checks or result verification. The article also notes that Claude Code picked TS partly because the model itself is more fluent in TypeScript and React, which matters when an agent has to edit the codebase hosting it.
The counter-example is Codex, which migrated its runtime to Rust to cut Node.js install dependencies, lower memory and runtime overhead, and get native sandboxing. The author argues both choices are right for their stage: TS wins for fast iteration and shared-layer changes, Rust wins when distribution cost and resource ceilings dominate. The practical advice is to start with TS when your product already sits on Electron, React, or Node.js, and to keep CPU-heavy work out of the event loop.
The choice of language for an agent harness is really a choice about which layer of the product hurts most: TypeScript optimizes for coordinated changes across runtime and UI, while Rust optimizes for distribution and resource ceilings.
Static typing misleads agent developers into thinking an interface is a contract; the article is right that external model JSON is untrusted and must pass runtime validation, and even then a valid parameter doesn't imply a safe operation.
Model familiarity with a codebase's stack can be a legitimate engineering input, not just developer preference, because the agent itself becomes a maintainer of that code.
The Codex migration doesn't contradict TS's convenience; it shows that the same team values different properties at different stages, so the real question is what bottleneck dominates right now.