build.unfiltered

Learn · 01

How AI agents work

From a model that guesses the next word to an agent that finds you jobs every morning. Eight stops, no code. Each stop has something to press.

  1. 01The brain
  2. 02Tokens
  3. 03Context window
  4. 04What is an AI agent
  5. 05Memory
  6. 06Tools
  7. 07Autonomy
  8. 08Workflow or agent
Bigger text, one stop per screen, arrow keys to move.

Stop 01 · The brain

An LLM guesses the next word

ChatGPT, Claude and Gemini are all large language models (LLMs). Each one has read a huge amount of text and learnt one skill: given some words, guess what comes next. Do that very fast, over and over, and you get whole answers.

A good CV should be

short41%
clear27%
honest18%
one9%

Illustration. The words and percentages are made up to show the idea. A real model scores tens of thousands of options at every step.

Remember. On its own, an LLM only writes text. It cannot open a file, search the web or send an email. And it sounds just as sure of itself when it is wrong.

Stop 02 · The units

It reads in tokens, not words

The model cuts text into small pieces called tokens. A token can be a whole word, part of a word, or a space plus a word. Everything is counted in tokens: what you pay, and how much the model can read at once.

Loading the tokeniser…
…tokens
41characters
8words

A real split, not a guess. The dot (·) marks a space that belongs to the token. A box marked ×2 holds two tokens that only make sense together. Try English, then Hindi: same meaning, roughly twice the tokens.

Remember. Rough rule for English: one token is about four characters, or three quarters of a word. Hindi and many other languages need more tokens for the same meaning, so they cost more.

Stop 03 · Working space

The context window is its desk

The model can only see what is on its desk right now: your messages, its replies, any files you gave it. The desk has a fixed size. When it is full, the oldest pages fall off, and the model simply cannot see them any more.

3 / 4 used
Hi, I'm Priya.
I'm a React developer with two years' experience.
I live in Bangalore.

Remember. A bigger desk remembers more of the chat. But everything on the desk is sent again with every message, so a bigger desk also means more tokens and more cost.

Stop 04 · Putting it together

What is an AI agent?

An LLM on its own can only talk. An AI agent is an LLM that can get things done: you give it a goal, and it works step by step, using tools and memory, until the job is finished.

You ask Find me 3 React jobs in Bangalore posted this week.

It replies

“I can't search job sites or see this week's listings. I only know what was in my training. Here are some tips: keep your profile updated, search for ‘React developer’ on job boards, and set up alerts.”

Helpful words, but the job is not done. It cannot look anything up or act.

An agent is four parts

Remember. Agent = LLM + memory + tools + autonomy. The LLM is the brain you have already met. The next three stops take the other parts one at a time.

Stop 05 · Remembering

Two kinds of memory

Short-term memory is the desk: this conversation only. Long-term memory is a filing cabinet: notes saved somewhere permanent, like a sheet or a database, that the agent can look up later, even in a brand new chat.

Short-term · the desk

You: find me React jobs
Agent: here are 3 jobs

Long-term · the filing cabinet

Résumé: React, 2 years, Bangalore

1/4 Monday. You chat with the agent and it finds you three jobs. All of this sits on the desk.

Company names are made up.

Remember. The model itself does not remember you. Memory is always something we build around it: what we put on the desk, and what we save and fetch later.

Stop 06 · The hands

Tools are its hands

A tool is an ability you hand the model: search jobs, read a file, save a row, send a message. You describe each tool in plain words. The model reads those descriptions and decides on its own which tool to use, and when.

Goal Find me up to 3 new jobs that fit my résumé.

The tools it was given

Read résuméReads the person's résumé: skills, years, city.
Search jobsSearches job listings for a title and a city.
Check saved jobsLooks up jobs already sent before, so none repeat.
Save jobSaves one job as a row in the tracking sheet.
  1. Press play to watch it work.

Illustration of a typical run. Steps 0/6.

Remember. Nobody wrote “if there are too few jobs, search again”. The model decided that from what came back. That loop (decide, use a tool, look at the result, repeat) is what makes it an agent.

Stop 07 · Who decides

Autonomy: who picks the next step?

Not every AI system should make its own decisions. Slide through the levels, using the same job search each time.

What it is
You give it a goal and some tools. It chooses the steps.
Our job search, at this level
Finds jobs that fit you, searches again if results are weak, skips ones you have seen.
Who decides the next step
The model, while it runs.
How predictable
Less predictable. Steps and cost change from run to run.

Remember. More autonomy means it can handle more, and you can predict less. Use the lowest level that does the job, and keep a human check before anything that cannot be undone.

Stop 08 · The test

Workflow or agent?

One question decides it: can you draw the flowchart before it runs? If yes, it is a workflow, and you should build it as one, because it is cheaper, faster and easier to fix. Use an agent only where the next step depends on what it finds.

Workflow · steps fixed in advance

Search “React developer”Save every resultEmail the list

Agent · steps chosen while running

Read résuméSearch “React developer”Check saved jobsSearch “Frontend engineer”Save 3 good onesEmail the list
WorkflowAgent
Who picks the next stepYou, when you build itThe model, while it runs
Number of stepsKnown in advanceDepends on what it finds
CostThe same every runChanges from run to run
When it breaksYou see which step failedYou read its trail of steps
Good forSort, summarise, send, move dataSearch, research, judge, fix

Illustration. Results are made up to show the difference.

Remember. Good systems mix the two: a workflow on the outside, and an agent only for the step that needs judgement.

Sources

  • Token splits on stop 02: gpt-tokenizer, using o200k_base, the tokeniser OpenAI uses for GPT-5 mini.
  • Everything marked “illustration” is made up to show an idea, not measured.