cd /news/ai-agents/claude-agent-vs-claude-code-which-on… · home topics ai-agents article
[ARTICLE · art-22056] src=dev.to pub= topic=ai-agents verified=true sentiment=· neutral

Claude agent vs Claude Code: which one are you actually building?

A developer has published a minimal agent loop built on the Anthropic SDK, demonstrating that the core logic for a custom AI agent fits in roughly 40 lines of code. The implementation reveals that most agent frameworks are unnecessary, as the fundamental tool-calling loop is small enough to write from scratch. The project, called AgentLoop, is available as open-source MIT-licensed code with a streaming Next.js starter that can be deployed with a single command.

read2 min publishedJun 5, 2026

Search "claude agent boilerplate" and you'll drown in Claude Code results — the agentic CLI, CLAUDE.md

files, slash commands, hooks. Great tools. But none of that is what you want if you're trying to build your own agent on the Anthropic SDK.

Here's the disambiguation, and the ~40 lines that are actually the whole thing.

Most "agent frameworks" just hide that loop from you. It's small enough that you don't need them.

import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic();

async function runAgent(userText, tools, runners) {
  const messages = [{ role: "user", content: userText }];

  for (let i = 0; i < 10; i++) {
    const res = await client.messages.create({
      model: "claude-sonnet-4-6",
      max_tokens: 1024,
      tools,
      messages,
    });

    messages.push({ role: "assistant", content: res.content });

    // No tool requested -> the model is done.
    if (res.stop_reason !== "tool_use") {
      return res.content.filter((b) => b.type === "text").map((b) => b.text).join("");
    }

    // Run every tool it asked for this turn, collect one result each.
    const results = [];
    for (const block of res.content) {
      if (block.type === "tool_use") {
        const out = await runners[block.name](block.input);
        results.push({ type: "tool_result", tool_use_id: block.id, content: out });
      }
    }
    messages.push({ role: "user", content: results });
  }
}

That's it. The four things people get wrong:

tool_result

per request, matched by tool_use_id

.If you'd rather start from a streaming Next.js app you can deploy in one command, I open-sourced exactly this (MIT): ** AgentLoop** — the whole agent in ~150 readable lines, no framework. Clone it, add a key, deploy.

There's a $29 Pro pack for the patterns you hit in production (parallel tools, persistent memory, retries, rate limiting, approval gates, evals, token metering, and a multi-provider seam so it runs on any model) — but the free core stands alone forever.

Build the loop. Own it. Don't import a black box.

── more in #ai-agents 4 stories · sorted by recency
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/claude-agent-vs-clau…] indexed:0 read:2min 2026-06-05 ·