DEV Community

Cover image for I built a zero-dependency TypeScript agent loop with 24 built-in tools and human permission gates (No LangChain, No NestJS)
Rajdeep Sadhu
Rajdeep Sadhu

Posted on

I built a zero-dependency TypeScript agent loop with 24 built-in tools and human permission gates (No LangChain, No NestJS)

Hey r/typescript!

Over the past year, every time I looked into building an autonomous coding agent in TypeScript, I was greeted with massive dependency trees, bloated Python wrappers, or heavy enterprise frameworks that drag in 400+ transitive packages just to run a loop.

So I built Smoke Monkey Harness — an embeddable, framework-agnostic TypeScript agent harness with 0 npm runtime dependencies.

What makes it different?

  1. Zero Runtime Dependencies: Pure TypeScript compiled down to standard Node.js primitives (child_process, fs/promises, events, fetch).
  2. Deterministic 6-Phase State Machine: Instead of an unconstrained ReAct loop that burns tokens in circles, agents progress predictably through: explore ➔ plan ➔ edit ➔ verify ➔ recover ➔ complete.
  3. 24 Built-in Native Tools: Full filesystem (atomic edits, multi-chunk replace, regex search), terminal execution with strict timeout & abort controller safety, git staging/diffing, and web inspection.
  4. Three Human Permission Pauses: Never let an LLM run rm -rf without authorization. Guardrails pause on shell execution, file edits, or external API calls until explicitly approved.
  5. Model Context Protocol (MCP): Native stdio MCP server & client support to connect directly into Claude Code, Cursor, or your custom services.

Quick Example:


typescript
import { AgentLoop, AnthropicProvider, FileSystemTools, TerminalTools } from 'smoke-monkey-harness';

const agent = new AgentLoop({
  model: new AnthropicProvider({ apiKey: process.env.ANTHROPIC_API_KEY }),
  tools: [...FileSystemTools, ...TerminalTools],
  permissions: {
    terminal: 'ask_before_run',
    fileEdit: 'auto_approve',
  },
  maxPhases: 15,
});

await agent.run("Find all uncaught Promise rejections in src/ and add defensive try/catch blocks with unit tests.");

We also built an interactive agent simulator and drop-in web UI canvas (@smoke-monkey/ui).

🌐 Live Demo & Docs: [](https://smoke-monkey-harness.vercel.app)
📦 NPM: npm install smoke-monkey-harness
Would love to hear your feedback on the architecture and API ergonomics!
Enter fullscreen mode Exit fullscreen mode

Top comments (0)