Skip to content
47% off: the complete course for $79 (reg. $149)Order now →
Agent Builder
Module 3Full course9 min read

From Prompt Engineering to Context Engineering

Why the best results come from curating everything the model sees — not from magic phrases — and a framework for doing it.

For a while, getting good results from AI meant collecting magic phrases. "Think step by step." "You are a world-class expert." "I'll tip you $200." Some of those tricks helped older models a little. None of them explain why the same agent nails a task on Monday and fumbles a nearly identical one on Tuesday.

The real answer is usually boring: on Tuesday, the model was looking at different information. It was missing a file, holding a stale assumption from earlier in the conversation, or wading through 40 irrelevant search results. Modern models are capable enough that what they see matters far more than how you phrase the ask.

This lesson reframes your job. You'll learn what "context" actually includes, why more of it can make things worse, and a four-step framework for deciding what goes in front of the model, so you can fix bad results deliberately instead of by trial and error.

What the model actually sees

A language model has no memory between calls and no view of your screen, your files, or your company. Every time it responds, it sees exactly one thing: a block of text (and sometimes images) called the context. The context window is the maximum amount of that text it can take in at once, measured in tokens (roughly word-sized chunks; see Context Windows, Tokens, and Cost for the details).

When you type a message into an agent, your message is a small slice of what the model receives. A typical agent's context looks like this:

LayerWhat it containsWho controls it
System promptThe agent's role, rules, and prioritiesThe agent builder
Tool definitionsNames, descriptions, and schemas of every tool availableThe agent builder
Standing instructionsProject files like CLAUDE.md or AGENTS.md, user preferencesYou or your team
Retrieved knowledgeDocuments, search results, file contents pulled in for this taskThe agent, guided by you
MemoryNotes carried over from earlier sessionsThe agent or the builder
Conversation historyEvery previous message, tool call, and tool result in this sessionAccumulates automatically
The current requestWhat you just askedYou

Context engineering is the practice of deliberately designing all of those layers so the model has exactly what it needs for the task, in a form it can use, and as little else as possible. Prompt engineering (the craft of wording a single request well) is one part of it, the last row in the table.