ladderlore
  • Type a service name, like S3 or IAM.

Concept

Context engineering

Choosing what goes into the model's context so it can give better answers.

Context
Instructions
Retrieved data
Conversation history
Tool results
Model
Response
  1. 1Instructions are chosen.
  2. 2Retrieved data is added.
  3. 3Relevant history is kept.
  4. 4Tool results are added.
  5. 5The model answers using that context.
Four sources fill the context that the model sees with each request.

Step by step

  1. 1Instructions are chosen.
  2. 2Retrieved data is added.
  3. 3Relevant history is kept.
  4. 4Tool results are added.
  5. 5The model answers using that context.

Four sources fill the context that the model sees with each request.

  • Scope

    Prompt engineering
    One prompt
    Context engineering
    Everything the model sees
  • Focus

    Prompt engineering
    Wording and examples
    Context engineering
    What to include and when
  • Example

    Prompt engineering
    Add a few examples to the prompt
    Context engineering
    Fetch the right policy page and trim old turns
Context engineering is the wider job. Prompt engineering is one part.

What it is

A model only knows what it learned in training and what is in its context for this request. Context engineering is the work of deciding what goes into that context: instructions, data fetched from your own sources, the conversation so far and the tools the model may call. The goal is the right information, in the right amount, at the right time.

What it is

It grows out of prompt engineering. Prompt engineering is about how you word the request. Context engineering looks wider. It builds the whole package around the request. This matters most for agents and long conversations, where the context fills up and has to be managed: keep what helps, trim or summarize what does not.

Because the context window is limited and tokens cost money, more is not better. Irrelevant text can confuse the model and raises the bill. Good context is relevant, short and current.

Remember

  • Context = instructions + retrieved data + conversation history + tool results.
  • Context engineering decides what to include, what to leave out and when.
  • It builds on prompt engineering and goes beyond the wording of one prompt.
  • Retrieved data (RAG) is one source of context.

Remember

  • Too much context costs more and can lower answer quality.

On the exam

  • “Decide what information, history and tools the model sees” points to context engineering.
  • “Improve answers by giving the model your company data at request time” points to adding retrieved context.
  • “Wording and examples inside a prompt” points to prompt engineering.