When you call a model from code, you usually do not send one big block of text. You send a list of messages, each with a role that tells the model who is speaking.
The common roles
- System (or developer) instructions: set up how the model should behave for the whole conversation — its job, tone, rules, and output format. Users of your app normally never see these.
- User: what the person asked.
- Assistant (or model): what the model replied earlier. You include previous replies so the model can follow the conversation.
[
{"role": "system", "content": "You are a support assistant for an Android app. Answer in two sentences. If you are not sure, say so."},
{"role": "user", "content": "How do I reset my password?"}
]
Different providers name these slightly differently — some use a separate "instructions" or "system instruction" field instead of a system message — but the idea is the same everywhere.
Writing good instructions
Clear instructions are the cheapest way to improve results. A good system instruction says:
- The job: "You answer questions about our Android app's settings."
- The boundaries: "Only use the help articles provided. Never promise refunds."
- What to do when unsure: "If the articles don't answer the question, say you don't know and suggest contacting support."
- The format: "Reply in at most three short sentences."
Vague instructions like "be helpful and accurate" give the model nothing concrete to follow.
Instructions are guidance, not security
A system instruction strongly influences the model, but it is not a lock. A user — or text inside a document you include — can try to talk the model out of its rules. This is called prompt injection. That is why real apps never put secrets in instructions and check important actions in their own code, not just in the prompt. You will learn this properly in the AI Engineer path.
Try it: write a system instruction for a bot that only answers questions about cooking pasta. Then, as the user, try to get it to talk about something else. Notice how well it holds — and that it is not perfect.
Quick check: where should you put a rule like "answer in three sentences"? (In the system instructions, so it applies to the whole conversation.)