AgentLoop

Frameworks & SDKs 💻 TypeScript ⚖️ MIT 🟡 Quiet lately
2 stars

AgentLoop is a minimal, readable AI agent starter built on the Anthropic SDK and Next.js, demonstrating the core streaming tool-use loop in about 150 lines of code. It solves the problem of complex frameworks or bloated templates by providing a simple, understandable foundation for developers who want to build and own their own agent. It is for developers who want to learn how agents work or quickly bootstrap a production-ready agent without a heavy framework.

✨ Key features

  • Streaming chat with plain fetch and ReadableStream
  • Real tool use loop with two example tools
  • Typed and commented Next.js App Router code
  • One-command deploy to Vercel
  • Free MIT core, no SDK lock-in

🎯 Use cases

  • Learn how AI agents work by reading a minimal implementation
  • Build a custom agent product with streaming and tool use
  • Deploy a simple agent to Vercel quickly
  • Extend with custom tools by editing one file

📦 Installation

🧰 Requirements: Node.js, npm, and an Anthropic API key (ANTHROPIC_API_KEY) for running the agent.

git clone https://github.com/mnifzied-create/agentloop.git
cd agentloop
npm install
cp .env.example .env.local      # then paste your ANTHROPIC_API_KEY
npm run dev                     # http://localhost:3000

🚀 Usage

After installation, ask the agent what is (12 * 9) + 7? and watch it call the calculate tool. The agent will stream the response and use tools as needed.

⚠️ Good to know

The free core is a minimal starter with a bounded loop (5 steps) and only two example tools; production features like parallel tool calls, memory, and rate limiting are available in the paid Pro version.

❓ FAQ

How do I build a Claude agent from scratch?

A Claude agent is just a loop: send the conversation to the model, run any tool it calls, append the result, and repeat until it replies. AgentLoop is a free, MIT-licensed starter that does exactly this in about 150 lines.

Why is my AI agent so expensive?

Most agent cost is invisible because you re-send the system prompt and tool schemas on every turn. Verbose tool definitions are billed repeatedly, and a typical support agent carries around 650 tokens of tool schemas per turn.

How do I estimate Claude agent token cost?

Count what you re-send each turn (system prompt, tool schemas, prior messages, tool outputs) and multiply by turns and model price. The free Agent Token Profiler does this in your browser.

How do I reduce my AI agent's token cost?

Trim verbose tool schemas, summarize tool outputs, cap conversation history, and route easy turns to a cheaper model like Claude Haiku. Measure first with the Token Profiler.

📊 Repository

Stars★ 2
Forks🍴 0
Open issues🐛 0
Last commit🕒 Jul 10, 2026
Created📅 Jun 2026
Language💻 TypeScript
License⚖️ MIT

🤖 Overview, features, install steps and FAQ were generated from the project's README on Sep 4, 2026. Always check the original source before running commands.