---
type: Explainer
title: "How a language model answers"
description: "A language model continues the text it is sent, one piece at a time; it sees nothing but that text, keeps nothing afterwards, and may answer the same question differently twice."
tags: [explainer, ai-agents, verification, p4]
status: draft
generated: { by: "claude-code/mythos-5.2", at: "2026-12-03T00:00:00Z" }
stale_after: "2027-06-03T00:00:00Z"
sources:
  - id: course
    resource: "https://github.com/UA-AI2S/AI-Automation-and-Agents-v2/wiki/Module-3:-Foundational-Concepts"
    title: "AI Automation and Agents v2, Module 3: Foundational Concepts (read 2026-11-30)"
    author: "team:ua-ai2s"
  - id: api
    resource: "https://platform.openai.com/docs/api-reference/chat"
    title: "Chat completions (OpenAI API reference)"
    author: "team:openai"
  - id: docs-agents
    resource: "https://idss-mesa.github.io/docs/apps/agents/"
    title: "AI agents in the MESA apps"
    author: "team:idss-mesa"
---

# How a language model answers

!!! warning "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](https://github.com/idss-mesa/trainings/issues).

## 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 tokens[^api]. | 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 size[^course]. | 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 it[^course]. 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 draw[^api]. | 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 yourself[^docs-agents].
Three things you can see there:

- `opencode run` names the model on its first line, such as `js2/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](https://idss-mesa.github.io/trainings/tutorials/call-a-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](https://idss-mesa.github.io/trainings/tutorials/treat-what-an-agent-reads-as-data/).

## 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](https://idss-mesa.github.io/trainings/explainers/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?

??? success "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

- [Recalled or retrieved](https://idss-mesa.github.io/trainings/explainers/recalled-or-retrieved/)
- [Ask an agent three questions to learn its limits](https://idss-mesa.github.io/trainings/tutorials/ask-an-agent-three-questions/)

*Drafted with [AI assistance](https://idss-mesa.github.io/trainings/about/ai-disclosure/) 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](https://github.com/UA-AI2S/AI-Automation-and-Agents-v2/wiki/Module-3:-Foundational-Concepts), University of Arizona AI2S (CC0 1.0), Module 3; the wording and the example are MESA's own.*

[^course]: https://idss-mesa.github.io/trainings/explainers/AI Automation and Agents v2, Module 3: Foundational Concepts, <https://github.com/UA-AI2S/AI-Automation-and-Agents-v2/wiki/Module-3:-Foundational-Concepts>.
[^api]: https://idss-mesa.github.io/trainings/explainers/Chat completions, OpenAI API reference, <https://platform.openai.com/docs/api-reference/chat>.
[^docs-agents]: https://idss-mesa.github.io/trainings/explainers/AI agents in the MESA apps, <https://idss-mesa.github.io/docs/apps/agents/>.
