{"slug": "claude-agent-vs-claude-code-which-one-are-you-actually-building", "title": "Claude agent vs Claude Code: which one are you actually building?", "summary": "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.", "body_md": "Search \"claude agent boilerplate\" and you'll drown in Claude **Code** results — the agentic CLI, `CLAUDE.md`\n\nfiles, 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.\n\nHere's the disambiguation, and the ~40 lines that are actually the whole thing.\n\nMost \"agent frameworks\" just hide that loop from you. It's small enough that you don't need them.\n\n``` python\nimport Anthropic from \"@anthropic-ai/sdk\";\nconst client = new Anthropic();\n\nasync function runAgent(userText, tools, runners) {\n  const messages = [{ role: \"user\", content: userText }];\n\n  for (let i = 0; i < 10; i++) {\n    const res = await client.messages.create({\n      model: \"claude-sonnet-4-6\",\n      max_tokens: 1024,\n      tools,\n      messages,\n    });\n\n    messages.push({ role: \"assistant\", content: res.content });\n\n    // No tool requested -> the model is done.\n    if (res.stop_reason !== \"tool_use\") {\n      return res.content.filter((b) => b.type === \"text\").map((b) => b.text).join(\"\");\n    }\n\n    // Run every tool it asked for this turn, collect one result each.\n    const results = [];\n    for (const block of res.content) {\n      if (block.type === \"tool_use\") {\n        const out = await runners[block.name](block.input);\n        results.push({ type: \"tool_result\", tool_use_id: block.id, content: out });\n      }\n    }\n    messages.push({ role: \"user\", content: results });\n  }\n}\n```\n\nThat's it. The four things people get wrong:\n\n`tool_result`\n\nper request, matched by `tool_use_id`\n\n.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.\n\nThere'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.\n\nBuild the loop. Own it. Don't import a black box.", "url": "https://wpnews.pro/news/claude-agent-vs-claude-code-which-one-are-you-actually-building", "canonical_source": "https://dev.to/zied_mnif_2f4225fb8d70342/claude-agent-vs-claude-code-which-one-are-you-actually-building-5ek9", "published_at": "2026-06-05 00:02:54+00:00", "updated_at": "2026-06-05 00:42:01.421966+00:00", "lang": "en", "topics": ["ai-agents", "large-language-models", "ai-tools", "ai-products"], "entities": ["Claude", "Anthropic", "Claude Code", "Claude Sonnet 4-6"], "alternates": {"html": "https://wpnews.pro/news/claude-agent-vs-claude-code-which-one-are-you-actually-building", "markdown": "https://wpnews.pro/news/claude-agent-vs-claude-code-which-one-are-you-actually-building.md", "text": "https://wpnews.pro/news/claude-agent-vs-claude-code-which-one-are-you-actually-building.txt", "jsonld": "https://wpnews.pro/news/claude-agent-vs-claude-code-which-one-are-you-actually-building.jsonld"}}