0PricingLogin
AI Agents · Lesson

System vs User vs Assistant Roles

Understand the three message roles in modern chat APIs and how they affect what the model trusts and obeys.

Three Roles, One Conversation

Every chat API uses three message roles:

  • system — meta-instructions, persona, rules
  • user — input from the human or upstream
  • assistant — the model's output

Why Roles Exist

Models are trained to treat these roles differently. The system role gets the highest trust; user messages are the lowest.

This is how the model knows your instructions take priority over what an attacker types in user input.

All lessons in this course

  1. Zero-shot, Few-shot and Chain-of-Thought
  2. System vs User vs Assistant Roles
  3. Output Formatting (JSON, XML, Markdown)
  4. Avoiding Prompt Injection in Inputs
← Back to AI Agents