Author: 🌲Shu Yang@kaust

Last edit: October 15, 2025

Thanks for comments: …


Introduction

The key objective of AI systems,whether large language models (LLMs), multimodal models (MLLMs), or multi-agent system, is to ensure that these systems Maximizing helpfulness and freedom for builders, developers, and users, Minimizing harm, Choosing sensible defaults [3]. As AI systems grow increasingly complex, the external information they must process from diverse environments, roles, and instructions, also becomes more intricate and even conflict with each other. This raises two fundamental questions:

To further investigate and optimize these challenges, two emerging concepts have been proposed: Context Engineering and Chain of Command. In this blog, I will introduce their definitions and explain how they differ from existing related concepts we have in the field.

Context Engineering

<aside> ✨

Agents need context to perform tasks. Context engineering is the art and science of filling the context window with just the right information at each step of an agent’s trajectory. [1]

It refers to the set of strategies for curating and maintaining the optimal set of tokens (information) during LLM inference, including all the other information that may land there outside of the prompts. [2]

</aside>

The difference between prompt engineering and context engineering

Prompt engineering: Methods for writing and organizing LLM instructions for optimal outcomes

The primary focus of prompt engineering is how to write effective prompts, particularly system prompts.

Context engineering: —> However, as we move towards engineering more capable agents that operate over multiple turns of inference and longer time horizons,  we need strategies for managing the entire context state (system instructions, tools, Model Context Protocol (MCP), external data, message history, etc).

image.png

Image source: [2]

Image source: [2]

Why we need context engineering?

LLMs have limited context window and “attention budget” ( check needle-in-a-haystack test) when they trying to progress long informations in their context window.