How AI agents work
What an agent is, how it differs from a chatbot, and when not to use one.
- What this is
- A plain page about AI agents: tools, memory, guard rails, cost, and when a simple chatbot or a form is better.
- Who it is for
- Anyone thinking about an AI helper for their business.
- What you will get
- A clear idea of what an agent can safely do for you, and what it costs.
- Time
- 6 min read
The short answer
A chatbot only talks. An agent talks and also acts, by using a short list of tools that you allow, one step at a time. Most small businesses need a simple chatbot first. Build an agent only when a real job needs tools, and keep a person in charge.
Chatbot or agent?
The same question, two answers.
- ChatbotAnswers from what it was told. It cannot do anything outside the chat.
Customer: Is my order ready? Bot: Please call the shop. - Agent with a read toolLooks the answer up in your system, then replies.
Customer: Is my order ready? Agent: looks up the order, then says: Yes, it is ready for pick-up. - Agent with a request toolCan write a request, but a person approves it before anything happens.
Customer: Book me Sunday at 5. Agent: creates a pending request. You approve it.
How an agent works, step by step
This is the whole loop. It repeats until the job is done or a person takes over.
- A message arrives: the customer asks something.
- The agent thinks about the next step. It can only use its instructions and your facts.
- It picks ONE tool from your short list, or decides to just answer.
- Your own code runs the tool and checks the permission. The agent never runs anything by itself.
- The agent reads the result and decides: answer, use another tool, or hand over to a person.
- Every step is saved in a log, with the cost.
The five parts of an agent
1. The brain
An AI model from a company such as Anthropic, OpenAI or Google. You send it text and it sends text back.
- Cost
- You pay by the amount of text, counted in tokens (small pieces of words). Read the current prices on the company's own site.
2. Tools
Small jobs your code can do for the agent, like looking up opening hours or writing a booking request.
- Good for
- Start with none. Add one read-only tool when you need it.
- Not good for
- A tool that deletes, pays, refunds or changes prices.
3. Memory
The agent only remembers what you send it each time: the chat so far and your facts. Keep the facts in a list you control.
- Good for
- A short list of true facts, checked by you.
- Not good for
- Letting it learn from chats by itself. It can learn wrong things.
4. Guard rails
Rules that the server enforces: what it may answer, which tools it may use, when it must hand over, and what it must refuse.
- Good for
- Rules in your code, not only in the instructions.
- Not good for
- Trusting the agent to behave. A customer can write: ignore your rules.
5. Cost caps and logs
A daily and a monthly limit, a kill switch, and a log of every message and tool. The key and the limit also live in the AI company's dashboard.
- Good for
- A small cap while you learn, for example 5 KWD a month.
- Not good for
- No limit. A leaked key or a loop can cost real money.
When NOT to use an agent
- The answers are always the same. A page of questions and answers is cheaper and never wrong.
- The job is a form: name, date, time. Use a booking form.
- A mistake would cost money or hurt someone. Keep a person in the loop, or do not automate it.
- You cannot check its work. If you cannot test it, do not put it in front of customers.
Next
Ready to try?
Build the smallest useful agent in about an hour, with a cost cap and a person to take over.
Was this clear?
Still not clear?