System Prompt
Instructions given to a language model that set its behavior, persona, constraints, and capabilities for an entire conversation, separate from user messages.
Purpose
System prompts define the AI's role ('You are a helpful medical assistant'), set behavioral constraints ('Never provide financial advice'), specify output format ('Respond in JSON'), and provide context (company information, available tools).
Best Practices
Be specific and explicit about desired behavior. Define what the model should and shouldn't do. Include examples of ideal responses. Specify edge case handling. Keep instructions organized with clear sections.
Security Considerations
System prompts can be extracted through prompt injection attacks. Don't put secrets in system prompts. Use defense-in-depth: validate outputs, rate-limit, and don't rely solely on prompt instructions for safety.