Lesson 4 of 4 Securing and Governing AI Workloads

Building Audit Trails for AI Workloads

This lesson explains which records capture AI activity, how to centralise and protect them, and how they are used for audit, compliance and quality.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish what CloudTrail, model invocation logging, guardrail traces and AgentCore Observability record.
  • Explain how to collect AI logs consistently across accounts and protect them.
  • Describe how the records support audit and compliance investigations.

What records what

AWS CloudTrail records Bedrock and AgentCore API calls: who invoked which model, created or changed a guardrail, knowledge base or agent, and from where. It does not record prompt and response content. Model invocation logging records the full request, response and metadata of each model call to CloudWatch Logs or S3 (large payloads go to S3). Guardrail traces show which policies intervened. AgentCore Observability records traces of agent sessions: each reasoning step, model call and tool invocation with its inputs, outputs, latency and errors.

The following table summarises the sources.

SourceAnswers the question
CloudTrailWho called which AI API, when and from where
Model invocation loggingWhat was sent to the model and what it returned
Guardrail trace and metricsWhich policies blocked or masked content
AgentCore ObservabilityWhich steps and tool calls an agent made, and how long they took

The following diagram shows three sources of records for an AI workload and where their records are kept.

The records of an AI workload. CloudTrail records who called which Bedrock or AgentCore API but not the prompt or response content. Model invocation logging records the full request and response of each model call, and AgentCore Observability records traces of agent sessions. All three are delivered to the log archive account, encrypted and protected with Object Lock.
Answering what a model said needs invocation logs; CloudTrail alone shows only that a call was made.
Match the pairs

AI audit sources

Exam skills 2.4.3 · 2.3.2

Match each audit question with the record that answers it.

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

Centralising and protecting AI logs

Model invocation logging is configured per account and Region, so it belongs in the account baseline deployed by StackSets or Control Tower customisations, with delivery to a bucket in the log archive account, encrypted with a KMS key, protected with S3 Object Lock and retained for the regulatory period. Because prompts and responses can contain personal data, access to the logs is restricted, and guardrails can mask sensitive data before it is logged. CloudTrail organisation trails and Amazon Security Lake bring the API activity into the same central security data.

Select all that apply

Protecting AI logs

Exam skills 2.4.3 · 2.3.2

Identify how to centralise and protect AI invocation logs.

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

Using the records

  • Audit: reconstruct an interaction from invocation logs and agent traces, linked by request and session IDs.
  • Compliance monitoring: alarms on guardrail interventions and on calls to unapproved models.
  • Quality: sample logged interactions for evaluation data sets.
  • Cost: token metrics and tagged inference profiles attribute usage to teams.
Worked example

Answering a regulator

A regulator asks a bank to show what its mortgage assistant told a customer eight months ago and whether it changed anything in the customer's records.

Because invocation logging and AgentCore Observability were part of the account baseline, the bank queries the log archive with Athena by session ID: the invocation logs show the prompts and answers, the agent traces show that the assistant called a read-only rates tool and an update tool, and CloudTrail shows which role the agent used.

Object Lock on the archive lets the bank show that the records have not been altered since they were written.

Check yourself

Does CloudTrail record the prompts sent to Bedrock models?

Show answer

No. CloudTrail records the API calls and who made them. Prompt and response content is recorded by model invocation logging, which must be enabled in each account and Region.

Exam Tips

Remember for the exam

  • Record prompts and responses: model invocation logging; CloudTrail records API calls, not content.
  • Reconstruct an agent's actions: AgentCore Observability traces.
  • Consistent AI logging everywhere: invocation logging in the account baseline, delivered to the log archive.
  • Tamper-resistant AI audit records: S3 Object Lock on the archive bucket.