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_tokensexceeds the window, on Claude 4.5 models and newer: the request is accepted; if generation reaches the limit it stops withstop_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
| Concern | What 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_tokensas an input limit or a required answer length. - Assuming input plus
max_tokensbeyond 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
A refund agent runs on a Claude model of the 4.5 generation or newer. Its input fits the context window, but input plus max_tokens exceeds the window by 20,000 tokens. What happens when the request is sent?
max_tokens to fit and completes the answermax_tokens exceeds the window; if generation reaches the limit, it stops with stop_reason: "model_context_window_exceeded" , and the answer must be treated as truncated. The up-front validation error is how earlier models behave. A 400 “prompt is too long” comes only when the input alone exceeds the window.Before each call, the agent must confirm that the assembled request fits the context window of the model it is about to call. The request carries a system prompt, prior turns, a tool definition and a cached policy prefix. What should it pass to token counting?
Long requests from a support agent fail with HTTP 400 “prompt is too long”. The requests include a customer’s whole account archive alongside the policy passage and transaction date that decide the answer. Which change can resolve the failure?
max_tokens so the request has more room for inputcache_controlmax_tokens caps output, not input. Resending the same oversized request fails the same way, and cached input still counts toward the window.A support agent answers with a confident but wrong refund date. The request held the customer’s full account archive, well inside the model’s context window. You must make answers rest on the right evidence. Which change addresses the problem?
max_tokens so the explanation has room for more detailReferences
- Anthropic, Context windows
- Anthropic, Token counting
- Anthropic, Messages
- Anthropic, Prompt caching
- Anthropic, Reduce hallucinations