Build Your Own AI Coding Agent Harness news update
Vercel Academy launched an eleven-module course teaching developers to build TeensyCode, an AI coding harness powered by TypeScript and the Vercel AI SDK.
By Dillip Chowdary • Nov 14, 2026 • Source: vercel.com
In this post
Vercel Academy and instructor Joel Hooks launched Build Your Own AI Coding Agent Harness, an eleven-module course that guides developers through building an autonomous coding harness named TeensyCode from scratch. The curriculum uses TypeScript, the Vercel AI SDK, Vercel Sandbox, and just-bash to transform simple chatbot loops into production systems, as detailed in vercel.com's report.
This technical guide covers the architecture of TeensyCode, detailing tool contracts, sandboxed virtual execution, context management, subagent delegation, and verification protocols. Software engineers building developer tools or autonomous coding agents will learn the engineering decisions required to execute untrusted code safely, control context growth, and orchestrate headless agent systems across modern runtimes.
01Tool loops and execute safety gates
The harness begins by transforming a chatbot into a ToolLoopAgent through an iterative sequence where every added tool resolves a specific limitation. Adding a read tool lets the model inspect files, while grep enables searching codebases without dumping entire directories into context. When shell execution is added, the agent enforces execute-level gates and safe-command allowlists to prevent destructive operations.
Tool descriptions evolve into five-section contracts defining when to use, when not to use, prohibited scenarios, and concrete examples. Shell execution separates interface contracts from execution logic using a factory pattern. Approval gates advance from simple boolean checks to dynamic functions and discriminated unions that accommodate interactive prompts, background execution, and delegated approvals.
System prompts rely on structured Agency and Guardrails sections that direct the model to execute edits rather than explaining proposed changes. Dynamic prompt construction adapts instructions to runtime conditions while integrating project-specific AGENTS.md files. Verification gates enforce mandatory typechecking, linting, testing, and building before any task concludes.
02Dual sandbox backends and execution abstraction
Tools interact through an abstract Sandbox interface rather than binding directly to Node child process methods. The interface defines standard signatures for reading files, executing commands, and terminating environments. Lifecycle hooks handle startup initialization, pre-termination cleanup, and recovery routines when operations exceed configured execution limits.

The local sandbox implementation wraps Node filesystem operations and child process execution on the host machine. For safe isolated runs, an in-memory backend uses just-bash with a copy-on-write virtual filesystem overlay to emulate execution without permanent changes. Developers can swap between local and virtual backends without modifying tool definitions.
Cloud deployments provision remote virtual machines through Vercel Sandbox, supplying isolated environments equipped with git and npm. This model prevents untrusted code from compromising host infrastructure while introducing trade-offs around startup latency and per-minute billing. Engineers balance these factors to ensure secure yet responsive development workflows.
Advertisement
Tech Pulse Daily
Get tomorrow's pulse first
Join engineers who read Tech Pulse before stand-up. Free, weekday mornings.
03Token pruning and subagent role delegation
Uncontrolled tool outputs generate linear context growth that quickly exhausts model capacity and displaces foundational instructions. The harness counters token inflation through pruneMessages routines that purge outdated tool payloads from conversation history. Enforcing hard output limits on tools stops oversized logs from entering context, while provider cache headers lower repeated token expenses.
Complex tasks divide execution between specialized subagents with isolated context boundaries and restricted tool permissions. An explorer subagent pairs a lightweight model like Claude Haiku 4.5 through the AI Gateway with read-only tools to survey files cheaply. An executor subagent uses a stronger model with full editing permissions to implement verified plans.
A dedicated task tool routes assignments between parent coordinators and child subagents based on strict role profiles. String-based model identifiers remove the need for vendor-specific wrapper libraries when routing calls through the unified AI Gateway. This structure prevents exploration noise from cluttering planning context while restricting destructive capabilities to authorized agents.
04Durable lifecycle workflows and human approvals
Managing cloud sandbox lifecycles requires state machines that track active execution, enforce timeout limits, and govern operational transitions. Vercel Workflow orchestrates multi-step lifecycles using durable sleep routines that suspend execution without incurring continuous compute fees. Snapshot and restore capabilities freeze virtual machine state, requiring careful handling to prevent idempotency hazards during resumption.
The harness eliminates guesswork through an interactive askUser tool that presents multiple-choice options for ambiguous requests. An ambiguity protocol directs the agent to search existing project files first, ask clarifying questions second, and edit code only after resolving ambiguities. Configurable approval modes support interactive user prompts, background operations, and delegated policies.
Planning routines center on a Todo tool that breaks instructions into structured tasks with tracked status states. Context discovery requires agents to grep codebase symbols before reading targeted files selected for modification. A verification contract requires agents to supply test evidence before declaring completed tasks.
05Headless client surfaces and extensible skills
TeensyCode maintains a headless architecture that separates the core agent loop from display layers. Developers can implement a terminal CLI supporting command-line flags, a sandbox factory, and clean process shutdowns. The same core powers web interfaces and terminal screens, streaming text output and tool calls without altering execution logic.
Extensibility relies on event bus architectures and runtime tool registrations rather than rigid class inheritance. A skills system achieves progressive disclosure by placing skill names in system prompts while loading full instruction content on demand. Custom tools register without forking code, while lifecycle hooks allow extensions to monitor or modify events.
The capstone tests the harness on a real production task: implementing rate limiting on authentication routes. Developers evaluate context limits, debug tool selection errors, refine subagent instructions, and resolve runtime issues under authentic conditions. The curriculum requires TypeScript, Node.js 22 or Bun, an AI Gateway key, and basic terminal skills.
Build Your Own AI Coding Agent Harness news FAQ
What runtime and environment prerequisites are required to build TeensyCode?
Developers need Node.js 22+ or the Bun runtime, TypeScript experience, and an AI_GATEWAY_API_KEY environment variable. The course also recommends completing the Building Filesystem Agents course.
What sandbox backends does the TeensyCode harness support?
TeensyCode supports a local backend using Node fs and child_process, an in-memory backend using just-bash with a copy-on-write virtual filesystem, and cloud virtual machines via Vercel Sandbox. Tools interact through a shared Sandbox interface across all three backends.
How does TeensyCode prevent context window exhaustion during long coding tasks?
The harness uses pruneMessages to delete stale tool outputs, enforces bounded caps on tool response sizes, and adds provider cache headers to reduce repeated processing costs.
How are subagents divided within the harness architecture?
Tasks split between an explorer subagent running a lightweight model like Claude Haiku 4.5 with read-only tools and an executor subagent running a stronger model with full filesystem modification capabilities.
Sources
Author
Dillip Chowdary
Writes Tech Bytes coverage of AI, engineering, and the tools that actually ship. Editor of Tech Pulse Daily.
Related on Tech Bytes
Advertisement