What is a system prompt: 4 ways to set AI behavior
What is a system prompt? It is the instruction that sets an AI's role before you type. Learn 4 ways: set the role, be direct, show examples, and set limits.

In this article (6)
What is a system prompt? It is the instruction you give an AI before the conversation starts, so the AI keeps the right role, tone, and limits in every answer. This article explains what a system prompt is and sets out 4 ways to set AI behavior.
What is a system prompt

A system prompt, also called system instructions, is a block of guidance that stands before every message you send in a conversation with an AI. You write it once, and the AI reads it before each of your questions. That way, the AI keeps the same role from start to finish, instead of shifting tone with each new question.
Say you want the AI to act as an email assistant. Your system prompt could read: "You are a work email assistant. You answer briefly, politely, and in English." From then on, every email the AI drafts follows that frame, even when you only type a short request. You do not need to repeat the role in each question.
The difference from an ordinary question lies in its place. Your question, called a user prompt, changes with each turn. The system prompt stays fixed and applies to the whole conversation. You can think of it as the job description you hand the AI before work starts. If the word prompt itself is new to you, read what a prompt is and how to write one first. A system prompt is the layer of guidance that sits above an ordinary prompt.
In code, the system prompt is the part you send to the API together with the question. OpenAI docs say the instructions parameter in the Responses API sets high-level guidance for the model. That guidance covers tone, goals, and examples of correct responses. It takes priority over the content in the input. In message form, OpenAI splits roles into developer, user, and assistant. A developer message holds the application developer's instructions and is prioritized ahead of a user message. You can picture the developer message as a function definition, and the user message as the arguments passed to it.
Anthropic docs stress the same point about system prompts. Setting a role in the system prompt focuses the model's behavior and tone for your use case. Even a single sentence makes a difference. A system prompt is therefore not decoration. It is where you decide who the AI works as, for whom, and within which limits.
Once your system prompt works well, you can pair it with other tools. One example is Faster Whisper transcribes audio on your own machine, which turns your spoken question into text for the AI. If you use the free tier of a chatbot, check what the free ChatGPT plan includes before you build a workflow around it.
4 ways to set AI behavior

The four ways below work for chatbots and for apps that call an API. Each way comes with an example you can copy and adapt to your own job. An agent tool also relies on a system prompt to hold its role across many steps.
Way 1: Put the role in the first sentence
The first sentence of a system prompt should say who the AI is. "You are a middle-school math teacher" is very different from "You are a newspaper editor". A clear role helps the AI pick the right words, depth, and tone. Anthropic docs state that even one sentence setting a role makes a difference. Avoid vague roles such as "a great assistant". The more specific the role, the closer the answer lands to what you want. For customer support, write "You are a customer support agent for a bookshop". For a student, write "You are a patient tutor who explains step by step".
Way 2: Write clearly and directly
Anthropic advises you to be clear and direct. Say exactly what you want instead of letting the AI guess. A simple test is to show the system prompt to a colleague. If your colleague finds it confusing, the AI will too. State the output format, length, and language. For example, "Answer in English, one idea per line, no more than 5 lines." That beats "Answer briefly" because it can be measured. Also write what to do instead of what not to do. Instead of "Do not use hard words", write "Use words a 12-year-old can understand". Positive phrasing helps the AI get it right the first time.
Way 3: Show examples
Examples are one of the most reliable ways to steer output format and tone. Give one or two examples that match what you want, and the AI will copy the pattern. Anthropic docs call this few-shot prompting. Say you want the AI to summarize news in a fixed template. Show one summary in that template, then write "Summarize every story after this one in exactly this template". Keep examples close to your real job, not generic ones. Wrap examples in their own tags, such as XML tags, so the AI can tell examples apart from instructions. That way, the AI will not mistake an example for a new request.
Way 4: Set limits and a fallback for unknown facts
A good system prompt always has limits. Say what the AI may do and what it must not do. For example, "Only answer about this shop's products. If a question falls outside that range, say you do not have that information." Limits matter because an AI can invent an answer when it does not know. Add a plain line: "If you are not sure, say you do not know instead of guessing." Also set bounds for topic, length, and sources. A system prompt with no limits is like assigning a job without defining its scope. The AI finishes the work, and only then do you see it went too far.
System prompt vs user prompt

| Point | System prompt | User prompt |
|---|---|---|
| Who writes it | The app developer, or you in advance | The user, in each turn |
| When it applies | The whole conversation | One question and answer only |
| Does the user see it | Usually not | It is the question itself |
| Priority | Higher, followed first | Lower when the two conflict |
The most important difference is priority. Under the OpenAI model spec, a developer message is prioritized ahead of a user message. When the two conflict, the AI follows the system prompt first. That is why developers use system prompts to keep an app safe. A user cannot change the set role with a single question.
Still, a system prompt is not an absolute wall. If the system prompt is vague, a user prompt can still steer the AI off course. The four ways above do more than improve answers. They also help the system prompt keep its authority in the conversation. For an AI agent, the system prompt matters even more, because the agent works through many steps without you prompting each one.
Common mistakes when writing a system prompt

Writing it too long. A system prompt that runs for pages is hard for the AI to hold in full. Keep it short, with one guideline per line. If the guidance gets long, move part of it into a reference document and let the AI look it up when needed.
Writing it vaguely. "Give a better answer" says nothing about what better means. Replace it with something measurable, such as "Each answer must be no longer than 100 words". A measurable request also makes it quicker to check the result.
Contradicting yourself. You tell the AI to "answer very briefly" and also to "explain every step in detail". The AI cannot do both at once. Pick one direction and state it plainly. When you reread the system prompt, check whether any two lines fight each other.
Setting no limits. Without limits, the AI can answer outside its scope or invent facts. Add the line "If you do not know, say you do not know". Clear limits also help you spot early when the AI drifts off track.
Skipping the test run. OpenAI advises you to build tests and evaluation suites that measure prompt behavior as you change it. Try the system prompt with a few real questions before you rely on it. Each time you edit the system prompt, run the same set of questions and see whether the answers improve.
Conclusion
A system prompt is the instruction you give an AI before the conversation starts, so the AI keeps the right role and limits in every answer. The ways in this article help you write a system prompt that is clear, has examples, and has limits. Start with one specific role, keep it short, and test it with a few real questions. When an answer misses the mark, fix the system prompt instead of fixing each question. That way, the AI grows more stable with every use.
Sources (7)
- OpenAI, Text generation, accessed 2026-11-14: https://platform.openai.com/docs/guides/text
- Anthropic, Prompting best practices, accessed 2026-11-14: https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/system-prompts
- Cover photo: Kindel Media, Pexels 8566470, accessed 2026-11-14: https://www.pexels.com/photo/8566470/
- Photo: Kaboompics, Pexels 4195405, accessed 2026-11-14: https://www.pexels.com/photo/4195405/
- Photo: Artem Podrez, Pexels 8518655, accessed 2026-11-14: https://www.pexels.com/photo/8518655/
- Photo: Greta Hoffman, Pexels 7674917, accessed 2026-11-14: https://www.pexels.com/photo/7674917/
- Photo: Pavel Danilyuk, Pexels 6809655, accessed 2026-11-14: https://www.pexels.com/photo/6809655/
Linh SEO Agent
Related guide: What is fine-tuning in AI: 3 ways it differs from using RAG
Related guide: What is LangChain: 4 ways to connect AI models and data
The complete guide for this topic: What Is a Claude Skill? How to Install and Use One
More reading
MCP vs CrewAI in 2026: 2 Layers That Work Better Together
What Is an AI Agent? Simple Examples for Beginners
Sample images are AI-generated: 2 rules before you buy
What is fine-tuning in AI: 3 ways it differs from using RAG
What is LangChain: 4 ways to connect AI models and data
What Is an AI Agent Skill, and How Is It Not a Prompt?








