How to Keep PHI Out of Amazon Bedrock Agents Memory and Trace Logs
Treat every place a Bedrock agent can write data as a possible PHI store. Map those surfaces, set retention, encryption and access controls on each, and redact PHI in the execution path before it reaches memory or traces. Then keep audit evidence as decision records that describe what was enforced without containing the PHI itself.
Implementation sequence
- Inventory every surface that can store data: session attributes, memory, traces, invocation logs, CloudWatch Logs and S3 destinations.
- Disable or shorten retention on any surface the use case does not need, and turn off content logging and tracing where they are not justified.
- Apply KMS encryption, explicit log retention and least-privilege access policies to every remaining store.
- Place redaction or blocking at each point of the invocation path: user input, action group request and response, knowledge base retrieval, final response.
- Define the evidence record fields so they exclude PHI, and store them separately from operational logs.
- Test with synthetic PHI and inspect memory, traces and log sinks to confirm nothing sensitive persisted.
Why this is a persistence problem, not only a prompt problem
The HIPAA Security Rule sets national standards for electronic protected health information that a covered entity or business associate creates, receives, uses or maintains. The word that matters for agents is maintains. Any store that holds ePHI falls within the organization's compliance scope, whether or not it was designed as a controlled PHI store. Counsel should confirm how that applies to your deployment.
Agents make this harder than a single model call. A user can type PHI into a prompt. An action group Lambda function, an API or a knowledge base can return PHI the user never typed. Both can then flow into session attributes, session summary memory, traces and model invocation logs, and from there into CloudWatch Logs and S3 destinations. Retention, access scope, encryption and minimum-necessary handling are often unclear for each of these stores.
The useful way to work is by persistence surface rather than by product feature. For each surface, ask what is written, who can read it, how long it lives, and where in the invocation path PHI can still be removed.
Persistence surfaces and the decision each one requires
Use this table as a starting inventory. Fill in the actual contents, retention and readers for your own deployment rather than assuming defaults.
- Session attributes and prompt session attributes: Application-supplied state. Decide what the application is allowed to place here, and strip PHI before it is set.
- Session summary memory: Derived content that can carry PHI forward between interactions. Decide whether memory is needed at all, and set retention to the shortest workable period.
- Orchestration, pre-processing and post-processing traces: Returned when tracing is enabled and can contain prompts, tool inputs and tool outputs. Decide who receives traces and where they are stored.
- Model invocation logs: Prompt and response content sent to a log destination. Decide whether content logging is justified and who can read it.
- CloudWatch Logs and S3 destinations: Downstream sinks. Apply KMS encryption, log retention, access policies and lifecycle rules.
Where redaction has to happen in the invocation path
Redaction is only useful if it happens before the write. A filter applied after PHI has reached memory or a trace reduces exposure for later readers but does not undo the stored copy.
Walk the invocation in order. At user input, PHI can enter the prompt and any session attributes derived from it. At the action group request, the model may place PHI into tool parameters. At the action group response, a Lambda function or API can return records far richer than the question required. At knowledge base retrieval, passages can include PHI from source documents. At the final response, the agent can repeat any of the above to the user and into the stored trail.
Each point is a separate decision. A control that evaluates user input does not by default protect the action group response, and the reverse also holds. Map every control you rely on to the points it evaluates, and treat any point left unevaluated as a gap to close. Returning only the fields a tool call needs also supports the minimum necessary principle, so tighten tool outputs at the source where you own the code.
Native controls as the baseline, and where gaps remain
Start with what AWS provides. Configure memory retention to the shortest period the use case allows, or leave memory off where it is not needed. Decide deliberately whether tracing is enabled outside development, and whether model invocation logging captures content. Encrypt log destinations with KMS keys you control, set log retention explicitly, and scope access policies to the few roles that need to read them. Bedrock Guardrails sensitive information filters can detect and mask or block categories of sensitive data in the content they evaluate.
These controls are necessary, and they leave questions you must answer yourself. Storage settings govern how long and how securely data is kept, not what the data contains. Content filters act on the content passed to them at the points where they are applied. Tool inputs and outputs, retrieved passages and session attributes are separate paths, and a gap on any one can put PHI into a store that the other controls only encrypt and retain. Encryption and access policies limit who can read a stored copy. They do not reduce the amount of PHI stored.
Runtime enforcement in the execution path
A complementary layer is policy enforcement in the execution path. Trussed enforces policy at runtime, not after the fact, on individual interactions and tool calls. It applies allow, redact or block decisions to prompts, tool calls and responses, so PHI can be removed before it is written to memory or a trace. Scope matters: this is per-interaction and per-tool-call enforcement, not end-to-end tracing of agentic workflows.
The same enforcement produces audit-ready evidence. This addresses a real design tension. Operational logs exist to debug behavior and often contain raw content. Audit evidence exists to show what a control decided. If the evidence record copies the content it evaluated, it becomes another PHI repository. A sound record carries the decision (allow, redact or block), the policy that applied, a timestamp, the surface or tool call involved, and a reference that does not contain the PHI.
Trussed runs in production with healthcare and pharma organizations and deploys self-managed in the customer cloud, with configurable retention and data residency. Evidence is mapped to HIPAA, including audit controls under 164.312(b).
Audit controls without a new PHI repository
The Security Rule's technical safeguards at 45 CFR 164.312 include audit controls at 164.312(b). Subpart C also requires procedures to regularly review records of information system activity, such as audit logs, access reports and security incident tracking reports. That review depends on records that exist and can be read, so the records themselves need access control and defined retention.
The practical consequence is a separation of stores. Keep raw operational logs short-lived, encrypted and narrowly readable, ideally with content logging off in production. Keep audit evidence in its own store, built from decision records that contain no PHI, so reviewers can read it broadly without widening PHI exposure.
A proposed rule published in January 2025 would amend the Security Rule. As of November 2026 it should be treated as a proposal and not as a requirement.
PHI persistence surfaces in a Bedrock agent deployment
Session state
Session attributes and prompt session attributes
Session memory
Session summary memory carried between interactions
Traces
Pre-processing, orchestration and post-processing traces
Invocation logs
Model invocation logs sent to CloudWatch Logs or S3
Evidence
Audit records that describe decisions without storing PHI
See how enforcement and evidence work on agent and tool calls
Review how allow, redact and block decisions are enforced in the execution path and how the resulting evidence stays free of PHI.
See How Evidence Is Produced