Skip to main content
The system prompt guides the model’s behavior throughout its interactions with users. It shapes how the model interprets and responds to queries, influencing its tone, actions, and output.

System prompts vs. user prompts

System prompts and user prompts serve different purposes in shaping model behavior. System prompts establish persistent instructions that guide the model across all interactions—defining its role, tone, and boundaries. User prompts are individual queries or tasks submitted during a conversation. Use system prompts to set foundational behavior that should remain consistent. Use user prompts for specific, one-time requests. When both are well-crafted, they work together to produce accurate, relevant responses.

The CARE framework

When crafting a system prompt, use the CARE framework to ensure you’ve covered the essential components: Not every prompt requires all four components, but reviewing each helps identify gaps that could lead to unclear or unhelpful responses.

System prompt best practices

The following practices help you write system prompts that produce consistent, useful responses.
Define the Role
Clearly specify what the model is expected to do in its interactions. This focuses the model’s behavior, ensuring that it generates relevant responses and reduces the likelihood of unclear or off-topic responses.
Set the Tone and Style
Choose a tone that matches the context—technical, conversational, or professional—so the model’s replies align with audience expectations.
Clarify Output Format
Specify how the model should present its responses. Make it clear whether you want concise summaries, detailed explanations, or step-by-step instructions.
Set Constraints and Boundaries
Constraints and boundaries both limit model behavior, but they serve different purposes:
  • Boundaries define topics or content the model should avoid entirely. Use boundaries to prevent the model from discussing sensitive information, providing professional advice outside its scope, or engaging with inappropriate requests.
  • Constraints define requirements for how the model responds. Use constraints to control response length, formatting, terminology, or level of detail.
Provide Examples
When you need consistent formatting or a specific style, include an example of the preferred output in your system prompt. Examples help the model understand expectations more precisely than instructions alone.

Without an example:
With an example:
Use Delimiters
Delimiters help separate different parts of your prompt, making it easier for the model to distinguish instructions from reference content or examples. Common delimiters include ###, ---, and """.

Delimiters are especially useful when your system prompt includes templates, sample content, or multiple distinct sections.
Account for Ambiguous Situations
Provide clear fallback instructions for handling unclear or incomplete input. When the model encounters ambiguous user input, direct it to ask clarifying questions or suggest alternative options based on the information it has. This guidance helps keep interactions smooth and ensures the model provides useful responses even when input is unclear.
Guide Tool Usage
If the model has access to tools, such as Python tools, MCP servers, or plugins in Agent Studio, the system prompt is the primary way to control when and how the model uses them. Include guidance on:
  • When to use each tool: Which tool to reach for in which situation, especially when multiple tools could apply.
  • Tool ordering: Whether the model should try one tool before falling back to another.
  • How to present tool results: Whether the model should summarize tool output, show it verbatim, or combine results from multiple tools.
  • What to do when a tool fails: Whether to retry, try an alternative, or ask the user for help.

Iterative refinement

Effective system prompts rarely emerge fully formed. Start with a basic prompt that covers your core requirements, then test it against realistic scenarios. Refine based on the results. When your prompt produces unexpected results, use the following guidance to identify and address the problem: Small, targeted adjustments typically yield better results than rewriting prompts from scratch.

Documenting your prompts

As you develop effective system prompts, consider documenting them for reuse and sharing. A consistent format makes prompts easier to maintain and adapt.

Examples

The following system prompt is for a data analyst with access to a database query tool and a Jupyter notebook tool. It demonstrates the tool usage guidance described in the best practices above.
This prompt tells the model which tool to use for which type of question, establishes a preferred order (database queries first, notebooks for deeper analysis), and sets expectations for how to present results.
The following system prompt incorporates the best practices outlined above for a model without tools.