What Is a Constraint?
A constraint is a boundary or limitation that tells an AI assistant what it should or should not do while completing a task.
Constraints can control things such as length, quantity, scope, time period, required information, excluded information, audience, or other boundaries.
For example:
Summarize this report in no more than 200 words.
The 200 word limit is a constraint.
Why Constraints Matter
Without constraints, an AI may produce a response that is technically relevant but not suitable for the situation.
For example:
Give me recommendations for improving my presentation.
This could produce a very long list.
Adding a constraint makes the request more precise:
Give me the five most important recommendations for improving my presentation.
Length Constraints
One of the most common constraints is response length.
You can specify:
- A maximum number of words.
- An approximate number of words.
- A maximum number of sentences.
- A short or concise response.
For example:
Explain cloud computing in approximately 150 words.
Or:
Summarize the document in no more than 100 words.
Quantity Constraints
You can specify how many results you want.
For example:
Give me exactly five business ideas.
This is more precise than:
Give me some business ideas.
Quantity constraints are especially useful when you need a fixed number of results.
Scope Constraints
A scope constraint limits which part of a subject the AI should consider.
For example:
Analyze only the financial risks in this report.
The word only creates an important scope boundary.
Time Constraints
When dates matter, specify the relevant time period.
For example:
Analyze sales from January through June 2026.
This is clearer than asking the AI to analyze recent sales.
Audience Constraints
The intended audience can act as an important boundary.
For example:
Explain the topic for a complete beginner with no technical background.
This limits the expected level of technical detail and vocabulary.
Required Information
A constraint can require particular information to appear in the response.
For example:
For each recommendation, include the expected benefit and one potential risk.
This creates a consistent requirement for every recommendation.
Excluded Information
You can also specify information that should not be included.
For example:
Do not include information that is unrelated to the current problem.
Another example:
Use only the information provided and do not invent missing facts.
Source Constraints
Sometimes the AI should use only particular information sources.
For example:
Base the summary only on the attached report.
This defines the information boundary for the task.
Format Constraints
Constraints can also control presentation.
For example:
Return exactly five bullet points.
Or:
Present the comparison as a table with four columns.
These requirements constrain the structure of the result.
Language Constraints
You can specify the language or vocabulary level.
For example:
Explain the concept using simple English and avoid technical jargon.
This is useful when the audience has limited technical knowledge.
Tone Constraints
When tone matters, you can define it.
For example:
Write the message in a professional but friendly tone.
The tone requirement establishes a boundary around how the response should sound.
Do Not Make Every Constraint Absolute
Some constraints should be treated as targets rather than rigid rules.
For example:
Keep the explanation around 500 words.
This allows some flexibility.
Compare this with:
Use exactly 500 words.
The second instruction is much more rigid.
Exact vs Approximate Constraints
Choose exact wording when the number really matters.
For example:
Return exactly three recommendations.
Use approximate wording when flexibility is acceptable.
For example:
Return approximately three recommendations.
Constraints Can Improve Usability
A useful response is not always the most detailed response.
If you need a quick briefing before a meeting, a concise response may be more useful than a long explanation.
For example:
Summarize the key risks in five bullet points for a management meeting.
Constraints Can Prevent Scope Creep
AI responses can become broader than the original task.
A scope constraint can keep the response focused.
For example:
Review only the pricing section of the proposal.
This prevents unrelated sections from becoming part of the analysis.
Constraints Can Protect the Intended Audience
A response written for experts may not be suitable for beginners.
For example:
Explain the concept for a high school student and avoid advanced terminology.
The audience constraint helps keep the response appropriate.
Constraints Can Define a Time Window
When analyzing events, data, or information, a time window can be important.
For example:
Compare the company performance during the first half of 2026 with the first half of 2025.
This is much more precise than asking for a general comparison.
Constraints Can Define a Data Boundary
When working with data, specify which data should be used.
For example:
Calculate the average using only completed orders.
This prevents other records from being included unintentionally.
Constraints Can Define Decision Criteria
When asking for recommendations, constraints can define what matters most.
For example:
Recommend options that cost less than 1,000 dollars and can be implemented within 30 days.
The budget and time limits narrow the acceptable options.
Multiple Constraints
A single prompt can contain several constraints.
For example:
Give me five recommendations for improving customer support. Focus only on actions that can be implemented within 30 days. Keep each recommendation under 40 words.
This prompt contains quantity, scope, time, and length constraints.
Prioritize Constraints
Sometimes constraints can compete.
For example:
Give a detailed explanation in exactly 50 words.
The request may be difficult because detail and strict length limits can conflict.
If this happens, explain which requirement has priority.
For example:
Prioritize completeness over the 50 word target if important information would otherwise be lost.
Avoid Contradictory Constraints
Before submitting a prompt, check whether the constraints can realistically be satisfied together.
For example:
Provide a comprehensive analysis in two sentences.
This may be unrealistic depending on the complexity of the subject.
Constraints Should Support the Goal
A constraint should help produce the desired result.
Do not add a limitation simply because you can.
For example, requiring exactly three sentences may be unhelpful if the task genuinely needs more explanation.
Do Not Over-Constrain Simple Tasks
A simple task usually needs only simple boundaries.
For example:
Translate this sentence into Spanish.
There may be no need to add several unrelated constraints.
Constraints and Instructions
Instructions tell the AI what action to perform.
Constraints define boundaries around that action.
For example:
Instruction: Summarize the report.
Constraint: Keep the summary under 200 words and focus only on financial risks.
The instruction defines the action while the constraints define boundaries.
Constraints and Output Format
Output format and constraints can overlap but they are not identical.
For example:
Format: Present the answer as a table.
Constraint: Use no more than five rows.
The format defines the structure while the constraint limits it.
Constraints and Context
Context explains the situation.
Constraints define boundaries.
For example:
Context: The presentation is for senior management.
Constraint: Keep the briefing to one page.
Both can be useful together.
Use Constraints to Improve Focus
When an AI response is too broad, ask what boundary is missing.
You may need to limit:
- Topic.
- Time period.
- Number of results.
- Length.
- Audience.
- Source material.
- Required information.
Example: Writing
Write a customer email explaining a two day delivery delay. Keep it under 150 words, use a professional and friendly tone, and include the revised delivery date.
This combines a task with length, tone, and required-information constraints.
Example: Analysis
Analyze the attached report. Focus only on financial risks, identify exactly five risks, and present each one with its potential impact.
This combines scope, quantity, and required-information constraints.
Example: Learning
Explain machine learning to a complete beginner in no more than 300 words. Avoid mathematical formulas and give two everyday examples.
This combines audience, length, exclusion, and quantity constraints.
Example: Recommendations
Recommend three ways to reduce project delays. Consider only actions that require no additional staff and can be implemented within 30 days.
This creates quantity, resource, and time constraints.
Review Whether Constraints Were Followed
After receiving a response, check:
- Was the requested number of items provided?
- Was the length requirement followed?
- Was the correct scope used?
- Were required items included?
- Were excluded items avoided?
- Was the time period correct?
Refine Constraints
If the result is not suitable, identify which boundary needs adjustment.
If the answer is too broad, narrow the scope.
If it is too long, add a length limit.
If it contains too many recommendations, specify a quantity.
If it includes irrelevant information, define what should be excluded.
Constraints Are Not Guarantees
A constraint in a prompt does not guarantee perfect compliance.
An AI system may occasionally misunderstand or fail to follow a requirement.
Important outputs should therefore be checked against the requested constraints.
A Practical Constraint Framework
When designing a prompt, consider these questions:
- How much information do I need?
- How many results do I need?
- What should the AI focus on?
- What should it avoid?
- What time period matters?
- Who is the audience?
- What information must be included?
- Are any requirements likely to conflict?
Use Only Useful Constraints
The best constraints are the ones that improve the usefulness of the result.
Do not add boundaries merely to make a prompt look more sophisticated.
Use constraints when they help control scope, quality, length, quantity, relevance, or usability.
What You Should Remember
- A constraint defines a boundary or limitation for an AI task.
- Common constraints control length, quantity, scope, time, audience, sources, required information, and exclusions.
- Exact constraints are useful when precision matters.
- Approximate constraints provide flexibility.
- Multiple constraints can be combined.
- Conflicting constraints should be identified and prioritized.
- Constraints should support the goal rather than add unnecessary complexity.
- Important constraints should be checked against the final response.
- Constraints improve control but do not guarantee perfect AI compliance.
What Comes Next?
The next lesson will introduce Few-Shot Prompting and Examples, where examples can be used to demonstrate the kind of response or pattern you want from an AI assistant.