Context engineering
Context engineering is the deliberate selection, organization, and management of information supplied to an AI system to support effective task performance.
Build an AI Agent (From Scratch)
The discipline of designing which information is provided to a language model, when it is provided, and how it is represented for task completion.
- How it is used
- Guides what an LLM agent receives on each call as tools and conversation state change.
- How deep it goes
- Defines five strategies and shows an execution-state-to-request boundary, while leaving detailed strategy implementations to later components.
- Examples
- Uses a curated LlmRequest and workspace-based skill documents to illustrate selective disclosure of state and tool instructions.
- What you can do after
- Build it from scratch by selecting model-visible state, then adding retrieval, memory, planning, and workspaces to an agent loop.
Read how Build an AI Agent (From Scratch) explains context engineering →
Introduction to Generative AI, Second Edition
Context engineering is the systematic assembly and structuring of prompts, instructions, history, memory, retrieved information, tools, and output constraints needed for a model to complete a task.
- How it is used
- Frames reliable AI output as a system-level task of assembling and structuring all relevant model inputs.
- How deep it goes
- Defines the expanded scope and design decisions, but stops short of implementation procedures or technical internals.
- Examples
- Uses system instructions, queries, histories, memories, retrieved documents, tool definitions, and formatting constraints as examples.
- What you can do after
- Apply it by selecting, excluding, structuring, and timing the information supplied to a language model.
Read how Introduction to Generative AI, Second Edition explains context engineering →
Related concepts
- prompt engineeringcontrasts with · Prompt engineering is the deliberate design and refinement of instructions, context, examples, or other inputs to guide an AI model’s behavior or outputs.
- agent harnesspart of · An agent harness is the surrounding software, configuration, and execution environment that enables and manages an AI agent’s operation.
- context windowuses · A context window is the bounded sequence of tokens or other input information a model can access when processing or generating an output.
- AI agentused by · An AI agent is a computational system that uses artificial intelligence to interpret information, select actions, and pursue goals through interaction with an environment.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

