System, Developer, and User Prompts

The Three Prompt Roles

Modern LLM APIs structure input into distinct roles. Each role represents a different source of instructions with different levels of trust and different purposes.

01

System prompt — instructions from the developer that define the model's behavior, identity, and constraints for the entire session

02

User prompt — input from the end user; the message the user types in their turn of the conversation

03

Assistant turn (developer-seeded) — pre-written model responses inserted into conversation history by the developer to establish context, examples, or state before the real conversation begins

The System Prompt

The system prompt is the developer's layer. It is written once and shapes every interaction in the session. It is the authoritative source of the model's purpose, rules, and constraints.

What Goes in the System Prompt
  • Role and persona — "You are a helpful coding tutor who teaches Python to beginners."
  • Behavioral rules — "Always ask for clarification before writing code. Never write code that could delete data."
  • Scope constraints — "Only answer questions related to Python. Politely decline off-topic requests."
  • Format requirements — "Always wrap code examples in code blocks. Use numbered steps for procedures."
  • Safety boundaries — "Do not provide advice on activities that violate the platform's terms of service."
Why the System Prompt Is Trusted

The system prompt is set by the developer who controls and is responsible for the application. The model treats it as the authoritative definition of its purpose. Unlike user input, the system prompt is not exposed to or modifiable by end users — by design.

The User Prompt

The user prompt is the end user's input — what the user actually types. It is the lowest-trust layer in the hierarchy.

Why the User Prompt Is Untrusted

User input comes from a person the developer may not know, with intentions the developer cannot predict. This is why users should not be able to override system prompt instructions, why user input that looks like a system-level instruction is the source of prompt injection attacks, and why user input should be validated before reaching the model where possible. The system prompt is intended to take priority over user instructions — but the model cannot enforce this perfectly.

The Developer-Seeded Assistant Turn

In multi-turn applications, developers sometimes pre-seed the conversation with assistant messages — responses the model did not actually generate but that are inserted into the conversation history.

01

Establish consistent behavior — pre-populate a greeting or opening state before the user's first message

02

Provide few-shot examples — insert example user-assistant exchanges to demonstrate the desired response pattern in a conversational format

03

Set conversation state — establish context the model needs to respond correctly: "The user has authenticated and their plan is Pro."

Trust Hierarchy

Layer and trust level

System prompt — highest trust; developer-controlled; defines behavior for the entire session

Developer-seeded assistant turns — developer-controlled; higher trust than end-user input

User prompt — lowest trust; end-user-controlled; should never override system-level constraints

Why the hierarchy matters

A well-designed system prompt sets rules the model maintains even when users attempt to override them.

Prompt injection attacks target the system prompt level — successfully injecting at that level gives the attacker developer-level control.

The model cannot perfectly enforce the hierarchy — this is a known limitation.

Application Design Implications

01

Put behavioral constraints in the system prompt — rules that must always apply belong there, not in the user turn where users can see and attempt to override them

02

Do not use the system prompt as a secrets vault — it is not fully secret; a determined attacker can sometimes extract it via prompt injection; treat it as a configuration layer, not a credentials store

03

Treat user input as untrusted — validate and sanitize user input before it reaches the model; never allow user input to modify system-level behavior

04

Keep system prompts focused — a shorter, clearer system prompt is more reliably followed than a long one covering every edge case; prioritize core rules

Summary

Key Takeaways
  • Modern LLM APIs have three prompt roles: system prompt, user prompt, and developer-seeded assistant turns
  • The system prompt is the developer's layer — persona, rules, scope, format, and safety boundaries
  • The user prompt is the end user's input — untrusted by default; should not override system-level constraints
  • Developer-seeded assistant turns pre-populate conversation history for consistent behavior, examples, or state
  • Trust hierarchy: system prompt > developer turns > user prompts
  • Behavioral constraints belong in the system prompt; user input must be treated as untrusted; the system prompt is not a secrets vault

Need Help?

Ask the AI if you need help understanding the three prompt roles, what belongs in a system prompt versus a user prompt, how developer-seeded turns work, or how to design the prompt structure for an LLM application you are building.