What are the three message roles in a chat-style LLM prompt and what does each represent?
system carries standing orders, user carries the current turn's input, assistant replays prior model responses so the next call has context.
Imagine a new employee at a help desk. Before the shift the manager hands them a short briefing: who they work for, what tone to use, what they must never say. That briefing is the system message. During the shift, customers walk up and ask questions; each question is a user message. The employee's previous answers are written down on a notepad they keep referring to so the conversation feels continuous; those notes are the assistant messages. Every new question, the employee re-reads the briefing, the conversation so far, and the new question, then replies.
Detailed answer & concept explanation~4 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
3 min: role definitions + stateless API + transcript ownership + where RAG context goes + prompt caching implication for system.
Real products, models, and research that use this idea.
- OpenAI's Chat Completions and Responses APIs accept the system/user/assistant role list directly; GPT-5.5 and the o-series read them on every call.
- Anthropic's Messages API has explicit user/assistant turns plus a top-level system parameter, and Claude Opus 4.7 caches that system block for repeated calls.
- Customer-support copilots (Intercom Fin, Zendesk AI agents) keep the brand voice and refusal policy in system, the live ticket message in user, and stream prior bot replies as assistant.
- Cursor and Copilot Chat assemble system (coding rules + repo conventions), user (current question + open files), and assistant (prior turns) on every keystroke.
What an interviewer would ask next. Try answering before peeking at the approach.
QIf the API is stateless, how do production chatbots get long-conversation memory without blowing the context window?
QWhere do you place retrieved RAG chunks: system or user, and why?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Putting the user's per-turn question into the system message; the system role is for persistent rules, not the current query.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.