The short answer
Prompt engineering is the craft of writing instructions that get good results from a language model. Context engineering is the broader job of deciding everything the model sees at each step: the instructions, the documents, the tool results, the conversation so far. For a single question the prompt matters most. For agents and AI products that run many steps, choosing the right context is what makes them reliable.
Key points
- Prompt engineering: how you write the instructions.
- Context engineering: what information the model has when it answers.
- More context is not better. The right, small set of information is.
- Agents need context managed at every step, not once.
- Both are tested the same way: against real cases with known good answers.
Two definitions
Anthropic’s engineering team defines prompt engineering as methods for writing and organizing instructions to a model for the best results, and context engineering as the set of strategies for curating and maintaining the best set of information for the model while it works. In their framing, context engineering includes prompt engineering.
| Prompt engineering | Context engineering | |
|---|---|---|
| Focus | The wording of instructions | Everything the model sees |
| Happens | Mostly once, when you write the prompt | At every step of a task |
| Typical work | Clear roles, examples, output format | Retrieval, tool results, memory, trimming |
| Matters most for | Single questions and simple features | Agents and multi-step products |
Prompt engineering basics that still hold
- Say what the job is and who it is for, plainly.
- Give examples of good output.
- Specify the format you need back.
- Say what to do when unsure, for example to ask or to hand off.
- Keep instructions in one place, and remove contradictions.
The major model providers publish prompting guides, and the advice in them is consistent: clarity beats cleverness.
Why context became the bigger job
Once a model can use tools and take several steps, what it sees changes constantly: search results, files, database rows, earlier messages. A model given too little information guesses. A model given too much loses track of what matters. Deciding what goes in, and what is left out, at each step is the work.
- Retrieve only the passages relevant to the current step.
- Summarize long histories instead of passing them whole.
- Return tool results in a short, consistent shape.
- Keep stable instructions separate from changing information.
Retrieval is the main tool here. See RAG vs fine-tuning.
What this means if you are building with AI
- Write a clear prompt first. Many simple features need nothing more.
- For anything that uses your data, design what the model is given at each step.
- Build a test set of real cases with known good answers before tuning anything.
- Change one thing at a time, and rerun the test set.
The rest of the process is in How to build an AI agent. In AI agent development, prompts and test sets live in your repository, so you own them along with the code.
Sources
Checked when this guide was written.