Learn AI compute, then follow the market
← Back to Compute College

Compute College

What is context engineering?

How AI systems select and manage the information a model receives before making a decision.

Plain-English definition

Context engineering is deciding what information an AI model should receive, how it should be organized, and when it should be updated for a task. That context can include instructions, the user’s request, history, retrieved documents, database results, tools, examples, preferences, agent state, and summaries. Prompt engineering focuses on the instructions; context engineering covers the model’s whole working environment.

Memory trick: Prompt engineering writes the instructions. Context engineering prepares the model’s workbench.

Why it matters

An AI model can only make decisions using the information available in its current context. Missing context can make a model use the wrong definition, misinterpret internal terminology, overlook a policy, repeat completed work, select the wrong tool, or produce an answer unsupported by available evidence. Too much context creates the opposite problem: large amounts of irrelevant or outdated information consume tokens and can make important details harder to identify.

  • Context is what separates a correct answer from a confident one that ignores the governing policy or record.
  • Every additional token of context is processed on every request, so irrelevant material is a recurring charge, not a one-time one.
  • Effective context engineering aims for the smallest collection of high-value information needed for the current decision.

Simple example

Imagine an AI customer-service agent handling a refund request. It may need the customer’s order, the current refund policy, the delivery status, previous messages about that order, and the actions it is authorized to perform. It probably does not need every order placed by every customer, the company’s entire policy library, unrelated conversations, old versions of the refund policy, or tool outputs from previously completed tasks.

  • Context engineering decides which information should be retrieved for this decision.
  • It decides which source is authoritative when two documents disagree.
  • It decides what to exclude — superseded policy versions and finished work are the usual offenders.

Example figures are illustrative calculations, not current quoted market prices.

Current example

Primary reference on context engineering

Anthropic’s engineering guidance frames context engineering as broader than prompt writing: curating and maintaining the full set of tokens and information available to the model, including system instructions, tools, external data, message history, and agent state. Treat it as a terminology and practice reference rather than a measurement of any particular workload.

Anthropic: effective context engineering for AI agents

Official engineering guidance on curating and maintaining an agent’s full context, not just its prompt.

Context window explained

The Compute College lesson on the limited budget every piece of context competes for.

What is an agent benchmark?

How multi-step agent tasks turn context decisions into repeated inference demand.

Source discipline: caching, long-context pricing, and retrieval behaviour differ by provider and are not implemented identically. Check the provider’s current documentation before assuming a cost effect.

Common mistake

Context stuffing sends every potentially relevant document to the model and expects it to determine what matters. This mixes current with outdated information, instructions with untrusted content, authoritative with unofficial sources, and completed with unfinished work. Letting conversation history grow forever causes a similar problem: old messages and tool outputs go stale while still consuming tokens on every new step.

Practical takeaway

What you can do with this

Build context in layers — stable instructions, the current task, authoritative knowledge, runtime state, tool results, and durable memory — and use retrieval to select relevant information rather than loading everything.

  • Separate instructions from reference material so quoted documents are not mistaken for system rules.
  • Summarize or remove stale history, preserving important decisions, assumptions, sources, and unresolved work.
  • Measure context tokens per task, retrieval relevance, cache-hit rate, tool calls per task, repeated actions, accuracy, latency, and cost per completed task.

Decision check: good context contains everything necessary for the next decision — and as little unrelated information as possible.

Side by side

Prompt engineering versus context engineering

Prompt engineering remains part of context engineering. A well-written prompt cannot compensate for missing evidence, and excellent source material cannot compensate for unclear instructions.

How the two practices differ in scope and in what they operate on
Prompt engineeringContext engineering
Designs the instructionsDesigns the complete information environment
Often focuses on one requestOften operates across many steps
Specifies the task and outputSelects instructions, data, history, tools, and state
Primarily edits wording and structureRetrieves, adds, summarizes, caches, and removes information
Important for chats and single callsEssential for agents and long-running workflows

Compute College track

Prompt & Context Engineering

Step 9 of 18: What is context engineering