# What is an AI agent, and how is it different from a chatbot?

Date: 2023-04-17 · Author: Robert Scales · https://guidetoartificialintelligence.com/en/learn/ai-agent-different-chatbot/

**Answer:** An AI agent is a program that gives a language model a goal, a set of tools such as web search or file writing, and a loop that lets it choose and carry out one step after another until it decides the goal is met. A chatbot answers one message at a time and waits for you; an agent keeps going on its own, which makes it more ambitious and also much easier to send off course.

In the past three weeks, "AI agent" has moved from research papers to people's own computers, largely because of Auto-GPT, an open-source project released on March 30. Its README, the project's main instruction page, describes a program driven by GPT-4 that chains together the model's "thoughts" to pursue whatever goal you set. That is a different way of using a language model than typing into ChatGPT, and it helps to understand the difference before trying one.

## Four parts that make an agent

A chatbot has one job: read the conversation and write the next reply. An agent wraps the same kind of model in four extra parts.

1. **A goal.** Instead of a question, you give an objective. Auto-GPT asks you to name your AI, describe its role and list up to five goals.
2. **Tools.** The agent can take actions in the world, not just write text. Auto-GPT's first version listed commands such as Google search, browsing a website, writing to a file, starting helper agents and declaring the task complete.
3. **A loop.** After each action, the result is fed back to the model, which decides on the next step. This repeats until the agent judges the goal achieved, or until you stop it.
4. **Memory.** Because a model can only read a limited amount of text at once, agents keep notes. Auto-GPT has short- and long-term memory and can even be pre-loaded with documents split into chunks it can recall later.

The idea of mixing thinking and doing has a research background. A 2022 paper called ReAct, short for reasoning and acting, had language models alternate between writing out their reasoning and taking actions such as looking something up through a simple Wikipedia tool. The authors found that checking outside sources reduced made-up facts compared with reasoning alone. Auto-GPT applies a similar pattern: each turn, the model returns its thoughts, its reasoning, a short plan, a self-criticism and one command to run.

## A worked trace: where an agent gets stuck

Here is the kind of goal a beginner might give an agent:

```prompt
Name: TripPlanner
Role: an assistant that plans affordable weekend trips
Goal 1: Find three family-friendly things to do in Quebec City in July.
Goal 2: Estimate the cost of each for two adults and two children.
Goal 3: Save the results to a file called trip.txt.
```

The trace below is illustrative, written to show typical behavior rather than copied from a real run:

| Step | Agent's thought | Command | What happens |
|---|---|---|---|
| 1 | I should search for activities | Google search | Gets a list of links |
| 2 | Read the first result | Browse website | Gets a long travel article |
| 3 | Save notes before I forget | Memory add | Stores three activity names |
| 4 | Find ticket prices | Browse website | The site's prices page needs a date picker it cannot use |
| 5 | Try another source | Browse website | Finds last year's prices |
| 6 | Check if prices are current | Google search | Results look similar to step 1 |
| 7 | Read the first result | Browse website | Same article as step 2 |

By step 7 the agent is going in circles. It cannot fill in the website's form, it has no way to tell that last year's prices are out of date, and its memory of what it already tried is incomplete. Each step also costs money, because every turn is a paid call to OpenAI's API. Notice, too, that it has not yet written trip.txt, the only part of the goal you could easily check.

This is why Auto-GPT, by default, stops after each action and asks you to authorize the next command, type feedback or exit. You can approve several steps at once, and there is a "continuous mode" that runs with no approval at all. The README calls that mode potentially dangerous and warns it may run forever or take actions you would not authorize.

> **Try it:** Without installing anything, write out the goal and the first five steps you think an agent would take for a task of your own, such as comparing three laptops under $800. Mark the steps where a website, a login or out-of-date information could stop it.

## What can agents like AutoGPT actually do today?

They can carry out short, well-defined research and writing chores: run a few searches, read pages, collect notes and save a summary to a file. For developers, they are a fascinating way to see how far a model can plan on its own. The software is changing fast: the README currently tells users to download the stable release, because the main development version may often be broken.

They are not reliable assistants yet. The README lists the limits plainly: it is an experiment, not a polished product, it may struggle with messy, real-world business problems, and it is expensive to run, with a full day of development easily costing about $20 in API fees. Agents can repeat themselves, chase dead ends and trust weak sources, as the trace shows. Setup also needs some comfort with the terminal, Python and a paid OpenAI API key.

If you experiment, keep the goals small and checkable, leave approval on, set spending limits on your API account and watch every step. The README also recommends a separate virtual machine for anything that needs strong security. Treat today's agents as a preview of a new way of working, and keep the important decisions in your own hands.

## Sources

- Auto-GPT README (commit of 2023-04-15): https://github.com/Significant-Gravitas/AutoGPT/blob/6a98ebdb9c84b28e2a893e974de8896463b46f2f/README.md
- ReAct: Synergizing Reasoning and Acting in Language Models: https://arxiv.org/abs/2210.03629v1
- Auto-GPT: An Autonomous GPT-4 Experiment (repository at commit 1f0905a, 30 March 2023): https://github.com/Significant-Gravitas/AutoGPT/tree/1f0905aa2b0bcd248fed3fcd250a64bfd6440b7f
