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.
| Source | Answers the question |
|---|---|
| CloudTrail | Who called which AI API, when and from where |
| Model invocation logging | What was sent to the model and what it returned |
| Guardrail trace and metrics | Which policies blocked or masked content |
| AgentCore Observability | Which 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.

AI audit sources
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.
Protecting AI logs
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.
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.
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.