liveBook · Manning

Context engineering

As explained in Context Engineering

Context engineering is the discipline of selecting, organizing, and updating information supplied to a model in an appropriate form and at an appropriate time.

Context engineering is the discipline of assembling, maintaining, and routing information to an LLM at inference time. Its goal is to supply each model call with the smallest relevant set of tokens that makes the task solvable within the context window. section 1.0

Prompt engineering refines the wording of an input; context engineering governs the broader information available when that input arrives. It changes the runtime context rather than the model’s trained parameters. The agent harness supplies surrounding infrastructure, including execution, permissions, and control flow, though its boundary with context engineering is not fixed. section 1.1 section 12.1.1 section 1.2.3

A model call can draw on six context sources:

  • Instructions define behavior and constraints; the user prompt supplies the current request. section 12.1.1
  • External knowledge supplies information beyond training; tools expose actions and schemas. section 12.1.1 section 3.0
  • Memory carries information from previous interactions or stores; state represents the current workflow, environment, or application. section 12.1.1

External knowledge can be retrieved dynamically, preloaded for reuse, or injected directly as complete documents. Context management selects and shapes information for each call, while orchestration coordinates workflows and agents. Persistent sources remain outside the window until the system brings an appropriate slice into a call. section 3.0 section 1.7 section 1.1.1

Travel planning

A travel agent can query flight availability, hotel prices, visa requirements, and opening hours instead of relying only on training data. It carries the chosen flight, budget, neighborhood preference, and refund requirement into later hotel and itinerary decisions. This grounds each step in current evidence and helps preserve earlier constraints. section 1.4

Coding-agent workflow

For a backlog scoring endpoint, a Codex agent can use Context7 to retrieve relevant FastAPI documentation, combine it with repository context, update implementation and tests, then run the test suite. Repository files provide project context, documentation supplies external knowledge, and test results provide execution feedback. section 11.5.4

More context is not automatically better: too little can produce vague or invented answers, while excess information adds noise, latency, and cost. Design must balance task quality with context length and other constraints. Reliability also requires attention to prompt injection, privacy, evaluation, observability, governance, and operational maintenance; context engineering does not eliminate model limitations. section 1.1.1 section 1.7 section 11.6 section 12.1

How Context Engineering covers it

How deep it goes
Develops context-source selection and architecture, with worked applications and mathematical formulations for optimization and model conditioning.
Examples
Illustrates travel planning with live evidence and builds a persistent knowledge base from research papers.
What you can do after
Apply context engineering with Codex and Context7 to combine repository context, current documentation, and test feedback.
How it connects
Connects prompt engineering, retrieval-augmented generation, memory, state, orchestration, and harness engineering.

Also explained in

Compare how 7 books explain context engineering →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Context Engineering. The section links point to the parts of the book it draws on.