Instruction
An instruction is a directive specifying an action, operation, task, constraint, or expected behavior for a person or computational system.
Prompt Engineering in Practice
An instruction is a directive within a prompt that specifies the task the model should perform.
- How it is used
- Defines the task within a structured prompt for software-engineering work, from incident updates to deployment decisions.
- How deep it goes
- Defines instructions and gives writing rules for actions, audience, scope, and sequence, without descending into model internals.
- Examples
- Uses secure logging guidelines, an incident status update, and a deployment GO/NO-GO brief as structured prompt examples.
- What you can do after
- Build it from scratch by drafting a clear task directive, separating other prompt elements, and placing stable instructions for repeated use.
Read how Prompt Engineering in Practice explains instruction →
Building LLM Applications with DSPy
Text within a prompt that directs a language model’s behavior or specifies how it should perform a task.
- How it is used
- Uses instructions to steer language-model tasks and provide a starting point for prompt optimization.
- How deep it goes
- Explains instruction placement, inspection, modification, and optimization, including the trade-off between manual tweaking and optimizer search.
- Examples
- Illustrates intent-label definitions and a question-answering module that appends “Answer very carefully.”
- What you can do after
- Apply instructions via DSPy signatures and custom modules, then inspect their generated prompts.
Read how Building LLM Applications with DSPy explains instruction →
Coding with AI
A directive that specifies an action or response an artificial-intelligence model should produce.
- How it is used
- Directs an LLM toward a desired response rather than posing a search-style query.
- How deep it goes
- Defines clear wording and task breakdown, then demonstrates iterative refinement without specifying a formal prompt syntax.
- Examples
- Uses repeated prompts for 234 × 432, adding specificity, multiple methods, and requests to show work.
- What you can do after
- Apply iterative prompting by stating the task clearly, requesting methods or shown work, and refining the request.
LLMs in Production
The instruction component of a prompt is the task-specific directive that specifies what the language model should do.
- How it is used
- Directs a language model toward a task-specific response within a structured prompt or reusable template.
- How deep it goes
- Defines the instruction’s role and illustrates it with Q&A and audience-level examples, without examining model internals.
- Examples
- Uses a 401k Q&A template and an instruction that explains the answer as if addressing a five-year-old.
- What you can do after
- Apply it via a prompt template to specify a model’s task and desired response behavior.
The Art of AI Product Development
A prompt instruction is the task specification that tells a model what operation to perform.
- How it is used
- Specifies the operation a language model should perform within a prompt.
- How deep it goes
- Defines instructions and places them among prompt components, stopping short of implementation details.
- Examples
- Uses an EU AI Act article request and reusable topic, content-type, context, and demonstration patterns.
- What you can do after
- Apply via reusable prompt templates to specify tasks, audiences, topics, qualities, and supporting information.
Read how The Art of AI Product Development explains instruction →
Context Engineering
A directive supplied to an AI system that specifies desired behavior, constraints, or task requirements.
- How it is used
- Establishes behavioral rules and constraints for LLM applications across conversations, sessions, or task runs.
- How deep it goes
- Explains three instruction mechanisms and their context-window assembly, including staged skill loading to conserve tokens.
- Examples
- Illustrates a financial-services assistant, an incident-analysis skill, and repository guidance requiring unit tests and regression tests.
- What you can do after
- Evaluate and understand how layered instructions provide behavioral guidance while conserving the token budget.
Also covered in
- The Coder CafeIn early access (MEAP)
- AI Agents and Applications
- AI Agents in Action
- Systems Programming with ZigIn early access (MEAP)
- Lead Developer Career Guide
- Human-in-the-Loop Machine Learning: Active learning and annotation for human-centered AI
- AI Recommender SystemsIn early access (MEAP)
What to know first
- language modelA language model is a computational model that represents patterns in linguistic sequences to assign probabilities, predict, generate, or evaluate language.
- promptA prompt is text or other input supplied to an AI model to provide instructions, context, or other information that guides its response or generated output.
- ChatGPTChatGPT is OpenAI’s conversational AI service, which lets users interact with generative AI models and related tools through natural-language prompts.
- AI agentAn AI agent is a computational system that uses artificial intelligence to interpret information and select or perform actions toward goals while interacting with an environment.
Related concepts
- constraintcontrasts with · A constraint is a condition or rule that restricts the permissible choices, states, actions, values, or solutions in a system or problem.
- lda instructionincludes · The LDA instruction loads an operand into the 6502 accumulator register.
- ldx instructionincludes · The LDX instruction loads an operand into the 6502 X register.
- ldy instructionincludes · The LDY instruction loads an operand into the 6502 Y register.
- machine instructionincludes · A machine instruction is an operation encoded for direct execution by a processor according to its instruction set.
Questions about instruction
What is instruction?
An instruction is a directive specifying an action, operation, task, constraint, or expected behavior for a person or computational system.
Which Manning books explain instruction?
Prompt Engineering in Practice, Building LLM Applications with DSPy, Coding with AI, LLMs in Production, The Art of AI Product Development and Context Engineering.
What should I know before learning instruction?
Manning books that teach instruction usually introduce language model, prompt, ChatGPT and AI agent first.
What is the difference between instruction and constraint?
An instruction is a directive specifying an action, operation, task, constraint, or expected behavior for a person or computational system. A constraint is a condition or rule that restricts the permissible choices, states, actions, values, or solutions in a system or problem.
What kinds of instruction are there?
Kinds of instruction include lda instruction, ldx instruction, ldy instruction, machine instruction and stack instruction.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.





