Context engineering: what your AI sees decides the answer

A diagram of an AI context window that combines system instructions, reference material, tool results, conversation history and the latest request

You may have written a good prompt and still got a wrong answer, because the prompt is only part of the problem. The bigger question is everything the AI can see at that moment. Context engineering means deciding what should go into the AI's context and what should stay out.

Think of a new employee handed a tall stack of documents on their first day. If most of it has nothing to do with the task, they may struggle to find the answer they need. AI works in much the same way.


The prompt is only one part of the context

An AI works from everything in its context window at that moment. That usually includes several parts.

✅ System instructions set the role and the working rules.

✅ Reference material such as documents or data related to the task.

✅ Tool results such as search results or data pulled from other systems.

✅ Conversation history covering what was discussed earlier.

The context window has a limited size. The more unrelated material you add, the greater the risk that the AI loses the thread or picks up the wrong piece of information.

Three things to manage

  1. Choose what goes in. Include only the information the task really needs.
  2. Order and format it. Put the important rules where they are easy to see, and separate sections so they are easy to read.
  3. Remove old material. Summarise a long conversation history rather than keeping every message.

How to start adjusting context

  1. Write the task as one clear question. If the task has several parts, split it into steps.
  2. Name the sources you need. Do not send a whole document set if only part of it is used.
  3. Test whether the answer changes when you remove one piece of information. If it does not change, that piece may not be needed.
  4. Keep a record of what the AI saw on each run, so you can check it when an answer goes wrong.

See how an AI agent manages context across several steps →

Things to watch

⚠️ Adding everything. More information does not always produce a better answer.

⚠️ Outdated information. The AI may hold on to old data still sitting in its context, even when newer data exists.

⚠️ Giving access beyond what is needed. Sensitive data that enters the context may appear in an answer without anyone intending it.

Frequently asked questions

Prompt engineering focuses on writing clear instructions. Context engineering looks at everything the AI sees, from instructions and reference material to conversation history.


Continue reading: What is an AI agent, and where should an organisation start? · When AI acts on its own, where should people stay in the process?

💬 Have you received a wrong AI answer even though the prompt looked fine? Share your experience in the comments.

Start with the problem

Tell us what you are trying to make work.

Let’s talk