Software & Web Engineering

What Is an AI Agent? When to Hand It Work, and When Not To

Bàn làm việc của thợ đồng hồ vào ban đêm với bánh răng đồng thau và bộ máy đang lắp dở dưới ánh đèn vàng ấm
In this article

    What is an AI agent, and why does nearly every AI tool in 2026 wear that label, from customer support chatbots to software that writes code? A small shop owner opens a familiar app, sees a new “agent” button, taps it, and gets back a summary, a draft email, even an order already created. Nobody typed step by step instructions. Somebody handed over a goal, and the software found its own way there.

    This article answers in the order a newcomer actually needs: what an AI agent is, how it works, how it differs from a chatbot and an automated workflow, when to use one, when not to, and what it really costs. You do not need to know how to code to read it.

    Quick summary

    • An AI agent is software that takes a goal, decides its own steps, calls tools, and checks its own results until the job is done. What sets it apart from a chatbot is not that it is smarter, but who decides the steps.
    • There is no single agreed definition of an AI agent. Anthropic, Google, and OpenAI describe it differently in the details, but they agree on one point: the model steers itself instead of following a preprogrammed path.
    • Start with the simplest thing that works. If a single answer or a fixed workflow already solves the problem, you do not need an agent yet.
    • An agent charges by the loop, and an error in one step can spread to the steps after it. Limit the number of loops, grant read access first, and let a human approve the important steps.

    What is an AI agent?

    The shortest answer: an AI agent is a program that takes a goal, breaks it into steps, calls tools to carry out each step, then checks the results and repeats until the job is done. You hand over the work, and it finds its own way. You do not dictate every step.

    There is no single agreed definition of an AI agent. Anthropic, in Building effective agents from December 2024, admits that some people use the term for fully autonomous systems and others for workflows that follow preset steps. Google, in its Agents white paper from September 2024, defines an agent as an application that tries to reach a goal by observing the world and acting on it with the tools it has. OpenAI, in its practical guide to building agents from 2025, puts it more briefly: an agent is a system that completes tasks on your behalf.

    What the definitions share

    The three definitions meet at one point: a large language model, or LLM, makes the decisions. An LLM is an AI model trained on a large body of text, able to understand requests, reason, and produce language. On its own it only answers in words. Give it tools, and it can act.

    An agent built on an LLM usually has three parts: the model, the brain that decides the next step; the tools, the hands, such as web search, reading files, calling an API, sending email; and the orchestration layer, the loop that connects the model to the tools. An API is an interface that lets two pieces of software talk to each other, and What is an API explains the concept in five minutes. Many agents also have memory, a place to keep what has been done during a task.

    The boundary that matters in practice is not whether a system is called an agent. It is the question of who decides the steps. If a programmer drew the path in advance, that is a workflow, even if some steps call an AI. If the model decides the next step based on what it just observed, that is an agent.

    How does an AI agent work?

    Suppose a small shop owner wants to keep up with news about AI agents, and asks an agent to find and summarize the 3 newest articles on the topic. This is a hypothetical example, so you can see the loop inside. The task has a measurable goal and a clear stopping point, which makes it easy to follow loop by loop.

    Loop 1, the agent plans. The model reads the request and breaks it into steps: search for articles, filter by date, read the content, then summarize. It only decides what to do first.

    Loop 2, the agent calls the search tool. The tool returns a list of results. The agent looks at the results and notices that half the articles are more than a year old, while the task asks for the newest ones. This is where a workflow usually stops and reports an error. An agent does something else: it calls the search tool again with a recent date filter.

    Reading content and checking results

    Loop 3, the agent reads the content. It calls the page reader for each article in the new list and pulls back the main content. If a page returns an error or blocks access, the agent notes that and moves to the next article, instead of stopping the whole task.

    Loop 4, the agent checks and finishes. It compares the three summaries against the original request: are there 3 articles, is any source missing, do any two overlap? When every check passes, it stops and returns the result, with a link to each original article so the reader can verify.

    One loop, repeated

    These four loops are one loop repeated: goal, plan, call a tool, observe the result, repeat. Each loop gives the model fresh information from the tool results, so the next decision is better than the last. The loop stops when the goal is met, when it hits a preset loop limit, or when the agent meets an error it cannot handle on its own and hands the work back to a person.

    The code below is a simplified illustration, written so you can see the shape of the loop. It is not a working agent with a real LLM, because the model call and the tool call have been replaced by two placeholder functions.

    def run_agent(goal, max_loops=10):
        history = [goal]
        for loop in range(max_loops):
            next_step = model_chooses_step(history)  # assumption: the LLM decides
            if next_step == "done":
                return summarize_results(history)
            result = call_tool(next_step)            # assumption: search, read pages
            history.append((next_step, result))
        return "Hit the loop limit, handing the work back to a person."

    First, the loop limit sits inside the code, not in advice outside it. Without a limit, a stuck agent can run forever. Second, the history of steps taken goes back to the model on every loop, so the agent remembers what it already tried instead of repeating a failed step.

    Diagram of the AI agent loop with 4 steps: goal, plan, call a tool, and observe result
    Diagram of the AI agent loop with 4 steps: goal, plan, call a tool, and observe result

    How is an AI agent different from a chatbot, a workflow, and agentic AI?

    These four ideas get mixed up often, and the market in 2026 does not help. Gartner, in a press release from August 2025, calls the habit of putting an agent label on an ordinary AI assistant “agentwashing”. The table below compares them on the one question that decides it: who gives the orders at each step.

    AspectChatbotWorkflowAI agentAgentic AI
    Who decides the stepsThe user, turn by turnThe programmer, in advanceThe model, deciding as it goesSeveral agents working together
    Calls outside toolsNo, or very limitedYes, on a fixed pathYes, choosing tools per stepYes, each agent with its own tools
    Handles something newPoorly, answers from a scriptStops or reports an errorTries another way, up to a pointBetter through division of labor, but harder to control
    ExampleFAQ bot on a websiteAutomatic email series after signupAgent that finds and summarizes articlesA group of agents building one feature

    From chatbots to agentic AI

    A chatbot answers, an agent acts. That is true, but not enough. A chatbot with a search tool attached is still a chatbot if the user still decides each step. A workflow that calls an LLM at a few steps is still a workflow if the path is fixed.

    Agentic AI is a broader term than AI agent. It names the whole approach: systems with autonomy, possibly made of one or more agents working together and with people. One agent is one digital worker doing one role. Agentic AI is how you organize that whole digital team inside a process. To tell a real agent from a label when you try a product, ask three things: can it call outside tools on its own, does its chain of actions change with the situation, and does it notice its own mistakes and try again?

    When should you use an AI agent, and when should you not?

    Anthropic advises starting with the simplest solution possible, and adding complexity only when there is evidence the simple thing falls short. An agent trades latency and cost for task performance, so not every job is worth that price. For many applications, a single LLM call with document lookup is enough, and no multi-step system is needed.

    OpenAI names three signs that a workflow genuinely needs an agent. First, the workflow needs complex decisions with many exceptions, such as approving refunds in customer support. Second, the rules have grown so large that fixing one rule can break another, such as vendor security reviews. Third, the workflow depends heavily on unstructured data, such as reading emails, contracts, and meeting notes to process an insurance claim. If none of these three signs apply, a deterministic solution, code that runs fixed rules, is usually enough and much cheaper.

    When not to use an agent

    On the other side, some jobs clearly should not go to an agent. A job with one right answer and a fixed path, such as totaling an invoice or sending a templated reminder email, does not need a model to decide its own steps. A job that needs only one short answer, such as looking up opening hours, does not need a loop of many steps. A job where one wrong step can cause serious harm before anyone checks it, such as moving money or deleting data, should not run end to end on its own.

    A practical way to decide is to count the steps you cannot predict in advance. If you can list every step before you start, write a workflow. If the number and order of steps depend on results along the way, and you are willing to let the model choose, consider an agent.

    The real cost and limits of an AI agent

    An agent charges by the loop, and few articles say this plainly. Each loop is at least one model call, and each call is billed by the token. A token is the billing unit of a model API. The history of earlier loops also goes along with each new call, so each later loop usually costs more than the one before.

    Try the math with hypothetical numbers, using the published API prices of Claude Fable 5.2: $8 per million input tokens and $40 per million output tokens. Suppose a small research task runs 10 loops, each sending about 5,000 input tokens and receiving about 1,000 output tokens. That totals 50,000 input tokens, costing $0.40, and 10,000 output tokens, costing $0.40. One task costs about $0.80, while asking once through a chatbot costs about $0.04. The agent costs about 20 times more in this hypothetical calculation, because it calls the model 10 times instead of once.

    Errors, security, and operating costs

    Errors accumulate across loops too. This is arithmetic, not a measured result: suppose each step is right 95% of the time, then the chance that a chain of 10 steps is all right is only about 60%, because 0.95 to the power of 10 is about 0.6. One wrong step early on can throw off every step after it, because later steps build on the wrong result. Anthropic says this plainly: the autonomy of an agent brings higher costs and compounding errors, so it needs extensive testing in a sandboxed environment, with the right guardrails.

    Security is the third limit, and it sits in access rights, not in the model. An agent can only do what its tools and permissions allow. Give an agent permission to read email and it can read email. Add permission to send email, delete files, or move money, and one wrong decision can cause real damage. Gartner, in a press release from May 2026, predicts that by 2027, 40% of enterprises will demote or decommission autonomous AI agents because of governance gaps that only show up after incidents in production.

    Operating costs have already started to limit AI use in some places. McKinsey’s The state of AI in 2026, published in August 2026 with 1,719 participants in 97 countries, found that about 1 in 5 organizations has limited its AI use because of operating costs, including token costs. For an agent, that number matters twice as much, because an agent’s cost moves with the number of loops instead of staying fixed like a chatbot’s.

    What are AI agents actually doing in 2026?

    Coding agents are the clearest application. Anthropic says coding agents work well because answers can be verified with automated tests, agents can iterate on test results, and quality can be measured objectively. Will AI replace programmers looks closer at this, and What is ADLC explains the software development lifecycle when agents write the code. Even so, Anthropic stresses that humans still need to review, because automated tests check that the function runs correctly, but not that the solution matches the broader requirement.

    Customer support is the second application Anthropic names in its article. A conversation with a customer already follows a dialogue flow, but an agent can also look up customer data, order history, and help documents, then act, for example by issuing a refund or updating a ticket. Success is easy to measure by the share of requests resolved.

    Research, synthesis, and enterprise numbers

    Research and synthesis is the third. An agent reads many sources on its own, compares the information, and returns a report with citations. Readers still need to check the citations, because an agent can cite a source wrongly. AI search: how customers choose a provider looks at how customers pick a provider with AI search tools.

    The numbers show agents have moved past the experiment stage at large companies. Also according to the McKinsey survey from August 2026, 40% of organizations with revenue above $1 billion say they are scaling AI agents, up from 27% a year earlier. At smaller organizations, the share sits flat at 22%. Gartner, in its August 2025 press release, predicts that by the end of 2026, up to 40% of enterprise applications will include task-specific agents, up from less than 5% in 2025. That number counts vendors embedding agents into products people already use, not companies deciding on their own to adopt agents.

    Where to start: the simplest path

    The first step is not to build an agent. The first step is to use a chatbot or a single LLM call for the job you have in mind, and see whether the result is good enough. If one answer already solves the problem, you save the loop cost and avoid compounding errors.

    The second step, once you decide to try an agent, is to start at read-only level. Gartner, in its May 2026 press release, divides agents into 4 autonomy levels: observe, advise, act with approval, and act autonomously. An observe agent only reads data and returns results to the person who asked. An advise agent drafts the work, and a person reviews it before anything happens. These two levels carry low risk, because the agent changes no real data. Move up to acting only when the agent has run stably, with a full log of every step, and a measured error rate.

    Set limits and measure

    The third step is to set limits before you run anything. Limit the maximum number of loops, the token budget for one task, and the list of tools the agent may use. Grant read access first, write access later. For important steps such as emailing a customer or creating an invoice, require human approval before the agent acts.

    The fourth step is to measure and keep the power to stop. Log every step the agent took, the share of tasks completed, the average number of loops per task, and the token cost. If a task often hits the loop limit, that signals an unclear goal or tools that are not good enough, not a reason to raise the limit. When an agent goes wrong, you need to switch it off at once, and read the log to find the loop where it went wrong. A strong model such as Claude Fable 5.2 or Muse Ember gives better reasoning and tool choices but costs more tokens, so prototype with the strongest model first, then try smaller models on the easy steps.

    Frequently asked questions

    How is an AI agent different from a chatbot?

    A chatbot takes a question and answers in text, with the user driving each turn. An AI agent takes a goal, breaks it into steps, calls outside tools, and checks its own results. In short, a chatbot answers while an agent acts. The difference lies in who decides the steps, not in whether the system is called an agent.

    Can someone who cannot code build an AI agent?

    Yes. Platforms such as n8n or Make let you drag and drop an agent that calls APIs, reads email, and writes data into a spreadsheet, without writing code. When the flow gets complex, though, debugging gets hard and costs get hard to control, because every loop spends tokens. Start with an agent that only reads and drafts, and let a person approve before it changes real data.

    Cost, self-learning, and small businesses

    How much does building an AI agent cost?

    The main cost is API tokens, and it changes with the number of loops. With the hypothetical calculation in this article, using Claude Fable 5.2 prices, a small research task running 10 loops costs about $0.80, about 20 times a single chatbot question. In a company, the larger cost sits in monitoring, logging, testing, and permission management. McKinsey in August 2026 found about 1 in 5 organizations had limited AI use because of operating costs.

    Does an AI agent learn and get smarter on its own?

    No, not in the sense of updating the model. An LLM’s weights stay fixed after training, so an agent does not get better after each task on its own. It improves through memory of what it did, user feedback, and the operations team updating instructions, documents, and test suites on a schedule. When a product advertises an agent that “learns on its own”, ask how: by remembering context, or by retraining the model.

    When should a small business use an AI agent?

    When a process repeats often, has many steps whose order depends on results along the way, and the business accepts letting the model choose the steps. Examples: handling return requests, gathering quotes from several sources, or preparing a customer file before a meeting. Start at read-only and draft level, measure token cost and error rate for a few weeks, then decide whether to raise the agent’s permissions.

    Hand over the work, keep the decisions

    What an AI agent is comes down to how much decision-making power you hand to software. A system that breaks work down on its own, calls tools, and checks its own results is an agent. A system that follows a path you drew in advance is a workflow, even if it calls an AI at a few steps.

    First, start with the simplest thing that works, and add an agent only when the simple solution has been measured and found wanting. Second, an agent’s cost and errors are counted per loop, so loop limits, token budgets, and full logs are conditions for using an agent in production, not optional extras. Third, access rights are the biggest risk: an agent is only as dangerous as the permissions you grant it.

    If you are considering an agent for your own work, try one small task first. Give it a measurable goal, grant read-only access, set a limit of 10 loops, then read the log of every step it took. That log will tell you whether the agent deserves a bigger job, more clearly than any advertisement.

    Sources

    1. Anthropic, “Building effective agents”, https://www.anthropic.com/engineering/building-effective-agents, accessed 04/12/2026 (workflow vs agent definitions, when to use agents, three principles, customer support and coding agent examples; published 19/12/2024, updated 09/10/2026)
    2. Google, “Agents” (Julia Wiesinger, Patrick Marlow, Vladimir Vuskovic), https://archive.org/stream/google-ai-agents-whitepaper/Newwhitepaper_Agents_djvu.txt, accessed 04/12/2026 (agent definition, three components: model, tools, orchestration layer, September 2024)
    3. OpenAI, “A practical guide to building agents”, https://openai.com/business/guides-and-resources/a-practical-guide-to-building-ai-agents/, accessed 04/12/2026 (agent definition, three signs for building an agent, three components: model, tools, instructions, 2025)
    4. McKinsey, “The state of AI in 2026: On the road to ROI”, https://www.mckinsey.com/no/our-insights/the-state-of-ai, accessed 04/12/2026 (40% of large enterprises scaling AI agents, up from 27%; smaller organizations flat at 22%; 1 in 5 organizations limiting AI use over operating costs; survey 04/05-08/06/2026, 1,719 participants, 97 countries, published August 2026)
    5. Gartner, “Gartner Predicts 40% of Enterprise Apps Will Feature Task-Specific AI Agents by 2026, Up from Less Than 5% in 2025”, https://www.gartner.com/en/newsroom/press-releases/2025-08-26-gartner-predicts-40-percent-of-enterprise-apps-will-feature-task-specific-ai-agents-by-2026-up-from-less-than-5-percent-in-2025, accessed 04/12/2026 (up to 40% enterprise application forecast, “agentwashing”, 26/08/2025)
    6. Gartner, “Gartner Says Applying Uniform Governance Across AI Agents Will Lead to Enterprise AI Agent Failure”, https://www.gartner.com/en/newsroom/press-releases/2026-05-26-gartner-says-applying-uniform-governance-across-ai-agents-will-lead-to-enterprise-ai-agent-failure, accessed 04/12/2026 (40% of enterprises to demote or decommission autonomous agents by 2027, four autonomy levels, 26/05/2026)
    7. CodeGym Da Nang, “AI Agent là gì? Cách hoạt động, phân loại và ví dụ 2026”, https://codegymdanang.com/ai-coding/ai-agent-la-gi/, accessed 04/12/2026 (read to see what the top Vietnamese articles already cover; no figures taken from it)
    8. Base.vn, “AI Agent là gì? Cách hoạt động và ứng dụng cho doanh nghiệp”, https://base.vn/blog/ai-agent-la-gi/, accessed 04/12/2026 (read to see what the top Vietnamese articles already cover; no figures taken from it)
    Assistant Gnurt

    Full-stack developer

    Discuss your project

    Comments

    No comments yet. Be the first!