Skip to the workspace
Pebellslearn by building
The Agent Loop  ›  Lesson

What Are AI Agents?

What are AI Agents? 12 minAn AI agent is a language model running in a loop that chooses actions, usually tool calls, toward a goal and feeds each result back into its next decision.

ai agents / What Are AI Agents?

Explore each scene at your own pace.

01 · The rule

The rule

What Are AI Agents?

Ask a chatbot "Is there a sleeper train from Pune to Jaipur on Friday?" and it can only guess from what it learned in training. Ask Tripmate, and it searches today's timetable, reads the result, and answers from real data. The difference is not a smarter model. It is that Tripmate is an agent.

The rule

An agent is a model in a loop, choosing actions toward a goal.

Three parts make that sentence work:

  • A model — the language model that reads the situation and decides what to do next.
  • Actions — usually tools: functions the program lets the model request, such as search_trains or send_email. The model only asks for a tool; your code runs it and hands back the result.
  • A loop — the program keeps calling the model, running what it asks for, and feeding results back until the goal is met or a limit is hit.
goal → model decides → tool runs → result goes back → model decides → … → answer

A plain chatbot does one pass: text in, text out. A fixed script runs the same steps every time. An agent sits between them: the steps are chosen at run time by the model, based on what it has seen so far.

Agents show up wherever the path to an answer is not known in advance:

  • Personal assistants — reading a calendar, drafting emails, booking things.
  • Code generation — writing code, running tests, reading errors, fixing, repeating.
  • Data analysis — querying a database, charting the result, noticing an odd number, querying again.
  • Web research and scraping — searching, opening pages, following links, extracting facts.
  • Game characters — a non-player character that decides what to say and do from the game state.
Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.