Chatbots and Agents

You already know how to call a model, label roles, and resend history so later questions can use earlier ones.

That multi-turn program has a name: a chatbot.


What a chatbot is

A chatbot is your program talking to a language model over many turns, using conversation history so the model can see what was said before.

Typical shape:

  1. Person types a question
  2. Your program sends history + the new question to the server
  3. Model reply comes back
  4. You show it — and keep both sides in history for next time
A chatbot is turns + history
  Person ──▶ Your program ──▶ Server / model
                │                  │
                │   reply text     │
                ◀──────────────────┘


           keep history
           for the next question

A chatbot is still text in, text out. It can remember the chat (because you resend it). It cannot open your files, hit your database, or click a button on its own.


What an agent is

An agent is a program that can chat and also act outside the chat text.

It does that by using tools (also called skills) — actions your program runs when the model asks — often more than once in a loop until the job is done.

Plain recipe:

Agent = model + tools (skills) + a loop you run in your program

Chatbot Agent
Main job Talk in text across turns Talk and act outside the text
Outside world Only what you paste into messages Files, APIs, systems you connect
Typical control One model call per user question May need several model calls for one user question

Same model can power either. The difference is what your program is willing to do around each reply.

When a chatbot is enough

  • Answer questions from the conversation
  • Draft email or code the person will paste themselves
  • Tutor or brainstorm in text only

When you want an agent

  • “Read this file and summarize it”
  • “Look up the order status, then reply”
  • “Check three sources, then give one answer”

If the useful step is outside the chat text, you need tools / skills — and usually a loop. Those each get their own chapter next, so they can be taught in full.


One picture to keep

Word Meaning
Chatbot Your program + model + history — text conversation
Agent Chat plus the ability to act outside the text (tools / skills, often in a loop)

See it in Code

The Code panel shows the chatbot half: a short history, then a new question. Same idea in Python, Java, Go, and TypeScript. Tools and the loop appear in the next chapters’ labs.

You can already build the chatbot half. Next: what a tool / skill really is.