System Prompt
A system prompt is a set of instructions given to a language model before user input that establishes its role, tone, constraints, and behavior for the remainder of a conversation.
Definition
A system prompt is a set of instructions given to a language model before user input that establishes its role, tone, constraints, and behavior for the remainder of a conversation.
Overview
Most modern chat-based LLM APIs, including those from OpenAI and Anthropic, support a distinct "system" role alongside "user" and "assistant" messages. The system prompt sits outside the normal conversational turn-taking and is typically given higher priority by the model when resolving conflicting instructions, making it the primary mechanism developers use to configure an LLM's persona, behavioral guardrails, and task-specific instructions. A well-crafted system prompt might define the assistant's identity ("You are a helpful coding assistant"), specify output format requirements, list tools available to the model, set safety boundaries around what topics to avoid, or provide background context the model should treat as ground truth. Because it is injected once and persists across the conversation, the system prompt is more efficient than repeating instructions in every user message, and it's harder for end users to override through casual conversation — though it is not a hard security boundary, since carefully crafted user input can sometimes cause a model to disregard system instructions, a failure mode studied under prompt injection. System prompts are a key lever in prompt engineering and are often iterated on extensively in production applications to balance helpfulness, safety, and consistency. Many API providers also expose system-prompt-like mechanisms for tool definitions and structured output schemas, blurring the line between plain instructions and machine-readable configuration. Because system prompts can encode significant business logic and proprietary phrasing, some companies treat them as sensitive intellectual property, even though they can often be partially extracted through adversarial prompting.
Key Concepts
- Establishes persona, tone, and behavioral rules for an LLM conversation
- Sent once and persists across all subsequent conversational turns
- Given higher instruction-following priority than user messages by most models
- Distinct message role from user and assistant turns in chat APIs
- Commonly used to define output formats, safety constraints, and available tools
- Not a hard security boundary — vulnerable to prompt injection in some cases
- Central lever in production prompt engineering and iteration
- Can encode business logic treated as sensitive by application developers
Use Cases
Frequently Asked Questions
From the Blog
Prompt Engineering for Beginners: A Practical Guide
A comprehensive guide to prompt engineering for beginners: a practical guide — written for learners at every level.
Read More AI & TechnologyPrompt Engineering: Get Better Results from Any LLM
The difference between a mediocre AI output and an excellent one is usually the prompt. This guide covers the techniques that consistently produce better results: clarity, context, examples, chain-of-thought, system prompts, and output formatting — with real before/after examples.
Read More