Preface
With the explosion of large AI models, prompt engineering was once the most important and most essential technique for users to apply AI and bring its capabilities into play. But now, building on “prompt engineering,” a broader and more powerful evolved concept has been proposed—the “Context Engineering” we are introducing in this article.
Especially this year, with the explosion of AI Agents, when applying AI it has become increasingly important to effectively pass the right information into AI’s “limited memory space.” Very often, poor results from calling an AI Agent are not due to any weakness of the large model itself, but rather to a deficiency in the quality of the context.

The Limitations of Prompt Engineering
Prompt engineering can improve a model’s output quality by optimizing the text fed into the model.
But as more and more Agents join in and application scenarios grow increasingly complex, relying on prompts alone makes it ever harder for large models to effectively complete increasingly complex tasks.
For example, to build an AI-powered intelligent test case system, the following information is also needed in the process of using the large model:
- The original requirements documents and interface (API) documentation
- The system’s architectural design, database, and system framework
- The status of the various application interfaces
- Invocations of external tools such as test case management, document management, and automated testing
These requirements can hardly be fulfilled merely by passing prompts to the large model and its corresponding Agent.
This is the greatest limitation of prompt engineering: the lack of context understanding and state management capabilities.
What Is Context Engineering?
To understand “context engineering,” we must first clarify what context is.
Compared with a prompt, context is not merely the single prompt we pass to the large model; it can be understood as everything the large model sees before it returns a result.
In summary, context includes the following:

Background / System Prompt (**Instructions / System Prompt)
This is the initial agreement between the user and the large model throughout the entire session. It includes the agreed background, the role the model plays, its expected behavior, and so on. It can be constrained through some examples and rule definitions.
For example, in the AI-based test case generation tool we introduced earlier, the system prompt might specify
| |
User Prompt
The user prompt, in contrast to the system prompt which applies to the entire session, is the instruction or question the user currently gives to the large model.
It is in fact the main application of prompt engineering mentioned earlier—by optimizing how user prompts are written, one can communicate more effectively with AI.
As in the example above, in the process of AI-assisted development, it is the specific development task we submit to AI.
| |
State and Conversation History (Short-Term Memory)
This mainly refers to the conversation history and the intermediate results generated during the current session.
For example, during script development, the completed code files, the errors that appear when the program runs, and other such information.
Long-Term Memory
This contains more durable background knowledge, including information collected from multiple previous conversations, such as learned user preferences, summaries of past projects, or information provided by the user for future use.
As in the development process above, this includes the project’s requirements documents, architectural design, database structure, test data, and other information.
RAG (Retrieval-augmented generation)
RAG provides the model with additional relevant information through vector databases, knowledge base retrieval, and other means. It enables the model to consult the latest, relevant context when answering questions, instead of relying on knowledge from its training.
Structured Output
To make model output more controllable and parseable, and easier for Agents to handle, we usually need to define an output format—such as a JSON Schema or a specific field structure—to improve result consistency.
For example, the system prompt above explicitly requires the model to output a JSON object containing the relevant fields.
Available Tools
Through Agents or MCP, the large model can invoke tool capabilities, such as automated testing tools (Playwright), CI/CD continuous integration systems, and so on.
The Keys to Using Context Engineering
✅ Context is not a string, but a system
Context is system logic that runs before the LLM call; it dynamically assembles all relevant information rather than being a static template.
✅ Context is dynamic
Before each LLM call, context must be dynamically prepared according to the current task—for example, injecting the current date, user preferences, project configuration, and so on.
✅ Context emphasizes the precise matching of information and tools
One cannot simply pile up information; instead, the most relevant knowledge and capabilities must be provided at the right time. For example, inject a database connection tool only when it is needed.
✅ Format determines output quality
How information is presented matters. A concise summary is better than raw data, and a clear tool schema is more useful than vague instructions.
Conclusion
The tech industry produces new terms and new concepts every so often, and we have grown used to it. Although “Context Engineering” differs from “prompt engineering” at the conceptual level, their starting point and goal are in fact the same—to enable more effective communication between users and AI. In essence, this is in line with the explanation in our earlier article【】.
It is not really a brand-new technology; we can simply understand it as a technique for using AI!