Your AI Agent Needs No Framework: A 200-Line TypeScript Harness
Description and use
A 200‑line TypeScript harness shows that a simple loop, tool registry, limits, and approval gate are sufficient for a basic agent, eliminating the need for a framework.
Problem
Developers often start agent projects with a framework, leading to debugging inside abstractions and unnecessary complexity.
Outcome
The harness successfully enforces max turns, max cost, repeated‑call guard, and approval gate, proving that a minimal loop can replace a framework for simple agents.
Workflow
- Define Message, ToolCall, ModelResponse, ToolDef, Limits, AgentResult types
- Implement sameCall guard for repeated calls
- Create runAgent function that loops: send messages to model, process tool calls, enforce limits, verify final answer, and handle approval gate
Evidence
Your agent does not need a framework. It needs a loop, a tool registry, three limits, and one approval gate.
I ran it against a stub model before writing this post to confirm the turn limit, the cost budget, the repeated-call guard, and the approval gate all fire as described.
- Record date: 2026-11-01T10:29:15.850Z