All posts

Keeping ReAct PHI-Compliant

Many assume that simply encrypting data at rest is enough to make a ReAct application PHI‑compliant, but compliance requires far more than storage encryption. ReAct, the popular framework for building conversational AI agents, often runs inside a microservice that calls external APIs, accesses databases, and streams user‑provided content. When a user shares protected health information (PHI), the application must treat that data as a regulated asset throughout its entire lifecycle: ingestion, p

Free White Paper

ReAct PHI-Compliant: The Complete Guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free. No spam. Unsubscribe anytime.

Many assume that simply encrypting data at rest is enough to make a ReAct application PHI‑compliant, but compliance requires far more than storage encryption.

ReAct, the popular framework for building conversational AI agents, often runs inside a microservice that calls external APIs, accesses databases, and streams user‑provided content. When a user shares protected health information (PHI), the application must treat that data as a regulated asset throughout its entire lifecycle: ingestion, processing, storage, and transmission. Failure to control any of those stages can trigger a breach under HIPAA rules, resulting in fines, reputational damage, and loss of trust.

Typical deployments rely on developers to embed access checks directly into code, to sprinkle logging statements, or to depend on cloud‑provider encryption. Those approaches have three critical gaps:

  • Inconsistent enforcement. A developer may forget to mask a field in one response, leaving PHI exposed in logs or UI screens.
  • Lack of real‑time audit. Without a central point that records every request and response, auditors cannot prove who accessed which piece of PHI and when.
  • Broad standing credentials. Services often use long‑lived service accounts that can read or write any patient record, violating the principle of least privilege.

Why phi compliance matters for ReAct

PHI is defined by its association with an individual’s health, payment, or care. Regulations require that any system handling PHI implement:

  1. Identity‑driven access control that ties every action to a specific user or service.
  2. Audit trails that capture the full request‑response exchange, including any data transformations.
  3. Data minimization techniques such as inline masking to ensure only the necessary portions of PHI are visible to a given consumer.

ReAct agents, by design, forward user prompts to language models and then return generated text. If the model is allowed to see raw PHI, or if the response leaks identifiers, the compliance chain is broken. The challenge is to enforce these controls without rewriting the entire application stack.

The missing enforcement layer

Most teams implement setup controls, OIDC or SAML authentication, role‑based access policies, and service‑account provisioning. Those steps decide who may start a session, but they do not enforce what happens once the request reaches the backend service. The enforcement must happen in the data path, where the actual traffic flows.

When the data path lacks a gatekeeper, two problems arise:

  • Commands that could exfiltrate PHI run unchecked.
  • Responses containing full patient records travel back to the client unfiltered.

Both issues are exactly what PHI regulations aim to prevent. The solution is a transparent proxy that sits between the identity layer and the target resource, inspecting each protocol message before it is allowed through.

How hoop.dev provides the needed controls

hoop.dev is an open‑source Layer 7 gateway that positions itself in the data path for ReAct‑backed services. It does not replace authentication; it consumes the OIDC token produced by the identity provider and then applies policy checks on every request.

Setup – identity and least‑privilege grants

Teams configure OIDC or SAML providers (Okta, Azure AD, Google Workspace) so that each user receives a short‑lived token containing group membership. hoop.dev verifies that token and maps groups to fine‑grained permissions, ensuring that only authorized roles can invoke a particular ReAct endpoint.

Continue reading? Get the full guide.

ReAct PHI-Compliant: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

The data path – hoop.dev as the only enforcement point

All traffic from the client to the ReAct service routes through hoop.dev. Because the gateway terminates the protocol (HTTP, gRPC, or WebSocket) it can inspect the payload before it reaches the application code. This placement guarantees that no request bypasses policy evaluation.

Enforcement outcomes – what hoop.dev does

  • hoop.dev masks PHI fields in responses in real time, so identifiers never appear in client‑side logs.
  • hoop.dev records each request and response, creating an audit trail that auditors can filter by user, timestamp, or data element.
  • hoop.dev requires just‑in‑time approval for high‑risk operations, such as bulk export of patient records, and blocks disallowed commands before they execute.
  • hoop.dev never exposes the underlying service credentials to the client; the gateway holds them securely and rotates them as needed.

Because the enforcement outcomes are tied directly to the gateway, removing hoop.dev would instantly eliminate masking, audit, and approval capabilities. The setup alone, identity tokens and role bindings, does not provide those guarantees.

Practical steps to adopt hoop.dev for PHI

1. Deploy the gateway using the official getting‑started guide. The deployment runs as a Docker Compose stack or in Kubernetes, placing the agent close to the ReAct service.

2. Register the ReAct endpoint as a connection in hoop.dev, supplying the service URL and the credential that the gateway will use.

3. Define masking policies that redact patient identifiers, dates of birth, and any other PHI elements from outbound responses.

4. Configure just‑in‑time approval workflows for operations that involve bulk data access. Approvers receive a concise request summary and can grant or deny access with a single click.

5. Enable session recording. The generated logs can be streamed to an immutable store for long‑term retention, satisfying audit‑trail requirements.

All of these actions are performed through configuration files and the web UI; no code changes to the ReAct application are required.

FAQ

Does hoop.dev replace my existing identity provider?

No. hoop.dev acts as a relying party. It validates the token issued by your IdP and then enforces additional policies on the data path.

Can I use hoop.dev with an on‑premise ReAct deployment?

Yes. The gateway runs wherever you can reach the ReAct service, including on‑premise networks, private clouds, or edge locations.

How long are session logs retained?

Retention is configured by the downstream storage you choose. hoop.dev simply streams the logs; you decide the retention period to meet your PHI retention policy.

For a deeper dive into configuration options and policy language, explore the hoop.dev learning center.

Ready to see the code in action? Visit the GitHub repository and start building a PHI‑compliant ReAct service today.

Open source

Save the open-source gateway for agent data access

Hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.

Star and save the repo →More posts