UnattendedClaude Code Guides

AI Agent vs Automation: A 5-Question Test for Claude Code

By Aoba Works · Published · Sources checked · 16 min read

How this guide was made: drafted with AI assistance from the official sources linked below, then passed an automated editorial check before publishing. Our process

The difference between an AI agent and automation comes down to who picks the next step. With automation, you write every step ahead of time and the same input always takes the same path. With an AI agent such as Claude Code, the model looks at the situation and chooses its own next action. Anthropic's engineering guide puts it this way: workflows are systems "orchestrated through predefined code paths," and agents are systems "where LLMs dynamically direct their own processes and tool usage" (Anthropic, Building Effective Agents). Here is the practical test. If a task needs judgment at points where the right path depends on messy input, use an agent at those points. If the task is just steps on predictable input, write a script.

Which option is right for you?

Most solo builders should start with a script. Add a Claude Code agent step only where the script keeps failing on inputs it can't predict.

Which option is right for you?
Your situationWhat to pick firstFirst page to open
Beginner, never automated anythingA plain shell script or cron job. You can read every line, and debugging is easyClaude Code Cron Job Setup
Daily dev work (PR reviews, failing tests, triage)A Claude Code agent in headless mode (claude -p) with a short tool allowlistRun Claude Code programmatically
Work that lives on GitHub (issues, PRs)The Claude Code GitHub Action, triggered by @claude or a scheduleClaude Code GitHub Actions
Tight budget, fixed and structured inputsA script, with no model calls. Each run costs nothing beyond computeMake: when to use AI agents
Mostly fixed steps plus one fuzzy decisionA hybrid: script around a single claude -p --json-schema callThe "How do you combine both?" section below
Unattended runs overnightA headless agent with strict permissions and retry handlingPermissions headless template

One reason for each pick. Scripts fail loudly and in the same place every time, so they suit beginners. Agents are worth their cost when inputs vary, as with diffs, logs and tickets. The GitHub Action saves you from writing your own server. A hybrid keeps the model's freedom limited to one step.

What Is the Difference Between AI Agent and Automation?

Automation runs steps you defined in advance. An AI agent like Claude Code decides which steps to run, based on what it observes as it works.

Under the hood, Anthropic describes the building block of agentic systems as an LLM enhanced with retrieval, tools and memory (Building Effective Agents). Claude Code is that building block packaged as a tool. It reads files, runs shell commands, edits code, and loops until it decides the job is finished. A cron job that runs rsync never decides anything. It does exactly what the line says.

What Is the Difference Between AI Agent and Automation?
Scripted automationAI agent (e.g. Claude Code)
Who chooses the next stepYou, in codeThe model, at runtime
Same input → same output?YesNot guaranteed
Handles inputs you didn't anticipateNo, it errors or does the wrong thing silentlyOften, by reasoning about them
Cost per runCompute onlyModel tokens plus compute (--output-format json reports total_cost_usd, per the headless docs)
SpeedMilliseconds to secondsSeconds to minutes
Failure modeCrash at a known linePlausible but wrong action, or errors that compound
DebuggingRead the codeRead the transcript

For example, a script that moves invoices from an inbox to a folder works perfectly until a vendor sends a PDF named scan001.pdf with no invoice number in the subject line. An agent can open the PDF, find the number, and file it. It can also misread it. Both outcomes are possible, and that is the trade.

Anthropic is direct about the cost: "agentic systems often trade latency and cost for better task performance" (Building Effective Agents). The same article warns about the "potential for compounding errors" in autonomous runs, which is why agents need guardrails that scripts don't.

AI Agent vs Automation Workflow: Which One Fits Your Task?

A task needs a Claude Code agent when it requires branching judgment on varied or unstructured input. If it only needs repeatable steps on structured input, a script fits better.

Here are the five questions. Answer them for one specific recurring task, not for "my work" in general.

  1. Can you write the steps down completely today? If yes, and they cover at least nine out of ten real cases, write a script. If you keep writing "it depends", that is where judgment lives.
  2. Is the input structured? JSON from an API, a CSV with fixed columns, and a database row are structured. A bug report, a stack trace, a git diff or a customer email is not. Unstructured input points toward an agent.
  3. Does the number of steps vary? Anthropic recommends agents for "open-ended problems where it's difficult or impossible to predict the required number of steps" (Building Effective Agents). Fixing a failing test might take one edit or twelve. Syncing two APIs always takes the same calls.
  4. What does a wrong answer cost? If a mistake is cheap and reversible, such as a draft comment or a label, an agent is fine. If it is expensive or permanent, such as a payment, a deleted record or a production deploy, keep that step scripted, or let the agent only propose and have a human approve.
  5. Does it run often enough that the cost per run matters? A job that runs every 5 minutes pays model costs 288 times a day. If a script can do it, the script wins on budget.

How to score it: two or more answers that point to an agent (no to Q1, unstructured for Q2, variable for Q3) means an agent step is justified. A high-cost answer on Q4 means that step stays scripted or gated, whatever the other answers say.

Example, labeled as an illustration. "Every morning, check the CI failures from last night and open a fix PR." Q1: no, because every failure is different. Q2: unstructured logs. Q3: variable. Q4: medium, since a PR is reviewable before merge. Q5: once a day. The result is an agent, with the PR as the human checkpoint. Compare "Every morning, back up the Postgres database to S3." Q1: yes. Q2: structured. Q3: fixed. Q4: high. The result is a script.

Common mistake: running the test on the whole pipeline instead of on each step. "Triage support tickets" fails the test as one unit. Split it into fetch, classify, route and reply, and usually only "classify" needs an agent.

AI Agent vs Agentic AI vs Automation: How Do the Terms Relate?

Automation is the umbrella. An AI agent such as Claude Code is one kind of automation that makes decisions. "Agentic AI" describes systems built from agent-like parts.

Anthropic's own vocabulary is the clearest anchor. Its guide says "we categorize all these variations as agentic systems," then splits them into workflows and agents (Building Effective Agents). So in Anthropic's usage, "agentic" covers both LLM workflows (fixed code paths that call a model) and true agents (the model directs the path).

AI Agent vs Agentic AI vs Automation: How Do the Terms Relate?
TermWhat it means in practiceExample
AutomationAny process that replaces manual work, AI or notCron + bash backup, a Zapier zap, an RPA bot
LLM workflowFixed code path with model calls at defined stepsScript that sends each ticket to Claude for a label, then routes by label
AI agentModel decides its own steps and tool use in a loopclaude -p "Run the test suite and fix any failures"
Agentic AI / agentic systemUmbrella for the two above, and for multi-agent setups such as an orchestrator with workersClaude Code spawning subagents for parallel research

Vendors stretch these words. Some product pages call any chatbot with a webhook "agentic AI". When you see the term, ask one question: who chooses the next step, the code or the model? That answer tells you more than the label does.

Is AI Part of Automation, or Separate From It?

AI is one way to automate, and Claude Code is one AI tool among several. Automation is the goal, and AI, scripting and RPA are methods for reaching it.

The methods sit side by side:

UiPath now describes RPA as "the execution layer" under AI agents (UiPath). That reflects the shape most teams end up with: deterministic tools do the actions, and AI decides which action to take.

For example, think of a solo SaaS founder's weekly churn report. A scheduled script pulls cancellations from Stripe's API, which is plain automation. A Claude call reads the free-text cancellation reasons and groups them into themes, which is AI used inside automation. The script then emails the summary, which is automation again. Calling this either "AI" or "automation" would be only half right.

AI Agent Automation Examples: Which Tasks Need an Agent?

Tasks with varied input need an agent. Claude Code agents beat scripts when the fix depends on what the agent finds, as in debugging, code review, triage and research.

These come straight from the patterns in Anthropic's docs:

Pitfalls and fixes:

Who agents are not for: anyone who needs byte-identical output on every run, such as compliance exports or invoice numbering. Agents also cost money on every run, and that cost varies with codebase size and task complexity (GitHub Actions docs).

AI Automation Examples: Which Tasks Should Stay Scripted?

Backups, syncs between two APIs, templated emails and scheduled reports from fixed queries should stay scripted. They need no judgment, and a script is cheaper, faster and repeatable.

Make's own guidance says it plainly: for jobs like notifications and record updates, "classic automation is faster, cheaper, and easier to maintain" (Make). Make lists the conditions where agents don't fit: rules that are fixed and stable, inputs that are clean and structured, and speed and consistency that matter more than judgment.

Examples where a script is the better tool:

AI Automation Examples: Which Tasks Should Stay Scripted?
TaskWhy a script wins
Nightly pg_dump to S3Same command every night, and a wrong action is costly
Copy new Stripe customers into your CRMStructured JSON on both ends, with a fixed field mapping
Send a welcome email from a templateNo decision at all
Rotate logs older than 14 daysfind -mtime +14 -delete is one line and has no edge cases
Bump a version and tag a releaseDeterministic, and reproducibility matters

Pitfalls and fixes:

Who scripts are not for: tasks whose inputs change faster than you can update the rules. If you keep patching regexes for new edge cases every week, that is the sign to move that one step to an agent.

Using AI for Automation: How Do You Combine Both?

Use a hybrid. Scripted automation does the deterministic steps, and a single Claude Code call sits at the one decision point that needs judgment.

Anthropic's guide describes this shape. "Prompt chaining" splits a task into a sequence of steps, and "routing classifies an input and directs it to a specialized followup task" (Building Effective Agents). It lists five workflow patterns in total: prompt chaining, routing, parallelization, orchestrator-workers and evaluator-optimizer. For solo builders, routing is the most useful one: the model labels the input, and your code acts on the label.

Steps to build one (the example below is an illustration of support-ticket triage):

  1. Write the deterministic parts first. Fetch the input and save it to a file. Piped stdin to claude -p is capped at 10MB, and for anything bigger the docs say to write it to a file and reference the path (headless docs).
  2. Make the model return a fixed shape. Use --output-format json with --json-schema. The result arrives in the structured_output field (headless docs). An enum in the schema keeps labels to a closed set your script can branch on.
  3. Give the agent step the fewest tools possible. A classifier needs Read and nothing else.
  4. Branch in code, not in the prompt. jq reads the label, and case decides what happens next.
  5. Check the exit code. Claude Code "exits with code 0 on success and a non-zero code when the run fails" (headless docs).
  6. Schedule it with cron. See Claude Code Cron Job Setup.
#!/usr/bin/env bash
# Example: hybrid triage. Script steps around one agent step.
set -euo pipefail

./fetch_new_tickets.sh > /tmp/tickets.json   # deterministic (your own script)

schema='{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string","enum":["refund","bug","other"]}},"required":["id","label"]}}},"required":["items"]}'

out=$(claude --bare -p "Read /tmp/tickets.json. Label each ticket refund, bug, or other." \
  --allowedTools "Read" \
  --output-format json \
  --json-schema "$schema") || { echo "agent step failed" >&2; exit 1; }

echo "$out" | jq -r '.total_cost_usd'          # log spend per run
echo "$out" | jq -c '.structured_output.items[]' | while read -r t; do
  case "$(echo "$t" | jq -r .label)" in
    refund) ./route_to_billing.sh "$t" ;;      # deterministic
    bug)    ./open_issue.sh "$t" ;;            # deterministic
    *)      ./send_template_reply.sh "$t" ;;   # deterministic
  esac
done

Common mistakes with hybrids:

AI Agent and Automation Course: Is It Worth Taking One?

You usually don't need a paid course. Anthropic's Claude Code documentation, the Building Effective Agents article and the cookbook cover the core material at no cost.

What the free material covers:

When a course helps: you learn better with a sequenced curriculum and exercises than by reading reference docs. When it doesn't: you already know the problem you want to solve. Building that one hybrid script teaches you more than a general course will.

Pitfalls when choosing a third-party course: tools change quickly. The headless docs alone mention behavior changes at several 2.1.x versions. A course recorded a year ago may teach flags that have since been renamed. Check the recording date. Be wary of any course that promises income from "AI automation agencies". That promise is about marketing, not about the skill you are trying to learn.

Next steps

Do it yourself today:

  1. Pick one recurring task and run the five-question test on each of its steps. Write the answers down.
  2. If every step comes out "script", write the script and schedule it with cron. You're done, and no model is involved.
  3. If one step comes out "agent", try that step alone first: claude -p "<your instruction>" --allowedTools "Read" --output-format json. Then wrap it with the hybrid script above.

If you'd rather not build it yourself:

Related guides on this site:

FAQ

What is AI agent and automation?

Automation is any setup that does manual work for you by following rules you wrote. An AI agent is a kind of automation where a model such as Claude decides its own next steps and which tools to use, in a loop. You can combine them: scripts for the fixed steps, an agent for the judgment calls.

What is an AI agent vs automation?

A scripted automation takes the same path every time for the same input. An AI agent may take a different path each run, depending on what it finds. Anthropic describes agents as systems where the model maintains "control over how they accomplish tasks" (Building Effective Agents). Choose based on whether the task needs judgment.

AI agents vs automation: what are people saying on Reddit?

This guide doesn't summarize Reddit threads, because forum opinions can't be sourced the way documentation can. When you read them, judge each claim with the five-question test. Ask whether the commenter is describing structured or unstructured input, and whether a wrong action in their case could be undone. Claims about limits or pricing should be checked against the vendor's official page.

Automation vs AI: which term should I use?

Use "automation" for the goal and "AI" for the method. A cron job is automation without AI. A script that calls Claude to classify text is AI-assisted automation. Say "agent" only when the model chooses the steps, which avoids the vague way "agentic" often gets used.

Sources

Spotted something out of date or wrong? Tell us at shigoto.ai.note@gmail.com. Guides are re-checked against official sources on a rolling schedule.