What Is an AI Agent? 3 Chatbot Differences and Token Cost
What is an AI agent? In short, it is a model-driven program that can call tools on its own and carry out a task one step after another. A chatbot answers once and is done. An agent thinks, acts, looks at the result, and decides the next step, until it believes the task is finished. That difference is also exactly why it costs more tokens.
How is an AI agent different from a regular chatbot?
There are three differences.
| Chatbot | AI agent | |
|---|---|---|
| One interaction | You ask once, the model answers once | You give one goal, the model breaks it into steps |
| What it can do | Output text only | Call tools: read and write files, run commands, search, call APIs |
| Who decides the next step | You | The model, based on the result of the previous step |
The second point is the key one. A model only produces text. "Calling a tool" means it outputs a request in an agreed format (for example, "read src/app.js"), the surrounding program actually executes it, and the result is handed back to the model as new input. The tool-call format varies by API, so check each vendor's official docs for details.
How do coding agents like Claude Code and Codex work?
Claude Code and Codex are both coding agents, meaning agents built for writing code. They share the same core loop:
- Read your goal, for example "change the login API's error messages to Chinese."
- The model decides what to do first, such as searching for relevant files.
- The outer program runs that action and hands the output (file contents, command results) back to the model.
- Based on that, the model decides again: keep reading, edit a file, or run the tests.
- If the tests fail, go back to step 2. It stops only when they pass.
What you see is "it fixed the code by itself." Behind that are often many model calls, and for complex tasks, a great many. These tools usually ask for your confirmation before running commands that modify things; for the exact permission and confirmation mechanisms, see each tool's official docs.
Why do agents use more tokens than chat?
There are three reasons, all coming from the loop above.
- Every round carries the earlier context. The model has no memory between calls, so on each call the system prompt, your goal, the files it already read, and earlier command output are all sent again. The more rounds, the more input accumulates (whether you get a caching discount depends on the provider).
- Tool output is long. Reading a large file or running a full test suite can return thousands of words, and all of it goes into the context.
- It takes extra steps. Trial and error, backtracking, and re-verifying are all additional calls.
So for the same "change one feature," asking once in a chat window may use very few tokens, while having an agent do it uses far more. For what a token is and why billing is based on it, see What is a token in an LLM. To estimate roughly what a task will cost, see AI agent tasks burn tokens: how to estimate cost and pick a plan.
How can you tell whether a tool is an agent?
Check with three questions:
- Can it read and write files on your computer directly, or run commands?
- If you give it only a goal, does it break the work into steps and decide the next step itself?
- Within one task, does it make several model calls in a row?
If all three are yes, it is basically an agent. If it just gives you a snippet of code in a chat box for you to copy, that is a chatbot. Also, MCP is a general protocol that lets an agent connect to external tools and data; for an introduction, see What is MCP.
What do beginners need to try an agent?
Roughly three things: a tool that can run an agent (Claude Code, Codex, and so on), a usable model API, and a practice project where mistakes don't matter (manage it with Git first so you can roll back if something breaks). If you are starting from zero, read What is vibe coding and what do you need to try it first.
For the model API step, official accounts and APIs require supported regions and payment methods; follow each vendor's official instructions, and comply with the terms of service and local laws. If you can't easily use an overseas credit card, AGI Plan is one option. It is a multi-provider LLM aggregation gateway with monthly subscriptions, payment in RMB, and no overseas credit card needed, and one subscription can switch between several capability groups. For tools like Claude Code and Codex, you only need to change the API address to its address; no Claude or ChatGPT account is required. To be clear, the service itself states that it is not an officially authorized channel, and some models are marked "overseas only"; see the models page for specifics. AGI Plan is a commercial partner of cdnping. Setup steps are at agiplan.dev/startup.
"Just change one address" works because many tools use a common API format. For the background, see What does OpenAI-compatible API mean.
What if an agent stalls or throws errors?
An agent makes many calls per task, so it is more sensitive to network stability, and a single failed request can interrupt the whole task. First check for known outages with the status pages for Claude Code or Codex, then use the online speed test to measure your first-connect time and round trip to each API. If the problem is API latency, see How to read latency to AI APIs from China.
Next step
Don't rush to buy credits. Pick a small project and have the agent do one small thing, such as adding tests to a function. Watch how many rounds it makes and how many tokens it uses, then choose a plan. If you need an estimation method, go back to the cost-estimation article above.