Skip to content
SEM ROI
AI agents

How to Build an AI Agent for Your Business: 7 Steps, Real Costs and Pitfalls

A business process, not a coding tutorial: decide whether you need an agent, scope one task, design tools, test before launch, and work out what it costs to build and to run.

Ahmet Molon, founder of SEM ROI
Ahmet Molon
Founder
7 min read
A man kneeling in a bright, empty room, building a wooden tower model step by step, with plans and tools around him

Most guides on how to build an AI agent are coding tutorials: install a framework, paste an API key, watch it browse the web. That is the easy part. The hard part, and the reason so many agent projects stall, is choosing the right task, giving the agent safe access to your systems and proving it works before customers see it. This guide covers the process we follow for clients, the architecture behind it and what an AI agent costs, with the arithmetic shown.

Before you build: do you need an agent?

Gartner predicts that over 40% of agentic AI projects will be cancelled by the end of 2027, "due to escalating costs, unclear business value or inadequate risk controls". Many of those should never have been agents. Anthropic's guidance is to look for "the simplest solution possible, and only increasing complexity when needed. This might mean not building agentic systems at all."

OpenAI's practical guide to building agents names three signs that an agent is worth it. If none applies, "a deterministic solution may suffice":

  • Complex decisions that depend on context and judgement, such as approving a refund exception.
  • Rules that are hard to maintain, where the rule set has grown too large to keep correct by hand.
  • Heavy reliance on unstructured data: emails, documents, free-text requests, conversations.

If you are unsure where your idea sits, our explainer on agentic AI vs AI agents vs generative AI lays out the ladder from a single call to a multi-agent system.

How to build an AI agent in 7 steps

  1. Step 1
    Pick one task and define "done"

    One job with a measurable end state, e.g. "a valid quote draft is in the CRM within 10 minutes of the RFQ email".

  2. Step 2
    Map the data and access

    Which systems the task touches, which fields, under whose account, and what must never be reachable.

  3. Step 3
    Choose the architecture

    Workflow or agent, one agent or several, which model. The simplest option that passes the tests wins.

  4. Step 4
    Design the tools and permissions

    Few tools, named in business terms, with clear descriptions, narrow scopes and confirmations on committing actions.

  5. Step 5
    Build the evaluation set

    Real requests with expected outcomes, including messy, ambiguous and hostile ones. This is your definition of "works".

  6. Step 6
    Pilot with a person in the loop

    The agent proposes, a person approves. Measure pass rate, time saved and every correction.

  7. Step 7
    Launch, monitor, improve

    Widen autonomy only where the data supports it. Watch cost per task, error rates and new failure types.

1. Pick one task and define "done"

The best first agents replace a repetitive task that people already do by hand, with a clear finish line. "Handle customer service" is not a task. "Answer order-status emails and change delivery addresses before dispatch" is. Write down how you will know it worked: time per request, share of requests completed without a person, error rate.

2. Map the data and access

List every system the agent must read or change, the exact fields and the account it acts under. This is where most hidden cost sits: duplicate customer records, product data spread across three tools, no API for the booking system. If the agent needs company knowledge such as policies or manuals, plan a retrieval layer (RAG) and decide who keeps those documents current.

3. Choose the architecture

Start with one agent and a handful of tools. Move to several agents only when one agent's instructions become too long to follow reliably, or when steps need different permissions. Choose the model by testing it on your evaluation set, not by benchmark: a smaller, cheaper model often passes a well-scoped task.

4. Design the tools and permissions

Each tool is a contract the model reads. Name it after the business task (change_delivery_address, not patch_order), describe when to use it and when not, and validate every input on your side. Increasingly these tools are exposed through an MCP server, which lets the same tools work in your own app and in assistants like ChatGPT, Claude and Gemini.

5. Build the evaluation set before the prompt

Collect 50 to 200 real requests from your inbox, chat logs or tickets, and write the correct outcome for each. Add the awkward ones: two requests in one message, missing order numbers, angry customers, a message that tries to talk the agent into a refund. Every change to the prompt, tools or model runs against this set. Without it you are tuning by anecdote.

Common mistake

Testing an agent only on the examples used to write its prompt. It will look perfect and fail on the first real week of traffic. Keep a held-out set it was never tuned on.

6. Pilot with a person in the loop

In the pilot the agent prepares the action and a person approves it. You learn where it is reliable, where it hesitates and what it costs per task, without customer risk. OpenAI notes that "customers typically achieve greater success with an incremental approach" than with a fully autonomous agent from day one.

7. Launch, monitor, improve

Give the agent autonomy step by step: first the actions where the pilot showed near-perfect results, the rest stay with a person. Log every run, review failures weekly and add each new failure type to the evaluation set.

AI agent architecture: the components

  • Component: Model
    What it is: The LLM that reads, plans and decidesDecide early: Which model passes your evals at an acceptable cost per task
  • Component: Instructions
    What it is: The system prompt: role, rules, tone, when to stopDecide early: Who owns them and how changes are reviewed
  • Component: Tools
    What it is: Actions the agent can call in your systemsDecide early: Names, inputs, scopes, confirmations
  • Component: Knowledge
    What it is: Documents and data it can retrieveDecide early: Source of truth and update process
  • Component: Memory
    What it is: What it keeps between steps or conversationsDecide early: What is stored, for how long, and why
  • Component: Orchestration
    What it is: The loop that runs model and tool callsDecide early: Limits on steps, time and spend per task
  • Component: Guardrails
    What it is: Checks on inputs, outputs and actionsDecide early: What is blocked, what needs approval
  • Component: Observability
    What it is: Traces, logs, cost and quality metricsDecide early: Who reviews them and how often
ComponentWhat it isDecide early
ModelThe LLM that reads, plans and decidesWhich model passes your evals at an acceptable cost per task
InstructionsThe system prompt: role, rules, tone, when to stopWho owns them and how changes are reviewed
ToolsActions the agent can call in your systemsNames, inputs, scopes, confirmations
KnowledgeDocuments and data it can retrieveSource of truth and update process
MemoryWhat it keeps between steps or conversationsWhat is stored, for how long, and why
OrchestrationThe loop that runs model and tool callsLimits on steps, time and spend per task
GuardrailsChecks on inputs, outputs and actionsWhat is blocked, what needs approval
ObservabilityTraces, logs, cost and quality metricsWho reviews them and how often

How much does it cost to build an AI agent?

Search for AI agent development cost and you will find ranges like "$5K to $500K". They are not wrong, they are just not useful: they come without a method, and the same tiers are repeated from site to site. Here is how to estimate your own, in two parts.

Build cost: hours × rate

Build cost is people's time. The main drivers, roughly in order of impact:

  • Integrations. Each system the agent touches needs an API, an account and error handling. A system without an API can double the work.
  • Data clean-up. Agents expose messy data quickly. Duplicate records and outdated prices surface in the first week.
  • Evaluation and safety. Building the test set, running it, fixing failures. Plan for this to be a large share of the work, not an afterthought.
  • Number of tools and rules. Three well-designed tools are cheaper and more reliable than fifteen.
  • Review and launch on external platforms (for example Google's Connected Console or a ChatGPT app), if the agent works inside public assistants.

Ask any vendor, us included, for an estimate broken down this way, with hours per item. A single number without the breakdown hides where the risk is.

Running cost: work it out per task

Running cost is mostly model usage, paid per million tokens (MTok). The formula is simple:

formula
cost per task = calls per task × (input tokens × input price + output tokens × output price)

A worked example with list prices from Anthropic's pricing page (October 2026): Claude Sonnet 5.5 at $2 per million input tokens and $10 per million output tokens; Claude Haiku 5.5 at $0.10 and $0.50 (for prompts up to 100K tokens). Take an agent that makes 6 model calls per task, each with about 20,000 input tokens (instructions, tool definitions, conversation, retrieved documents) and 1,500 output tokens.

  • Item: Input: 6 × 20,000 = 120,000 tokens
    Sonnet 5.5: $0.24Haiku 5.5: $0.012
  • Item: Output: 6 × 1,500 = 9,000 tokens
    Sonnet 5.5: $0.09Haiku 5.5: $0.0045
  • Item: Per task
    Sonnet 5.5: ≈ $0.33Haiku 5.5: ≈ $0.017
  • Item: 1,000 tasks a month
    Sonnet 5.5: ≈ $330Haiku 5.5: ≈ $17
ItemSonnet 5.5Haiku 5.5
Input: 6 × 20,000 = 120,000 tokens$0.24$0.012
Output: 6 × 1,500 = 9,000 tokens$0.09$0.0045
Per task≈ $0.33≈ $0.017
1,000 tasks a month≈ $330≈ $17

Two levers change this a lot. Prompt caching: most of those 20,000 input tokens (instructions, tool definitions) repeat on every call, and cached reads are billed at a fraction of the input price ($0.10 per MTok on Sonnet 5.5). Model routing: let a small model handle simple steps and call the larger one only when needed. Add hosting, logging and any paid APIs the tools call, which are usually small next to model usage. Then compare the total with the cost of the same task done by hand.

Maintenance: what keeps costing after launch

  • Model updates and retirements, each needing a re-run of the evaluation set.
  • Changes in the systems the tools call: new API versions, renamed fields, new products.
  • New failure types found in monitoring, each becoming a fix and a new test case.
  • New tools as the scope grows, each with its own review.

Build or buy?

  • Aspect: Fits when
    Buy (off-the-shelf agent): The task is generic: meeting notes, inbox triage, standard supportBuild (custom agent): The task runs on your own systems, rules or data
  • Aspect: Time to start
    Buy (off-the-shelf agent): DaysBuild (custom agent): Weeks
  • Aspect: Control
    Buy (off-the-shelf agent): The vendor's tools, model and roadmapBuild (custom agent): Your tools, model choice and logs
  • Aspect: Main risk
    Buy (off-the-shelf agent): It cannot reach the systems that matterBuild (custom agent): Underestimating integration and evaluation work
AspectBuy (off-the-shelf agent)Build (custom agent)
Fits whenThe task is generic: meeting notes, inbox triage, standard supportThe task runs on your own systems, rules or data
Time to startDaysWeeks
ControlThe vendor's tools, model and roadmapYour tools, model choice and logs
Main riskIt cannot reach the systems that matterUnderestimating integration and evaluation work

A common middle path: buy the generic agents, and build the thin layer that is unique to you, usually an MCP server over your own systems that any of those agents can use.

Why AI agent projects fail

  • No clear task or success measure, so nobody can say whether it works. Gartner's "unclear business value".
  • Costs found late: running cost per task never calculated, integration work underestimated.
  • No risk controls: broad permissions, no confirmations, no logs. One visible mistake ends the project.
  • Demo-driven testing: tuned on a handful of examples, never tested on real traffic.
  • Agent where a workflow would do: more cost and less predictability for no gain.

Frequently asked questions

  • How much does it cost to build an AI agent?

    Build cost is the hours for integrations, data clean-up, tools, evaluation and launch, times the rate. It depends mostly on how many systems the agent touches. Ask for an estimate broken down by these items rather than a single figure.

  • How much does it cost to run an AI agent per month?

    Multiply calls per task by tokens and the model's price, then by monthly volume. In our example, 6 calls with 20,000 input and 1,500 output tokens each cost about $0.33 per task on Claude Sonnet 5.5 and about $0.017 on Haiku 5.5, before caching.

  • How long does it take to build an AI agent?

    A pilot for one well-scoped task, on systems with working APIs, is a matter of weeks. Integrations without APIs, messy data and external platform reviews add the most time.

  • Can I build an AI agent without coding?

    For simple tasks, yes: no-code tools and built-in agent builders in many SaaS products work well for generic jobs. Once the agent must act on your own systems with your own rules, you need custom tools, permissions and testing.

  • What is the difference between an AI agent and a workflow?

    In a workflow your code fixes the steps and a model handles some of them. In an agent the model decides the steps and which tools to call. Workflows are cheaper and more predictable; agents handle tasks whose path depends on what they find.

  • What are the main components of an AI agent?

    A model, instructions, tools, knowledge, memory, an orchestration loop, guardrails and observability. Tools and guardrails decide whether it is safe; the evaluation set decides whether it works.

  • Should I use one agent or several?

    Start with one. Split into several only when the instructions become too long to follow reliably or when parts of the task need different permissions.

  • Why do AI agent projects fail?

    Mostly for business reasons: no clear task, costs discovered late and missing risk controls. Gartner names exactly these three for the projects it expects to be cancelled by 2027.

Sources

  • AI agents
  • AI agent development
Ahmet Molon, founder of SEM ROI
Ahmet Molon
Founder