Comparison: HIPAA 164.312(b) audit controls

    LangChain Callbacks vs Proxy Enforcement for HIPAA Audit Controls: What Each Captures

    LangChain callbacks record events from inside application code. They can capture prompts, responses, and tool calls, but only where a team has instrumented the path, and they observe rather than enforce policy on PHI. Proxy enforcement sits in the execution path, so it can allow, redact, or block an interaction and record the decision as well as the event. For audit evidence, callbacks answer what the application reported. A proxy can also show what policy was applied. Most healthcare teams will find the two complementary, but callbacks alone do not show that PHI was controlled before it reached a model or tool.

    Evaluation criteria for audit-ready AI records

    • Does each record answer who, what, when, where, and how for interactions involving ePHI?
    • Does it show the policy decision and any redaction, or only the event?
    • Can an application team disable, bypass, or edit the logging path, and would that be detectable?
    • Can alteration of records be detected, for example by hashing, and who can disable auditing?
    • Do the records themselves contain ePHI, and how are they protected, retained, and kept in the required region?
    • How is coverage verified across all applications, chains, and models so uninstrumented paths are found?

    What 164.312(b) requires, and what it leaves open

    The audit controls standard at 45 CFR 164.312(b) requires a covered entity or business associate to implement hardware, software, and/or procedural mechanisms that record and examine activity in information systems that contain or use electronic protected health information. It is marked Required in the Security Rule implementation table, and it has no implementation specifications.

    HHS guidance states that the Security Rule does not identify what data audit controls must gather or how often audit reports must be reviewed. Each entity uses its risk analysis and organizational factors, such as its current technical infrastructure and the security capabilities of its hardware and software, to decide what is reasonable and appropriate. That means the field set for an LLM interaction record is your own documented determination, not an HHS requirement. HHS guidance does not address prompts, model responses, or tool calls specifically, so applying the standard to them is an interpretation.

    A practical checklist comes from the healthit.gov description of an audit log as retrospective documentation of who, what, when, where, and how ePHI was accessed. This page uses that framing to compare the two mechanisms. A January 2025 HHS proposed rule would amend the Security Rule, including a heading for audit trail and system log controls at 164.312(d)(1). As of November 2026 it should be treated as a proposal, not current law.

    What LangChain callback handlers capture, and where they stop

    Callback handlers are a legitimate application-level instrumentation tool. They run inside application code and can record events as a chain executes, such as the prompt sent to a model, the response returned, and the arguments and results of a tool call. They are close to the application's logic, so they can attach application context that an outside observer may not see, such as which chain or feature produced the request.

    Their boundaries follow from where they run. Coverage depends on how each team instruments each chain, so a new chain, a direct model call, or a custom tool that skips the handler produces no record. A handler registered in one service says nothing about another service. Because the handler lives in application code, the same team that ships the application can change, remove, or misconfigure it, and the log it writes is typically owned by the application. Without a separate control, an auditor cannot tell a missing record from an event that never happened.

    The larger limit is that callbacks observe and do not enforce. A handler can note that a prompt contained PHI. It does not stop that prompt from reaching a model or tool. The record shows the event after the exposure decision was already made by the code path, and it holds no policy decision because none was taken.

    What proxy enforcement captures, and its own limits

    A proxy in the execution path receives the interaction before it reaches the model or tool. It can apply policy at that point: allow the request, redact PHI, block it, or escalate it. Because the decision is made at the same place as the event, the record can hold both. It can show the request, which policy applied, what action was taken, what was redacted, the identity of the user or system involved, and the time. An auditor can verify that a control operated, not only that an event occurred.

    The evidence is also generated outside application code. Application teams do not own the enforcement point, so one team's instrumentation choices do not decide coverage, and a single policy can apply across multiple applications and models. That is a different integrity position from application-owned logs.

    A proxy has limits too. It sees only traffic that is routed through it, so network and configuration controls must prevent applications from calling models or tools directly. It observes interactions and tool calls, not the internal reasoning of application code, and this comparison is limited to individual interactions and tool calls. It does not claim end-to-end tracing of agentic workflows. Finally, a proxy that records full prompts creates its own store of ePHI, which needs protection and retention decisions.

    Side-by-side: what each approach records

    The table compares the audit-relevant elements for a single interaction or tool call. Which of these your record must contain is a risk-analysis decision.

    • Prompts and responses: Callbacks: recorded where the chain is instrumented. Proxy: recorded for every interaction routed through it, with redaction applied before storage if configured.
    • Tool calls: Callbacks: recorded for instrumented tools. Proxy: recorded when the tool call crosses the enforcement point.
    • Policy decisions: Callbacks: none, unless the application writes its own. Proxy: allow, redact, block, or escalate outcome recorded with the event.
    • Redaction actions: Callbacks: not performed by the handler. Proxy: the action and its scope can be recorded, showing PHI was handled before reaching the model.
    • Identity and timestamps: Callbacks: depend on what the application passes in and its clock. Proxy: identity and time captured at a single enforcement point.
    • Record integrity: Callbacks: application-owned and editable unless separately protected. Proxy: generated outside application code, so alteration can be detected if hashing or an equivalent control is applied.

    Complementary or insufficient on their own

    Callbacks alone are insufficient as audit evidence for PHI handling. They have value for debugging, quality review, and application context, but they leave gaps in coverage, depend on application-owned logs, and carry no policy decisions. A proxy alone is also incomplete if applications can bypass it or if you need application-level context that only the chain holds. Used together, the proxy provides the enforced, consistent record, and callbacks add application detail that can be correlated to it.

    One reference point for integrity comes from ONC certification guidance for health IT auditing. It expects the system to detect whether an audit log has been altered, including by activity outside its control, names hashing as one method (SHA-2 or stronger, per FIPS 180-4), and says disabling of auditing should be restricted to a limited set of users. That is a certification criterion, not a 164.312(b) mandate, but it is a useful lens for comparing application-owned logs with logs generated at a separate enforcement point.

    Trussed is one example of runtime enforcement. It enforces policy in the execution path, with allow, redact, block, rate limit, and escalate for human approval at the level of individual interactions and tool calls. It produces audit-ready evidence mapped to HIPAA, and it can be self-managed in the customer cloud with configurable retention and data residency. It runs in production with healthcare and pharma organizations.

    What each mechanism can show an auditor

    Callback handlers

    Application-level events from instrumented chains. Observe, do not enforce.

    Proxy enforcement

    Allow, redact, or block decisions made in the execution path, recorded with the event.

    Shared question

    Who, what, when, where, and how for each interaction involving ePHI.

    Review your audit evidence against runtime enforcement

    See how policy enforced in the execution path produces audit-ready evidence for PHI-handling AI workloads.

    Request a Demo