Tools, memory, formats, six context types (including tool results)—through the full agent context stack.
Smart tool access: If your AI needs external information or actions, give it the right tools. Format the outputs so they're maximally digestible. Memory management:
● Short-term: Summarize long conversations
● Long-term: Remember user preferences across sessions
Format optimization: A short, descriptive error message beats a massive JSON blob every time. The bottom line is… Context engineering is becoming the new core skill since it addresses the real bottleneck, which is not model capability, but setting up an architecture of information. As models get better, context quality becomes the limiting factor. Context Engineering for Agents Simply put, context engineering is the art and science of delivering the right information, in the right format, at the right time, to your LLM.
To understand context engineering, it's essential to first understand the meaning of context. Agents today have evolved into much more than just chatbots. The six types of contexts an agent needs to function properly are:
● Instructions
● Examples
● Knowledge
● Memory
● Tools
● Guardrails
This tells you that it's not enough to simply "prompt" the agents. You must engineer the input (context). Think of it this way:
● If LLM is a CPU.
● Then the context window is the RAM.
You're essentially programming the "RAM" with the perfect instructions for your AI. How do we do it? Context engineering can be broken down into 4 fundamental stages:
● Writing Context
● Selecting Context
● Compressing Context
● Isolating Context
Let's understand each, one-by-one...
1) Writing context
Writing context means saving it outside the context window to help an agent perform a task.
You can do so by writing it to:
● Long-term memory (persists across sessions)
● Short-term memory (persists within a session)
● A state object
2) Read context
Reading context means pulling it into the context window to help an agent perform a task.
Now this context can be pulled from:
● A tool
● Memory
● Knowledge base (docs, vector DB)
3) Compressing context
Compressing context means keeping only the tokens needed for a task.
The retrieved context may contain duplicate or redundant information (multi-turn tool calls), leading to extra tokens & increased cost. Context summarization helps here.
4) Isolating context
Isolating context involves splitting it up to help an agent perform a task.
Some popular ways to do so are:
● Using multiple agents (or sub-agents), each with its own context
● Using a sandbox environment for code storage and execution
● And using a state object
So essentially, when you are building a context engineering workflow, you are engineering a “context” pipeline so that the LLM gets to see the right information, in the right format, at the right time. This is exactly how context engineering works!
6 Types of Contexts for AI Agents A poor LLM can possibly work with an appropriate context, but a SOTA LLM can never make up for an incomplete context. That is why production-grade LLM apps don’t just need instructions but rather structure, which is the full ecosystem of context that defines their reasoning, memory, and decision loops. And all advanced agent architectures now treat context as a multi-dimensional design layer, not a line in a prompt. Here’s the mental model to use when you think about the types of contexts for Agents:
1) Instructions
This defines the who, why, and how:
● Who’s the agent? (PM, researcher, coding assistant)
● Why is it acting? (goal, motivation, outcome)
● How should it behave? (steps, tone, format, constraints)
2) Examples
This shows what good and bad look like:
● This includes behavioral demos, structured examples, or even anti-patterns.
● Models learn patterns much better than plain rules
3) Knowledge
This is where you feed it domain knowledge.
● From business processes and APIs to data models and workflows
● This bridges the gap between text prediction and decision-making
4) Memory
You want your Agent to remember what it did in the past. This layer gives it continuity across sessions.
● Short-term: current reasoning steps, chat history
● Long-term: facts, company knowledge, user preferences
5) Tools
This layer extends the Agent’s power beyond language and takes real-world action.
● Each tool has parameters, inputs, and examples.
● The design here decides how well your agent uses external APIs.
6) Tool Results
● This layer feeds the tool’s results back to the model to enable self-correction, adaptation, and dynamic decision-making. These are the exact six layers that help you build fully context-aware Agents.