How a language model answers¶
Draft: not yet reviewed
This explainer was drafted with an AI assistant. Nobody has yet read it against its sources. Tell us what you find.
The idea in one sentence¶
A language model continues the text it is sent, one piece at a time: it sees nothing but that text, and it keeps nothing afterwards.
Why it matters for your result¶
A model writes what is likely to come next, which is not the same as what is true. It writes a wrong figure in the same voice as a right one. Knowing what the model had in front of it tells you which of its answers could be right at all.
How it works¶
| Term | What it means | What follows for you |
|---|---|---|
| Token | A piece of text, often a word or part of one. The model reads and writes in tokens2. | Limits and costs are counted in tokens, not words. |
| Context window | All the text the model has for one answer: instructions, your question, and anything a tool returned. It has a fixed size1. | What is not in the window does not exist for the model. A long session can push early text out. |
| One call at a time | Each call sees only the messages sent with it1. A chat seems to remember because the program sends the earlier turns again. | A new session starts with nothing. |
| Sampling | Each next token is drawn from the likely ones, with some chance in the draw2. | The same question can get different answers. |
| Training | What the model knows of the world was fixed when it was trained. | It knows nothing recent, and nothing of your files, unless that text is put in the window. |
What it looks like in MESA¶
The agents in the MESA apps send your question to a model you connect yourself3. Three things you can see there:
opencode runnames the model on its first line, such asjs2/gpt-oss-120b.- A reply from the model's API counts the tokens that went in and came out. See Send one question to a language model through its API.
- On 2026-12-03 the same question, asked twice of the same model in the same folder, led once to a web search and once to a file being written. See Treat what an agent reads as data, not instructions.
A common mistake¶
Asking the model how it got an answer and taking the reply as a record. The reply is more likely text. The record is the list of calls: see Reading what an agent did.
Check your understanding¶
On Monday an agent totals G03's rainfall for you. On Tuesday you start the app again and ask, "Is that total still right?" What does the model have to go on?
Answer
Only Tuesday's sentence. Monday's question and answer were in Monday's context window, and a new session starts empty. The model does not know which total you mean. Give it the figure and the file, or ask for the total again.
Next¶
Drafted with AI assistance on 2026-12-03. No person has yet reviewed this page. The rows on the context window and on one call at a time are adapted from AI Automation and Agents v2, University of Arizona AI2S (CC0 1.0), Module 3; the wording and the example are MESA's own.
-
AI Automation and Agents v2, Module 3: Foundational Concepts, https://github.com/UA-AI2S/AI-Automation-and-Agents-v2/wiki/Module-3:-Foundational-Concepts. ↩↩
-
Chat completions, OpenAI API reference, https://platform.openai.com/docs/api-reference/chat. ↩↩
-
AI agents in the MESA apps, https://idss-mesa.github.io/docs/apps/agents/. ↩
Machine-readable versions of this page: Markdown twin · raw source on GitHub · llms.txt · llms-full.txt (whole site). See For AI agents.