Lewati ke konten utama
Halaman ini belum tersedia dalam bahasa Anda, atau terjemahannya sedang menunggu tinjauan teknis. Teks asli dalam bahasa Inggris ditampilkan di bawah. Buka halaman berbahasa Inggris

Blueprint: The Healthcare AI Companion

Fail-Closed PHI Protection for Medical Agents​

Healthcare agents processing patient data must ensure that Protected Health Information (PHI) is never exposed to unapproved model providers. The Gateway scans before forwarding and deterministically denies the request when a configured mask rule matches. When the workflow must continue, the Python SDK masks matching spans in place on Claude Code or Gemini CLI and lets the redacted call proceed.

Architecture​

1. Master Policy Definition​

Enable PHI scanning. On this Gateway surface, a configured mask match is enforced as a denial.

{
"name": "hipaa-compliance-policy",
"priority": 9000,
"rules": [
{
"id": "medical-pii-masking",
"effect": "allow",
"principals": ["agent:nurse-companion"],
"actions": ["llm:generate"],
"resources": ["*"]
}
],
"content_policy": {
"enable_pii_detection": true,
"pii_action": "mask",
"blocked_patterns": ["\\b[A-Z]{2}\\d{6}[A-Z]\\b"]
}
}

2. Implementation​

LangChain Implementation​

from langchain_openai import ChatOpenAI
from langchain.schema import HumanMessage
import os

# Configure the LLM to use the Control Zero Gateway
llm = ChatOpenAI(
model="gpt-5.4-mini",
base_url="http://cz-gateway:8001/v1",
api_key="cz_live_healthcare_key", # Managed key in secure secret storage
default_headers={
"X-ControlZero-Project-ID": "health-prod-01",
"X-ControlZero-User-Role": "nurse"
}
)

def process_transcript(transcript: str):
# The Gateway scans the content and denies the request if the
# configured mask rule matches; it does not forward rewritten content.
messages = [
HumanMessage(content=f"Summarize this patient interaction: {transcript}")
]

try:
response = llm.invoke(messages)
return response.content
except Exception as e:
return f"Compliance Block: {e}"

# Scenario: Transcript containing sensitive patient data
raw_transcript = "Patient Jane Doe (SSN: 123-45-6789) is showing signs of respiratory distress."
summary = process_transcript(raw_transcript)

# RESULT: Expect a DLP denial and do not call the model. To continue with
# redacted content, mask it through the supported Python SDK path first.
print(f"Safe Summary: {summary}")

3. Validation Checklist​

  • DLP Verification: Send a test payload with an SSN and verify that the Gateway denies the request.
  • Provider Logs: Inspect OpenAI/Anthropic logs (if accessible) to confirm they never received raw PHI.
  • Local Storage: Ensure your own application logs contain no raw PHI.