Writing System Prompts with an Instruction Framework
This lesson explains an instruction framework, a standard way of writing the instructions that control an FM's behaviour, and how templates and guardrails complete it.
Learning outcomes
After completing this lesson, you will be able to:
- Write a system prompt with role, rules, format and boundaries.
- Use shared templates for consistency.
- Enforce what instructions cannot guarantee with guardrails.
Anatomy of a system prompt
The system prompt sets the context for the whole conversation and is passed separately from user messages (the system field in the Converse API). A complete system prompt defines the role ("You are a claims assistant for Example Insurance staff"), the task and audience, the rules (answer only from the provided documents, never give legal advice, ask for the policy number if it is missing), how to handle uncertainty ("If the documents do not contain the answer, say so"), the tone and the output format.
You are a claims assistant for Example Insurance adjusters.
Task: answer questions about policy coverage using only the documents in <documents>.
Rules:
- If the documents do not contain the answer, reply "Not found in the provided policies."
- Do not give legal advice or predict claim outcomes.
- Cite the document title for every statement.
Format: at most 120 words, then a "Sources:" line listing document titles.The following diagram shows the parts of a system prompt with an example of each.

Parts of a system prompt
Templates for consistency
When each developer writes prompts from scratch, the same application ends up with different wording, rules and output formats in different places, and an improvement made in one prompt never reaches the others. A prompt template fixes the structure of a prompt and leaves variables for the parts that change, such as the retrieved documents, the user's question and the customer's tier.
Templates ensure that every request includes the required rules and context, that format instructions are identical across applications, and that an improvement is made once and applied everywhere. Amazon Bedrock Prompt Management stores templates with variables written as {{variable}}, keeps immutable versions of them and lets applications invoke a specific version, so that approved role definitions and rules are enforced across teams rather than copied by hand.
The following diagram compares scattered copies of a persona prompt in five applications with one governed template.

Guardrails complete the framework
Instructions influence a model's behaviour but cannot guarantee it. Users can try to override them with prompt injection, and models occasionally ignore an instruction, especially in long or unusual conversations. A safety rule written only in the system prompt is therefore a request, not a control.
Amazon Bedrock Guardrails enforce responsible AI policies independently of the prompt. A guardrail evaluates both the user's input and the model's output and blocks denied topics, filters harmful content, masks or blocks personal information and checks that answers are grounded in the supplied sources, regardless of what the prompt says. A complete instruction framework therefore combines three layers: the system prompt defines behaviour and format, templates make it consistent, and guardrails enforce the rules that must never be broken. The following table summarises the layers.
| Layer | Controls | Guarantee |
|---|---|---|
| System prompt | Role, rules, tone, format | Strong influence, not enforcement |
| Prompt template (Prompt Management) | Consistent structure and variables across apps | Same instructions everywhere |
| Response format specification | Machine-readable output | Enforced when combined with schema validation |
| Guardrails | Topics, harmful content, PII, grounding | Policy enforcement on input and output |
Instructions and guardrails
Role definitions drifting
Five applications use the same customer-service persona, but each team edited its own copy of the system prompt. Some versions still allow discussing competitor products, which policy now forbids.
The fix has two parts: a single approved system prompt template in Prompt Management that all applications invoke by version ARN, and a guardrail with a denied topic for competitor products, so the policy holds even if a prompt is edited.
A system prompt says "never give medical advice". Is that enough to enforce the rule?
Show answer
No. Prompts influence behaviour, but guardrails enforce it, so use a denied topic in Bedrock Guardrails.
Exam Tips
Remember for the exam
- System prompt: role, task, rules, uncertainty handling, tone, format.
- Shared, versioned templates: Prompt Management.
- Prompts influence; guardrails enforce.