# Overview
Prompt engineering and context engineering address different problems. Prompt engineering refines the instruction you give a model to get a desired output. Context engineering arranges the information and resources the model can use while producing that output: documents retrieved at runtime, stored memory, available tools, and the conversation history. Treat prompt engineering as designing the request and context engineering as designing the model's information environment.
# Prompt engineering: what it is and when to use it
Prompt engineering is writing and iterating instructions to guide a large language model. Common elements include the task, the role the model should adopt, the target audience, required inclusions or exclusions, constraints, and output format. It is usually applied to summaries, classification, extraction, rewriting, and single-shot or simple multi-turn generation where all necessary information can be supplied inside the prompt or prompt template.
# Context engineering: what it is and when to use it
Context engineering operates at the system level. It decides which documents, records, memory entries, tool descriptions, and previous messages enter the model's limited context window at runtime. This discipline matters for assistants, retrieval-augmented systems (RAG), personalized apps, tool-using agents, and long-running tasks that require up-to-date or private information outside a single prompt.
# Practical example
If you ask an AI to resolve a billing issue, a well-written prompt might say: be polite, explain options, and draft an email. But the prompt alone won't include the client's payment history, refund policy, or current invoice status unless those are supplied. Context engineering supplies that information at runtime—retrieved records, memory of prior interactions, and any tool permissions—so the model can produce an accurate, authorized response.
# Side-by-side summary
- Primary question: How should you ask?
- Scope: Usually one prompt or prompt template
- Best suited to: Summaries, classification, extraction, rewriting
- Common failure: Vague or conflicting instructions
- Primary question: What should the model know and access now?
- Scope: Full application or agent workflow
- Best suited to: Assistants, RAG systems, personalized apps, tool-using agents
- Common failure: Missing, stale, excessive, or unauthorized information
# How to improve each approach
For prompts: rewrite, test outputs, and iterate with clear role, examples, constraints, and precise output format. For context: improve retrieval quality, filtering, memory design, tool integration, ordering of inputs, and automated evaluation to keep the model working with the right information.
# Relationship between the two
Prompt engineering is a component of a larger system. Context engineering is the broader discipline that includes prompting plus decisions about retrieval, memory, and tools. They are complementary: effective AI applications typically require both a good prompt and a well-managed context pipeline.
# Common mistakes to avoid
- Relying on token quantity instead of relevance: adding more documents or history without filtering can reduce output quality.
- Assuming a prompt can substitute for runtime data: prompts that omit required external facts produce incorrect answers.
- Ignoring authorization and staleness: context should be curated to avoid exposing outdated or private data.
# Bottom line