Building Production Software

AI Agents for Business: What They Are and How to Build One

An AI agent is a language model that chooses its own next step and uses tools to take it. This guide explains when that is worth the cost, when a fixed workflow is the better choice, and how to build a first agent that is safe to run.

By Rahul D SarkerPublished November 17, 2026Updated November 17, 20267 min read

Part of our Building Production Software series. Start with Production-Grade Software: Engineering Practices That Prevent Technical Debt.

The Short Answer

What is an AI agent?

An AI agent is software in which a language model decides what to do next, calls tools such as search, a database or an API to do it, looks at the result, and repeats until the task is finished. A chatbot answers a message. A workflow follows steps a developer wrote. An agent chooses its own steps, which makes it useful for open-ended tasks and harder to predict.

The word is used loosely. Many products sold as agents are fixed workflows with a model in one or two steps, and that is often the right design. Anthropic’s engineering guidance, Building effective agents, draws the line clearly: in a workflow the code decides the path, and in an agent the model does. It also advises starting with the simplest design that works and adding autonomy only when the task needs it.

Read the transcript

Most products sold as AI agents aren’t agents. They’re fixed workflows, with a model in one or two steps. And that’s often the right design. A chatbot answers a message. A workflow follows steps a developer wrote. An agent chooses its own steps, and uses tools to take them. That makes it useful for open-ended work. And harder to predict. So when do you actually need one? Here’s the test. Can you draw the task as a flowchart before it starts? If you can, build a workflow. It’s cheaper, faster and easier to test. If the path depends on what’s found along the way, build an agent. Then build it in this order. Pick one narrow task. Give it a few clear, read-only tools. Collect real test cases. Put every action that writes behind a person’s approval. And cap the steps and the spend. Three risks matter most. Text the agent reads can hijack it. Too much access turns a mistake into damage. And models state wrong answers with total confidence. Start with the simplest thing that works. Add autonomy only when the task needs it. The full guide is free at loomstrat.com.

Agent, Workflow or Chatbot

Chatbot, workflow and agent compared
ChatbotAI workflowAI agent
Who decides the stepsNobody; it replies to each messageThe developer, in codeThe model, at run time
Uses toolsSometimes, for lookupYes, at fixed pointsYes, whenever it chooses
PredictabilityHighHighLower
Cost per taskLowLow to mediumHigher; many model calls
Best forQuestions and answersRepeatable tasks with known stepsTasks where the steps cannot be known in advance
ExampleAnswering a returns questionClassify an invoice, extract fields, post to accountsInvestigate why a customer was double charged and draft the fix

A useful test: can you draw the task as a flowchart before it starts? If you can, build a workflow. It will be cheaper, faster and easier to test. If the path depends on what is found along the way, an agent may be justified.

How an Agent Works

Every agent has the same four parts.

  • A model. The language model that reads the task and decides the next action.
  • Tools. Functions the model can call: search the knowledge base, read an order, send an email, run a query. The Model Context Protocol is an open standard for describing tools so that they can be shared between agents.
  • A loop. The model acts, reads the result and decides again. The loop ends when the model says the task is done, or when a step limit or budget is reached.
  • Memory and context. The instructions, the conversation so far and any facts the agent has saved to use later.

Most of the engineering effort goes into the tools. A model with clear, well-named, well-documented tools makes good decisions. A model with vague tools makes mistakes that look like poor reasoning.

Where Agents Pay Off

Business uses for AI agents
AreaWhat the agent doesWhy an agent fits
Customer supportReads the ticket, checks the order and policy, resolves or drafts a replyEach case needs different lookups
Software engineeringReads a codebase, makes a change, runs the tests, fixes failuresThe work is checked automatically by tests
Research and analysisSearches many sources and writes a cited summaryThe number of searches is not known in advance
Sales operationsResearches an account and prepares a briefing before a callSources differ for every company
Finance operationsMatches payments to invoices and investigates exceptionsExceptions do not follow one path
Internal help deskAnswers staff questions and performs routine requestsHigh volume and clear permissions

The strongest cases share three things: the task has a clear definition of done, a mistake can be caught before it causes harm, and a person currently spends real time on it. Our guide to human-in-the-loop AI explains how to design the review step.

How to Build Your First Agent

  1. 1

    Pick one narrow task

    Choose a task a person does many times a week, with a clear finish. “Resolve refund requests under £50” is a task. “Handle support” is not.

  2. 2

    Write down how a person does it

    List the systems they open, the rules they apply and the cases they escalate. This becomes the instructions and the tool list.

  3. 3

    Try a workflow first

    If the steps are the same every time, write them in code and use the model for the judgement steps only. Stop here if it works.

  4. 4

    Build a small set of tools

    Start with read-only tools. Give each one a plain name, a clear description and a strict input format. Return errors the model can act on.

  5. 5

    Collect test cases before you tune

    Gather 30 to 50 real examples with the correct outcome. Run every change against them. Without this you are judging by impression.

  6. 6

    Add write actions behind approval

    Let the agent draft the refund, the email or the record change, and have a person approve it. Remove the approval only for actions with a low cost of error.

  7. 7

    Set limits

    A maximum number of steps, a spending cap per task and a timeout. An agent in a loop can run up a bill quickly.

  8. 8

    Log everything

    Record each model call, tool call and result so that any outcome can be explained afterwards.

  9. 9

    Release to a few users and measure

    Track completion rate, escalation rate, cost per task and how often a person corrects the result.

Risks and Guardrails

Agents fail in ways ordinary software does not. The OWASP Top 10 for LLM applications lists the main ones. Three matter most for a first build.

  • Prompt injection. Text the agent reads, such as an email or a web page, can contain instructions that redirect it. Treat everything the agent reads as untrusted, and never let read content alone trigger a sensitive action.
  • Excessive agency. An agent with more permissions than the task needs can do more damage when it goes wrong. Give it the narrowest access that works, and a separate identity so its actions can be audited.
  • Confident errors. Models state wrong answers fluently. Require the agent to cite the record or document it relied on, and check a sample.

If the agent handles personal data, UK data protection law applies as it does to any other system. The ICO’s guidance on AI covers lawful basis, transparency and decisions made without human involvement.

What Agents Cost

An agent costs more to run than a single model call because it makes many calls, and each call re-reads the growing context. The bill depends on the model, the number of steps and how much text each step carries. Three things keep it under control: use a smaller, cheaper model for simple steps, cache the instructions and tool definitions that repeat, and cap the steps.

Build cost is mostly integration. Connecting the agent safely to your order system, CRM or accounts package takes more time than the agent logic. Our AI feature integration guide covers model choice and cost in more detail.

Buy or Build

  • Buy when the task is common and a product already does it, such as a support agent inside your help desk tool.
  • Configure when a platform lets you describe the task and connect your tools without code, and the task is internal and low risk.
  • Build when the agent must work inside your own product, use your own data and rules, or do something that sets you apart.

If you are weighing a custom agent, talk to us. We build agents as part of custom software projects and will say so when a simple workflow would do the job.

Frequently Asked Questions

What is the difference between an AI agent and a chatbot?

A chatbot replies to messages. An agent decides on a series of actions, uses tools such as databases and APIs to carry them out, and continues until the task is complete.

Do I need an AI agent or a workflow?

If you can draw the steps as a flowchart in advance, build a workflow. Use an agent only when the steps depend on what is discovered during the task.

Are AI agents safe to use with customer data?

They can be, with narrow permissions, human approval for sensitive actions, full logging and the same data protection controls as any other system that processes personal data.

How much does it cost to build an AI agent?

It depends mainly on how many systems it must connect to. The agent logic is the small part; safe integrations, test cases and monitoring are most of the work.

What is the Model Context Protocol?

An open standard for describing tools and data sources so that AI models can use them. It lets one integration serve several agents.

Can an AI agent replace an employee?

Agents take over well-defined, repeatable tasks. People remain responsible for judgement, exceptions and approving actions that carry risk.

Have a build brief already forming in your head?

Loomstrat Studio scopes, builds, and hands over production software in 3–6 weeks - fixed price, 100% repository ownership.

  • Reply within 24 hours
  • Fixed price before we start
  • Zero technical debt guarantee