Lesson 1 of 3 Prompt Management and Governance

Managing Prompts as Versioned Resources with Bedrock Prompt Management

This lesson explains how Amazon Bedrock Prompt Management stores prompts as managed, versioned resources that applications invoke directly, instead of prompts embedded in application code.

Learning outcomes

After completing this lesson, you will be able to:

  • Define prompts with variables and variants.
  • Distinguish drafts from immutable versions.
  • Invoke managed prompts by version ARN.

Prompts, variables and variants

A prompt in Amazon Bedrock Prompt Management is more than its text. It contains a template, either a single text prompt or a chat template with a system prompt and messages; variables, written as {{variable_name}}, that are filled in at run time; the model to use; the inference parameters; and, optionally, a tool configuration. Keeping all of these together means that the wording and the model it was tuned for cannot drift apart.

Variants are alternative versions of a prompt, for example with different wording or different models. In the console, variants can be run side by side on the same inputs and their outputs compared, which helps a team choose between them before running a full evaluation.

Drafts and immutable versions

Each prompt has a working draft that authors can edit and test freely. Creating a version takes an immutable snapshot of the draft with its own ARN; the version can never change afterwards.

Applications reference a specific version, never the draft, so editing the draft cannot change production behaviour. Promoting a change means creating a new version, evaluating it and then updating the reference that production uses, for example a value in AWS AppConfig, after review. Earlier versions remain available, so rolling back means pointing the reference at the previous version, and auditors can see exactly which prompt was in use at any time.

The following diagram shows how production stays on an immutable version.

Drafts and immutable versions in Prompt Management. Authors edit the draft freely; creating a version takes an immutable snapshot with its own ARN. Production reads the version named in a reference such as an AppConfig value, so editing the draft never changes production, and rolling back means pointing the reference at an earlier version.
The version numbers are illustrative.
True or false

Drafts and versions

Exam skills 1.6.3

Check four claims about prompt drafts and versions in Prompt Management.

Log in to try this activity Interactive activities are free with an account.

Invoking managed prompts

Applications use a managed prompt by passing the prompt version's ARN as the modelId in a Converse, ConverseStream, InvokeModel or InvokeModelWithResponseStream request, and supplying values for the template's variables in promptVariables. Bedrock fills in the template and calls the model with the inference parameters configured in the prompt.

Because the model, parameters and wording travel together in one governed resource, application code contains no prompt text and no model ID; changing either is a matter of releasing a new prompt version. Managed prompts can also be used in Bedrock Flows prompt nodes and by agents, so the same approved prompt serves several kinds of application, as the following example shows.

r = brt.converse(
    modelId="arn:aws:bedrock:us-east-1:111122223333:prompt/PROMPT12345:3",   # version 3 of the prompt
    promptVariables={
        "customer_tier": {"text": "gold"},
        "ticket": {"text": ticket_text},
    },
)

The following table summarises Prompt Management concepts.

ConceptPurpose
Template with {{variables}}Reusable, parameterised prompt
VariantsCompare wording or models side by side
DraftEditable working copy for testing
VersionImmutable snapshot with its own ARN, used in production
Prompt ARN as modelIdInvoke the managed prompt through Converse or InvokeModel

The following diagram shows a managed prompt being invoked.

Invoking a managed prompt. The application passes the prompt version ARN as the modelId and supplies promptVariables; Bedrock fills in the template and calls the model with the inference parameters stored in the prompt. Application code holds no prompt text and no model ID.
The same ARN works with ConverseStream, InvokeModel and InvokeModelWithResponseStream.
Scenario questions

Calling a managed prompt

Exam skills 1.6.3 · 1.6.1

Practise using Prompt Management prompts from applications.

Log in to try this activity Interactive activities are free with an account.
Worked example

Centralising prompts

A company has 40 prompts scattered across Lambda functions. Changing a prompt requires a code deployment, and nobody can say which wording is in production.

Moving the prompts to Prompt Management with variables for the dynamic parts, creating versions for the production wording, and having functions invoke the version ARN through Converse with promptVariables, separates prompt changes from code deployments and gives a clear record of the production version.

Check yourself

Why should production reference a prompt version ARN rather than the draft?

Show answer

Versions are immutable, so production behaviour does not change when someone edits the draft.

Exam Tips

Remember for the exam

  • Variables use {{name}} and are filled with promptVariables at run time.
  • Versions are immutable; production should reference a version ARN.
  • Pass the prompt ARN as modelId in Converse or InvokeModel.
  • Compare wording or models with prompt variants.