A system prompt is a set of instructions given to an LLM that defines its role, behavior, constraints, and output format. It's separate from user messages and persists across the conversation.
System Prompt Components
- Role: Who the AI is (e.g., "You are a helpful assistant")
- Constraints: What it should/shouldn't do
- Format: How to structure responses
- Context: Background information
Best Practices
- Be specific and explicit
- Include safety constraints
- Define output format clearly
- Test with adversarial inputs
Can users override system prompts?
Prompt injection attacks attempt this. Use input validation, output monitoring, and guardrails to protect system prompt integrity.
Practical example
An assistant is configured to use approved sources and request review when evidence is absent.
What to check
Version instructions and test conflicts with user messages, retrieved text, and tool responses.
Limits and tradeoffs
A system prompt is a behavioral instruction, not a place to store secrets or enforce authorization.
Maintained by DriftRail. AI assisted the October 2026 content and template revision. Examples are illustrative; they are not measured product benchmarks. Suggest a correction.