Zenaique

What are the three message roles in a chat style LLM prompt and what does each represent?

Flashcard·Easy·4.0 · 0·~30s·Asked atFiddler AiPromptlayerPwc·Relevant atAnthropic
Attempt it
TL;DR

system carries standing orders, user carries the current turn's input, assistant replays prior model responses so the next call has context.

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

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.

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.

Why the chat API is stateless, and what that means
Where retrieved context and dynamic facts go
Multi-turn memory and the long-conversation problem
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.

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.
Sign in to see more production examples.

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?
A

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.

2 more follow-ups an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

Putting the user's per-turn question into the system message; the system role is for persistent rules, not the current query.

Sign in to see all red flags and common mistakes.

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

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
Flashcard: what is a stop sequence in an LLM API call and what is it used for?
Flashcard·Easy