Prompt Engineering
Prompt engineering is the practice of designing an LLM's inputs — instructions, context, examples, and format — to reliably get the output you want.
Prompt engineering is the practice of designing the inputs to a large language model — instructions, context, examples, and output format — to reliably get the response you want, without changing the model's weights.
The core levers are few and learnable. Write clear, specific instructions and put durable behavior in a system prompt. Show the model what good looks like with few-shot examples. Specify the output format you need (JSON, a list, a single word). For hard problems, decompose the task or ask the model to reason step by step, the idea behind chain-of-thought prompting. And give the model an out — permission to say "I don't know" — so it stops guessing when it lacks the answer.
Prompt engineering is empirical, not theoretical: small wording changes shift behavior in ways you can't fully predict, so you iterate and test against real examples rather than reasoning your way to the perfect prompt. It contrasts with fine-tuning, which alters the model itself; prompting leaves the model untouched and is faster, cheaper, and reversible.
As applications grew into agents, the focus expanded from wording one prompt to curating everything that enters the model's window — a shift toward context engineering. For a catalog of reusable techniques, see the prompt patterns guide.
Frequently asked questions
- How is prompt engineering different from fine-tuning?
- Prompt engineering shapes the model's behavior purely through its inputs — instructions, examples, and format — and changes nothing about the model itself. Fine-tuning retrains the model's weights on your data to bake in new behavior. Prompting is fast, cheap, and reversible, so you try it first; fine-tuning is worth the cost only when prompting can't get you there reliably.
- Is prompt engineering still relevant for agents?
- Yes, but it's part of a larger discipline. For multi-step agents, what matters most is everything assembled into the context window across turns — retrieved data, tool results, and history — which is called context engineering. Prompt engineering remains the core skill for the static instructions, but context engineering governs the dynamic parts.
Related
- System PromptThe system prompt is the standing instruction layer an LLM receives before user input — defining its role, rules, tools, and tone for the whole conversation.
- Few-Shot PromptingFew-shot prompting includes worked examples in the prompt so the model learns the task's pattern from demonstrations instead of instructions alone.
- Chain-of-Thought (CoT)Chain-of-thought prompting has a model work through intermediate reasoning steps before answering — improving accuracy on multi-step problems.
- Context EngineeringTreating the context window as a finite budget — what to load, what to leave out, and when to reset.