All posts
What is an AI agent? How it differs from a chatbot and how it works
Published
Short answer
An AI agent is software in which a language model works toward a goal step by step, using tools it is given (search, a database, APIs, files) and looking at the result of each step to decide the next one. A chatbot only answers; an agent does work. In short: agent = model + tools + loop + context.
Chatbot, workflow and agent
- Chatbot: takes a question and produces a text answer. It changes nothing in the outside world.
- Workflow: you write the steps in advance. The model generates text at certain steps, but the order is fixed.
- Agent: the model decides the next step. It chooses which tool to call and when to stop.
The lines are not sharp. Many useful systems sit somewhere between the three.
The parts of an agent
- Model: the language model that decides and writes.
- Tools: functions the model can call, such as web search, a database query, an email draft or reading a file.
- Loop: the code that returns each tool result to the model so it can decide again.
- Context: the instructions, history and tool outputs the model can see right now. Long tasks need memory or summarizing.
- Limits: a step limit, permissions, timeouts and points where a human has to approve.
How the loop works
- The user gives a goal.
- The model looks at the goal and the available tools, then either answers or asks to call a tool.
- Your code runs the tool and gives the result back to the model.
- The model reads the result, decides whether the job is done, and either continues or writes the final answer.
When to use an agent and when a simple flow
When the steps are known in advance, a fixed workflow is cheaper, faster and more predictable. An agent makes sense for open-ended work where the steps depend on the input: research, multi-step data gathering, code changes. Start with the simplest solution and move to an agent only when you need to.
Limits
- Models make mistakes, so put irreversible actions behind human approval.
- Every step adds latency and cost.
- Behavior is hard to predict, so log every step and test with real tasks.
Questions
- What is the difference between an AI agent and a chatbot?
- A chatbot answers a question with text. An agent uses tools to do work in the outside world and decides the next step itself after looking at the result.
- Does every job need an agent?
- No. When the steps are known in advance, a fixed workflow is cheaper and more predictable. Agents make sense for open-ended work.
- Are agents safe?
- Not by themselves. You need to limit their permissions, require human approval for irreversible actions and not trust outside content.
Written by Mert Yılmaz, freelance fullstack developer.