Lesson 2 of 3 Prompt Management and Governance

Governing Prompts with Approvals and Audit Trails

This lesson describes how to govern prompts as controlled assets in regulated or large organisations, with reviewed changes and records of who changed what and which prompt produced a response.

Learning outcomes

After completing this lesson, you will be able to:

  • Design prompt approval workflows.
  • Keep template repositories in S3 and Git.
  • Audit prompt changes and usage with CloudTrail and invocation logs.

Approval workflows

Prompts change application behaviour as much as code does, so in regulated or customer-facing applications they need the same controls. A prompt approval workflow treats prompt changes like code changes: authors edit drafts and run evaluations, a reviewer approves the change, and only then is a version created or promoted to production.

The workflow can be implemented with an AWS CodePipeline manual approval action placed after automated evaluation stages, so reviewers see the evaluation results before deciding, or with AWS Step Functions and a task token that pauses the workflow until an approver records a decision. IAM policies restrict who can create prompt versions and who can update the production reference, separating authors from approvers, and AWS CloudTrail records each of these actions for audit.

The following diagram shows the stages of a prompt approval workflow.

A prompt approval workflow. Authors edit the draft, automated evaluation runs first, a reviewer approves in a CodePipeline manual approval action with the evaluation results in view, and only then is a version created and promoted to production.
Reviewers decide with the evaluation results in front of them.
Put in order

A prompt approval workflow

Exam skills 1.6.3

Put the steps of a governed prompt change in order.

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

Template repositories in S3 and Git

Some organisations keep the source of truth for prompt templates outside Prompt Management, in a repository that existing review processes already cover. An Amazon S3 bucket with versioning keeps every revision of every template, and S3 Object Lock can make revisions immutable for a retention period. A Git repository brings pull request reviews, comments and a full change history.

In either case, a pipeline publishes approved templates to Prompt Management or to application configuration, so that production never reads unreviewed text. For audit, S3 server access logs or CloudTrail data events record who read or wrote each template, and Git history records who changed it and who approved the change.

The following diagram matches each of the auditor's questions to its evidence.

Answering an auditor's questions about one misleading answer. The application log gives the request ID and prompt version ARN, the model invocation log shows the rendered prompt and response, CloudTrail shows who created the prompt version, and the pipeline's approval record shows who approved it.
Without invocation logging, the prompt content could not be reconstructed.

Auditing changes and usage

AWS CloudTrail records Prompt Management API calls such as CreatePrompt, UpdatePrompt, CreatePromptVersion and DeletePrompt, with the caller identity, time and source, which answers "who changed this prompt?". CloudTrail does not record prompt or response content.

Amazon Bedrock model invocation logging records the full request and response for each invocation to CloudWatch Logs or S3, including the rendered prompt, which answers "what was sent and returned?". Applications should also log the prompt version ARN, request ID and user identity, so a response can be traced to the exact prompt version. Log groups with restricted access and KMS encryption protect these records. The following table summarises which source answers which audit question.

Audit questionSource
Who created or changed a prompt version?CloudTrail management events
What exact prompt and response were exchanged?Model invocation logs in CloudWatch Logs or S3
Which prompt version produced this response?Application logs with prompt version ARN and request ID
Who approved the change?Pipeline approval or Step Functions execution history
Sort into groups

Which log answers it?

Exam skills 1.6.3 · 3.3.4

Decide which source answers each audit question.

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

An auditor's request

An auditor asks which prompt produced a misleading answer given to a customer on 3 March, who approved that prompt and what exactly the model received.

The application log gives the request ID and prompt version ARN; the model invocation log for that request shows the rendered prompt and response; CloudTrail shows who created that prompt version; and the pipeline's approval record shows who approved it. Without invocation logging, the content could not be reconstructed, because CloudTrail does not store it.

Check yourself

Why log the prompt version ARN with every request?

Show answer

So that each output can be traced to the exact prompt version that produced it.

Exam Tips

Remember for the exam

  • Who changed a prompt: CloudTrail. What was sent and returned: invocation logs.
  • Log the prompt version ARN with every request.
  • Separate prompt authors from approvers with IAM and pipeline approvals.
  • S3 versioning or Git keeps every template revision.