We use analytics to count visits and form use. It is on unless you reject it. We show no ads on this site.

Glossary

Context engineering

Published . Last updated . Published by Zapple.Tech, founded by the founders of CodeceptJS and Codeception, open-source testing frameworks.

Also called
AI context engineering, context management for AI agents
Published
Updated
Related service
AI QA adoption
Definition

Context engineering is deciding what an AI model sees when it answers: instructions, message history, tools, retrieved documents and memory. LangChain's documentation defines it as providing the right information and tools in the right format so the model can finish a task. The context is an artefact you can test, review and version.

What is context engineering?

LangChain’s documentation on context engineering defines it as “providing the right information and tools in the right format so the LLM can accomplish a task”. In plain terms: you decide what the model sees, because the model answers from what it is given.

That includes more than the instruction. LangChain splits it into model context (instructions, message history, tools and response format), tool context (what tools can read and write) and life-cycle context (what happens between calls, such as summarizing a long history). The decision it helps with is where to spend effort when an AI feature gives wrong answers: on a better model, or on what the model is handed.

How is it different from prompt engineering?

Prompt engineering tunes the wording of an instruction. Context engineering is wider: the instruction is one input among several, and the others can change between calls. A perfect prompt cannot make up for a missing document, a stale instruction file or a tool result that came back empty.

It also overlaps with two checks we cover elsewhere. Scoring whether retrieved documents were right is RAG evaluation, and checking that an answer stays inside its sources is groundedness. Context engineering is the step before both: choosing what goes in.

What sources make up the context, and what fails in each?

Context source What fails when it is wrong or stale The check that catches it
System instructions The agent follows an old rule or two rules that conflict Review the file on every change; run a fixed set of cases after it
Repository rules file A coding agent uses the wrong build command or house style A change to the file goes through code review
Retrieved documents The answer cites a page that is out of date A groundedness and retrieval score on a labelled set
Tool results An empty or truncated result is treated as “no data” Cases where each tool returns an error, nothing or too much
Conversation history Early details are lost or contradicted late in a long session A long-session case that checks an early fact
Memory An old preference or correction is applied where it no longer fits Review what memory holds; clear it between test runs

Instructions, tools, message history and memory are named in the LangChain and Claude Code documentation; retrieved documents are our addition. The failure and check columns are our reading, not those vendors’ statements.

Context engineering: what the model sees is built from system instructions, a repository rules file, retrieved documents, tool results, conversation history and memory, and each can fail; when an answer is wrong, first ask whether a person given only that input could answer

When output is wrong, is it the model, the prompt or the context?

LangChain says LLMs fail for one of two reasons, either the model is not capable enough or the “right” context was not passed, and that “more often than not” the second is what makes agents unreliable. That is a vendor’s claim, not a measured rate. Our rule of thumb for a single bad answer:

  1. Log exactly what the model received for that case.
  2. Ask whether a person given only that input could answer correctly.
  3. If not, add the missing fact and rerun. A correct answer now means a context fault.
  4. If the answer is still wrong with complete context, look at the prompt, then at the model.

This tells you whether to spend on prompt work, retrieval work or a model change. Our AI QA adoption service covers tool choice, a measured pilot, written working rules and training.

Who should own the context files your coding and testing agents read?

Give each file one named owner and review changes like code. Anthropic’s documentation says Claude “treats CLAUDE.md files and auto memory as context” and that they “aren’t enforced configuration”, so a rule written there is a request, not a guarantee. The same page describes a prompt audit that looks for outdated instructions, references to files that do not exist, and files that contradict each other.

Formats differ across tools. AGENTS.md describes itself as “a README for agents”. GitHub’s documentation on repository instructions says that when Copilot is working, the nearest AGENTS.md file in the directory tree takes precedence. Our judgment: if two files can disagree, someone must own the tie-break, and a test should show which one the agent followed. The agentic test case standard we published shows one way to write such cases. For agents that write or change code, read the AI code review checklist next, and for agents in general, how to test AI agents. Where a model grades another model’s output, see LLM-as-a-judge.

What does context engineering not solve?

Better context raises the odds of a right answer; it does not check the answer. Output still needs tests, review and an evaluation set. More context is also not better by default: Anthropic’s context windows documentation says that as token count grows “accuracy and recall degrade”, a phenomenon it calls context rot. A fuller window can make results worse. In our view context also drifts, because files and documents change, so a check that passed last month proves little today.

What does Zapple.Tech do about it?

If you are not sure what your AI features are given when they answer, start with the evidence. Zapple.Tech starts with a one-week QA audit of one product area. It looks at its tests, pipeline and release process, and ends in a written report on what is at risk and what to fix first, plus a pilot plan you can run with Zapple.Tech or without it. Read more on the QA audit and assessment page.

Tell us about your AI feature in the form below.

  • RAG evaluation

    RAG evaluation measures a retrieval-augmented generation system in two parts: whether the search step returned the right passages, and whether the answer built from them is supported and useful. Scoring the two separately tells you which one to fix. You need a labelled question set before any score means something.

  • Groundedness

    Groundedness tells you whether an AI answer is supported by the source material the model was given, such as retrieved documents or a tool result. A grounded answer adds nothing the sources do not say. It does not tell you whether the sources are right, so you still need a check on correctness.

  • LLM evaluation

    LLM evaluation is the practice of measuring how a language-model feature or agent behaves on a defined set of tasks, using written success criteria and scores. It does not by itself show the feature is correct. Our AI agent testing builds a task set, a measured baseline and a suite that scores each model, prompt or tool change.

  • Model Context Protocol

    The Model Context Protocol (MCP) is an open standard for connecting AI applications to external tools and data. An AI application, the host, opens one client connection per MCP server, and each server offers tools, resources or prompts. MCP standardizes the connection, not what the agent does with it, so every server still needs its own tests.

  • Spec-driven development

    Spec-driven development is a way of building software in which a written specification, not the code, is the main artifact. You write the spec first, then an AI coding tool generates a plan, code and tests from it. In our view the spec needs a reviewer, and the code needs tests that do not come from the same spec.

All terms in the glossary

Adopt AI

AI QA adoption

Help your QA team adopt AI in testing. Tool choice on your own code, a measured pilot, written working rules and training. One-week assessment first.

See the service

Questions about context engineering

What is context engineering?

Context engineering is choosing and shaping what an AI model sees before it answers: instructions, message history, tools, retrieved documents and memory. LangChain's documentation defines it as providing the right information and tools in the right format so the model can accomplish a task.

What is the difference between context engineering and prompt engineering?

Prompt engineering is about the wording of an instruction. Context engineering covers everything the model receives, of which the instruction is one part. In LangChain's description, model context holds instructions, message history, tools and the response format.

Why does context engineering matter for AI coding agents?

A coding agent works from what it is given: the files it reads, the tool results it gets and the instruction files in the repository. AGENTS.md describes itself as a README for agents. If those files are wrong or out of date, the agent's output follows them.

How do you test whether an agent has the right context?

Log what the model received for a failed case, then check it against what a person would need to answer. Rerun the case with the missing fact added. If the answer is now right, the fault was in the context, not the model.

Request a QA audit quote

Tell us what you ship and what worries you.

What happens after you send this

  1. You send the form: your situation and what you need tested, then your name and work email.
  2. Within one business day, we reply with a suggested first step, its scope, timeline and a quote.
  • Fixed scope
  • You decide after each step
  • The tests live in your repository
  • An NDA signed before access

“They helped us to close the positions and consult our team how to proceed further. High-quality quick feedbacks with the deep checking of the required tasks, professional approach, great understanding of the company's technologies and product, detailed reports.”

Kristina Lavrentieva, Manager at keepgo.com, Israel
  • Rated 4.9 out of 5 on Clutch, from 7 client reviews
  • 42 completed test automation and infrastructure projects
  • Founded by the founders of CodeceptJS and Codeception, open-source testing frameworks

Request a QA audit quote

    What is closest to your situation?
    Optional. The product, the platforms, how often you release, what broke last.

    You decide after our reply whether to go ahead.

    Prefer to talk first? Book a call

    One-week QA audit · written report

    Request a QA audit quote