What is a system prompt? Definition and examples
On this page
A system prompt is the set of instructions an application gives a language model before a conversation starts: its role, rules, tone and what it must not do.
How it works
Model APIs separate the application's instructions from what the end user types. Anthropic's API has a system parameter, and its documentation notes that "setting a role in the system prompt focuses Claude's behavior and tone" (Claude docs). OpenAI uses an instructions parameter or messages with the developer role, which "are instructions provided by the application developer, prioritized ahead of user messages". OpenAI compares the two roles to a function and its arguments: the developer message holds "the system's rules and business logic", and the user message supplies the input (OpenAI).
The system prompt is sent with every request, so it takes up part of the model's context windowA context window is the maximum amount of text, measured in tokens, that a language model can take into account at once, including its instructions and reply. on every turn. A typical one covers:
- Role and audience: who the assistant is and who it talks to.
- Sources: what to answer from, such as retrieved pages, and what to do when they do not contain the answer.
- Boundaries: topics, promises and advice it must not give.
- Style: length, tone, language and format.
- Escalation: when to offer a human.
Why it matters for your website
On a website assistant, the system prompt is where "answer only from our pages, and say so when you don't know" lives. Most hosted tools expose it as settings or a "custom instructions" box rather than raw text, but the effect is the same.
It is not a security boundary. OWASP says the system prompt "should not be considered a secret, nor should it be used as a security control" (OWASP). Visitors can try to make the model reveal or ignore it through prompt injectionPrompt injection is when text an AI model reads, typed by a user or hidden in a page or file, overrides its instructions and changes what it says or does.. Two rules follow:
- Never put API keys, internal prices or private data in a system prompt.
- Enforce anything that must hold, such as who may book what, in code outside the model. These outside checks are called guardrailsGuardrails are checks placed around an AI model that limit what it accepts, says and does, so its behavior stays inside rules the business has set..
Example
A short system prompt for a B2B software site:
You are the website assistant for Acme Analytics, a revenue dashboard for
subscription businesses. You talk to prospective and current customers.
Answer only from the provided passages from acme.example. Link the page you used.
If the passages do not answer the question, say you don't know and offer to
pass the question to the team.
Do not promise discounts, custom terms or delivery dates. Do not give legal or
tax advice. Say you are an AI assistant if asked. Keep answers under 120 words.Related terms
- Guardrails: checks that enforce rules outside the prompt.
- Prompt injection: text that tries to override these instructions.
- Large language model (LLM): the model that reads the prompt.
- Grounding: tying answers to provided sources.
- Context window: the space the prompt shares with the conversation.
Sources
- Text generation: message roles and instructions (OpenAI API documentation) — accessed October 21, 2026
- Prompting best practices: give Claude a role (Claude documentation) — accessed October 21, 2026
- LLM07:2025 System Prompt Leakage (OWASP Gen AI Security Project) — accessed October 21, 2026