AIToday

Anthropic breaks down AI coding loops into 4 types for Claude Code users

ITmedia AI+1h ago5 min read
Anthropic breaks down AI coding loops into 4 types for Claude Code users

Key takeaway

Anthropic released a structured guide explaining four types of loops—turn-based, goal-based, time-based, and proactive—that developers can use in Claude Code to automate AI agent tasks. Each loop type is organized by its trigger condition, stop condition, underlying primitive (e.g., CLI command), and follow-up action. The guide helps developers choose the right loop pattern for different automation scenarios, from human-directed workflows to fully autonomous goal pursuit.

Summaries like this, in your inbox every morning.

Sign up free →

3 Key Points

  • What happened

    Anthropic published a guide titled "Getting started with loops" on June 30, 2026, explaining how Claude Code's loop feature works across four distinct patterns: turn-based, goal-based, time-based, and proactive loops. The guide organizes each loop by what triggers it, when it stops, what primitive it uses, and what comes after.

  • Why it matters

    AI agents often get stuck repeating tasks without clear stopping points. By naming and contrasting these four loop types, Anthropic helps developers and AI teams design more predictable automation—each pattern suits different workflows (e.g., turn-based for human-driven feedback, goal-based for autonomous targets, time-based for scheduled checks, proactive for human-directed agent behavior). This clarity reduces confusion about when and how to apply loops in Claude Code.

  • What to watch

    The guide emphasizes the difference between /loop (local, runs on your PC) and /schedule (cloud-based, runs as a background service). Developers can also use "Routines" in Claude Desktop to automate loop execution. The distinction between these two command types and the proactive loop design may help teams avoid costly repeated token consumption and better manage agent workload.

Context & Analysis

Anthropic's guide addresses a practical pain point in AI agent design: loops are powerful but easy to misuse. The body notes that prior guides referred to loops generically as "recursive loops" or "agent loops," leaving developers uncertain about which pattern fit their use case. By dividing loops into four named, structured types—each defined by trigger, stop condition, primitive, and sequel—Anthropic has made the feature more teachable and less error-prone.

The distinction between turn-based and goal-based loops is particularly significant: turn-based loops depend on human feedback at each step, while goal-based loops allow the agent to decide when to stop once a target is met. Time-based loops introduce a temporal constraint, and proactive loops grant the human control over start/stop without requiring a schedule or goal. This taxonomy helps developers match their automation intent to the right tool, reducing cases where an agent runs amok or consumes unexpected resources.

The guide's emphasis on /loop (local, synchronous) versus /schedule (cloud, asynchronous) further clarifies deployment trade-offs. For teams using Claude Code, this structural clarity may lower the barrier to confidently building multi-turn agent workflows. The mention of Routines in Claude Desktop suggests Anthropic is also making loop automation accessible via UI, not just CLI commands, though the guide centers on command-line usage.

FAQ

What are the four loop types Anthropic describes?
Turn-based loops follow human instruction and iteration; goal-based loops pursue a stated target; time-based loops run on a schedule (via /loop or /schedule commands); and proactive loops run when triggered by human direction, not on a timetable or goal condition.
What is the difference between /loop and /schedule commands?
/loop runs locally on your PC and stops when the PC shuts down, producing a synchronous heartbeat. /schedule runs in the cloud as a background service and is better suited for asynchronous, external-loop tasks; it is closer to how a proactive loop would run outside the local environment.
Why is the stop condition important for loops?
AI agents running loops consume tokens (the unit of text processed) as long as they keep executing. Defining a clear stop condition—what makes the loop end—prevents the agent from running indefinitely and helps manage cost and performance.

Discussion

No comments yet. Be the first to share your thoughts!

Log in to join the discussion

Related Articles

Stay ahead with AI news

Get curated AI news from 200+ sources delivered daily to your inbox. Free to use.

Get Started Free

Free · takes 30 seconds · unsubscribe anytime

1 minute a day. The AI essentials.

200+ sources · Email / LINE / Slack

Get it free →