Your AI Agent Needs No Framework: A 200-Line TypeScript Harness
说明与用途
一个200行的TypeScript harness展示了,对于基本代理,只需循环、工具注册表、限制和审批门即可,无需框架。
问题
Developers often start agent projects with a framework, leading to debugging inside abstractions and unnecessary complexity.
结果
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.
工作流
- 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
证据
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.
- 记录日期: 2026-11-01T10:29:15.850Z