Academy

From LLMs to agents: the complete journey

A language model, at heart, just guesses the next word. Here's how that simple guess becomes an agent once you add tools, memory, and planning — and where you actually need one.

The Felesh team 6 min

A simple next-word predictor

At the core of every large language model sits a deceptively simple mechanism: given the text so far, predict what comes next. The model reads text token by token, predicts a single token, appends it to the sequence, and starts over. That is it. It functions as a highly scaled autocomplete.

This simple job carries a surprising consequence. To correctly complete the sentence “If we heat water to 100 degrees…”, the model must implicitly know that water boils. Because it has processed millions of similar sentences across multiple domains, the objective of predicting the next word forces it to absorb broad knowledge about the world.

The next-word loop on one sentenceThe text so far, “If we heat water to 100 degrees”, is read by the model, which scores candidates for the next token: boils 0.91, Celsius 0.05, and 0.02. The winner, boils, is appended after degrees, and the longer text goes back into the model.the text so farIfweheatwaterto100degrees?modelreads all of itnext token, scoredboilsCelsiusand0.910.050.02boilsappended, then the whole text is read again
The model scores every candidate for the next token, appends the winner, and reads the longer text again.

How it is trained

Training happens in three stages. First, pre-training: the model processes an enormous volume of text — books, web pages, encyclopaedias, and code — and, without direct supervision, absorbs language structures, general knowledge, and patterns of reasoning. Second, supervised tuning: using thousands of high-quality question-and-answer pairs, the model learns to respond to instructions rather than aimlessly continue the text. Third, learning from human feedback: human reviewers rank various outputs, teaching the model what constitutes a useful and aligned answer.

At large scales, abilities often emerge that were never explicitly taught — such as learning from a few examples in context, or reasoning step by step. This phenomenon is known as emergence.

One message, three training stagesThree rows, one per stage, each showing what the model learns from and how it replies to the same message, how do I reset my password. After pre-training on books, web pages and code it only continues the text with another question. After supervised tuning on question and answer pairs it answers with open Settings, then Reset password. After human feedback, where reviewers rank reply A, steps plus a reset link, above reply B, steps only, it prefers the style of A.the ask“How do I reset my password?”stagewhat it learns fromreply to the same ask1 pre-trainingbooks, web pages, codeno labels, only textlearns language and facts2 supervisedtuningthousands of Q-A pairsQ: how do I reset it?A: Settings, then Reset3 humanfeedbackreviewers rank repliesA steps + reset link #1B steps only #2continues the text:“…how do I log out?”answers it:“Open Settings, thenReset password.”“Open Settings, thenReset password; thereset link is sent.”
Each stage teaches what the one before could not: language, answering a question, and which answer people prefer.

Six things a language model alone doesn’t do well

Despite its capabilities, a bare language model has six structural limits. One, hallucination: it sometimes confidently states plausible but false information — like a student making a firm guess instead of admitting ignorance. Two, a knowledge cutoff: the model’s training data ends at a fixed date, functioning like an encyclopaedia printed in a specific year. Three, an inability to act: the model only produces text; it sends no email and saves no file — a brain with no hands. Four, poor arithmetic precision: it approximates numbers rather than strictly computing them. Five, no long-term memory: every conversation initiates from a blank slate. Six, prompt sensitivity: a minor variation in phrasing can drastically alter the output.

Six limits of a bare model, each with a request that exposes itA table of six limits, the request that exposes each and what a bare model does. Hallucination: asked to cite its source, it invents “Smith, 2019”. Knowledge cutoff: asked for news this week, it knows nothing after cutoff. No action: asked to email you the summary, it writes the email and never sends it. Arithmetic: asked 1,284 times 37, it says 47,408 when the answer is 47,508. No memory: asked to use the size you gave, it starts from zero. Prompt sensitivity: “Opening hours?” gets 9 to 5, “When are you open?” gets not sure.limityou askthe bare modelhallucination“Cite your source”invents “Smith, 2019”knowledge cutoff“Any news this week?”nothing after cutoffno action“Email me this”writes, never sendsarithmetic“1,284 × 37 = ?”47,408; truth 47,508no memory“Use my usual size”starts from zeropromptsensitivity“Opening hours?”“When are you open?”“9 to 5”“not sure”
A bare model fails in six structural ways, from an invented source to a different answer when the question is reworded.

From model to agent

This is where the concept of an agent becomes relevant. An agent situates the language model inside a broader system. The architecture follows a straightforward formula: an agent equals a language model, plus tools, memory, and planning. A model alone acts as an advisor generating text; an agent acts as an operator that takes a goal, formulates steps, executes them, and corrects course when an action fails.

An agent corrects course after a failed stepThe goal is to book Sara a morning slot. The agent is a language model plus tools, memory and planning. Step one checks the calendar and finds 10:30 free. Step two books 10:30 and fails because the slot was just taken. The plan is revised, and step three books 11:00 instead, which is done. A failed step changes the plan, not the goal.goalbook Sara a morning slotagent = language model + tools + memory + planninglanguage modeltools: calendarmemory: Saraplan: 3 stepsplan: revised1 check the calendar2 book 10:303 book 11:00 instead10:30 is freefails: slot just takendonea failed step changes the plan, not the goal
An agent takes a goal, plans steps, runs them with tools, and when a step fails it changes the plan, not the goal.

However, not every problem requires a full agent. A practical rule of thumb applies: a large share of tasks can be solved with a well-crafted prompt and basic information retrieval. Another portion requires a deterministic chain of tools. Only a small fraction genuinely requires a fully autonomous agent capable of complex planning. Add complexity only when the task demands it.

Add complexity only when the task needs itThree rungs, each with an example task and its share of tasks. Prompt and retrieval answers opening hours from the FAQ page, and covers most tasks. A chain of tools looks up the booking and then emails it in a fixed order, and covers some. A full agent plans its own steps to find out why a booking moved, and covers few. Start at the top and step down only when the task forces you.example taskshare of tasksprompt + retrieval“Opening hours?” → read the FAQ pagechain of toolslook up booking, then email: fixedfull agent“Why did my booking move?” → own planmost taskssomefewstart at the top; step down only when the task forces you
Most tasks stop at the first rung; step down to a chain of tools or a full agent only when the task forces you.