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.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Every chat-style LLM API is built on the same three-role abstraction: system, user, assistant. The labels look almost trivial, but the placement decisions they force are where a lot of production prompt-engineering quality actually lives.
The goal of this question is to make sure a candidate can name the three roles, state each one's purpose in a single sentence, and explain why the split exists at all. The deeper layer is what every senior interview eventually probes: the stateless nature of the API, the role of the application in owning the transcript, and the new economic pressure that prompt caching puts on the system block.
What each role actually carries
The system message is the model's standing orders for the call. Persona, tone, output format, refusal behavior, schema, tool descriptions, jurisdiction-specific rules; anything that should hold true across every turn of the conversation. By convention it is set once per session and reused.
The user message is the dynamic surface. In a chatbot it is whatever the human typed; in a backend pipeline it is whatever your application is asking. Retrieved RAG context typically belongs here too, alongside the query that needs it. Anthropic and OpenAI both note that recency in the sequence helps the model attend to context placed close to the question.
The assistant message is the model's earlier replies replayed back to it. The API does not remember anything across calls, so your code stores the prior responses and resends them as assistant turns on every new request. Without this, multi-turn coherence collapses.
Situations where this technique stops working.
2–4 min · Everything important, quickly.
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.
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?
Sliding window of recent turns plus a running summary in system or a dedicated summary message. Mention vector store recall for older turns when truly long-horizon.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases 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.
60 second bullets to scan on the way to the call.
The three role labels and one-sentence purpose of each
Why the chat API is stateless and what that means for transcripts
Primary sources. Browse if you want the original framing.
Same topic, related formats. Practice these next.