Skip to lesson

AnthropicClaude Certified Architect – Foundations2026-100 Prerequisites

Budget context before requesting an answer

Completed by the knowledge check

Learning objective

Explain foundation-model behavior, token budgets, and context-window limitations.

Core idea

Claude is a trained model operating on a bounded request, not an unlimited knowledge store. Its training gives it general capabilities; the request supplies the instructions and evidence for this answer. Training does not make every generated claim correct: Anthropic documents hallucinations, output that is factually wrong or inconsistent with the supplied context.

The context window is working capacity for one inference. Anthropic defines it as all the text the model can reference while generating a response, including the response itself, and distinguishes it from the training corpus. Your design answers two separate questions: does the request fit, and does it contain the evidence needed to answer? A prompt can fit comfortably and still omit the deciding fact.

How it works

Count the complete input

Tokens are the units of input and output accounting. They are not words, characters or pages, so count against the model you intend to call. POST /v1/messages/count_tokens (in Python, client.messages.count_tokens) takes the intended model, system, messages and tools and returns input_tokens, an estimate that can differ slightly from the actual request. Count the whole request: policy text, prior turns, tool definitions, retrieved records and attachments all share the window.

Reserve output capacity

max_tokens on a Messages request caps generated tokens. It does not set the input allowance, and it does not force the answer to be that long. Plan so that estimated input plus the output allowance fits inside the model’s context window, with margin. With thinking enabled, thinking tokens count toward max_tokens and toward the context window too.

What happens at overflow

  • Input alone exceeds the window: every model returns HTTP 400 invalid_request_error (“prompt is too long”).
  • Input plus max_tokens exceeds the window, on Claude 4.5 models and newer: the request is accepted; if generation reaches the limit it stops with stop_reason: "model_context_window_exceeded". Treat that response as truncated. Earlier models return a validation error instead.

Read the response’s usage to see what a call actually consumed.

Capacity is not attention

Anthropic describes context rot: accuracy and recall can degrade as the token count grows. Curate evidence rather than filling the window. Trimming tool results is taught in 5.1.4, laying out long inputs so synthesis finds them in 5.1.5, and compaction with /compact in 5.4.3.

Prompt caching also exists: cache_control lets the API resume from a cached prompt prefix, which reduces processing time and cost for repeated prompts. Cached input still occupies the context window.

Key distinctions and trade-offs

ConcernWhat answers it
Does the input fit?input_tokens from token counting, against the target model
Is there room to answer?max_tokens, inside the context window
Is the answer correct?Grounding and validation, not window size

Architecture / decision scenario

A support agent must explain whether a purchase qualifies for a refund. The team proposes sending the whole account archive because the model’s window is large. You send the applicable policy passage, the transaction date and the relevant customer statements instead, count the assembled request with client.messages.count_tokens including its tool definition, and set max_tokens for the explanation the contract requires. If the estimate leaves too little room, you drop unrelated archive material before any decision evidence. After the call, you check usage and reject an answer that does not rest on the supplied date, however confident it sounds.

Common exam traps

  • Treating the context window as training data or durable memory.
  • Counting only the user’s text and ignoring tools, attachments and prior turns.
  • Reading max_tokens as an input limit or a required answer length.
  • Assuming input plus max_tokens beyond the window is always rejected before generation.
  • Equating a larger window with uniformly better recall.

What to remember

Supply the evidence the task needs, count the complete request for the selected model, and reserve room for generation. Capacity, output allowance and factual reliability are separate concerns: measure the first two with input_tokens, max_tokens and usage, and verify the third against evidence.

Knowledge check

References