What Is a System Instruction?
A system instruction defines the general behavior, role, rules, and output expectations of an AI application.
The user prompt supplies the immediate task. The system instruction supplies the behavior that should remain consistent while completing that task.
The basic separation
System instruction: What the application is and how it should behave.
User prompt: What the user wants the application to process right now.
A Practical Example
Imagine a business email rewriting application.
The permanent application behavior might be:
You are a professional business communication assistant.
Rewrite messages so they are clear, friendly, and professional.
Preserve the original meaning.
Do not invent names, dates, promises, facts, or commitments.
Return only the rewritten message.
The individual user prompt might be:
hey lisa just checking if you saw my last email
The user does not need to repeat all the application rules every time. The server combines the permanent system instruction with the current user input.
Compare the Difference
The playground below sends the same user prompt in two different ways:
- Once without a system instruction
- Once with the system instruction
Run both versions and compare how much control the instruction provides.
System Instruction Comparison
Send the same prompt with and without permanent application behavior.
This defines the permanent behavior of the application.
This is the information supplied during one request.
Without System Instruction
With System Instruction
How the Request Changes
The request without a system instruction contains:
{
"model": "gemini-3.5-flash",
"store": false,
"input": "hey lisa just checking if you saw my last email"
}
The controlled version adds:
{
"model": "gemini-3.5-flash",
"system_instruction": "You are a professional business
communication assistant...",
"store": false,
"input": "hey lisa just checking if you saw my last email"
}
The API endpoint is the same. The model is the same. The user prompt is the same. The added instruction changes the expected application behavior.
What Belongs in a System Instruction?
The Application Role
You are a business communication assistant.
The Primary Task
Rewrite messages so they are clear, professional, and friendly.
Important Rules
Preserve the user's original meaning.
Do not invent facts, names, dates, promises, or commitments.
The Required Output
Return only the rewritten message.
What Does Not Belong There?
Do not place information in the system instruction merely because it is long or inconvenient.
These normally belong in the user request:
- The message currently being rewritten
- The document currently being analyzed
- The topic selected by the user
- The customer's current form submission
- Temporary options selected for one request
A useful test
Ask whether the information defines the application or belongs only to this individual request.
System Instructions Are Not Security
A system instruction guides model behavior. It does not replace server-side security or application rules.
Do not rely on instructions to:
- Authenticate a user
- Protect an API key
- Enforce payment
- Prevent excessive API usage
- Validate uploaded files
- Decide which database records a user may access
Those responsibilities belong to your application code.
The model should not control access
PHP should determine what users are allowed to do before the request ever reaches Gemini.
Avoid Conflicting Instructions
An instruction becomes unreliable when it contains rules that contradict one another.
For example:
Be extremely detailed.
Keep every answer under two sentences.
Explain every concept thoroughly.
The model must decide which requirement matters most.
A clearer version would be:
Explain the answer in no more than two concise paragraphs.
Include only the details needed to complete the task.
Do Not Overload the Instruction
More instructions do not automatically create better results.
Very long instructions can:
- Contain accidental contradictions
- Increase input-token usage
- Make important rules difficult to identify
- Become harder to test and maintain
- Attempt to handle unrelated tasks in one application
A focused application usually performs better with a focused instruction.
Test the Rules Individually
Do not test only the perfect input. Test each important rule.
Test Meaning Preservation
Tell John I agree to the price but I cannot begin until next week.
Test Missing Information
Tell them I will have it finished by
Test Dates and Numbers
The total is $1,275 and payment is due August 14.
Test Already-Good Input
Thank you for your time. I will review the proposal and respond
by Friday afternoon.
Watch for invented details, removed facts, unnecessary wording, and changes in meaning.
System Instructions Are Sent With Each Request
The instruction belongs to the interaction being created. Our PHP endpoint therefore includes it each time the controlled button is used. :contentReference[oaicite:1]{index=1}
In a finished application, users would not normally type or edit the instruction. It would be stored in a protected server file:
<?php
$systemInstruction = '
You are a professional business communication assistant.
Preserve the original meaning.
Do not invent information.
Return only the rewritten message.
';
The visible form would contain only the user input and approved options.
Practical Exercise
- Run the default prompt without the instruction.
- Run the same prompt with the instruction.
- Compare the two results.
- Change “professional and friendly” to “brief, professional, and direct.”
- Run the controlled version again.
- Add a rule requiring a subject line and observe the change.
- Test a message containing a date, price, or specific promise.
Completion goal
You should be able to separate permanent application behavior from information supplied during one user request.
Lesson Summary
A system instruction defines what an AI application does, how it behaves, which rules it follows, and what kind of output it returns.
The user prompt supplies the individual task. The server combines both pieces when preparing the Gemini request.
In the next lesson, we will stop asking Gemini for loosely formatted prose and require it to return structured JSON that an application can reliably process.