Technical Guide | Healthcare AI Agent Security

Patient Portal Messages as Prompt Injection Vectors in Healthcare AI Agent Workflows

A patient portal message becomes an indirect prompt injection vector when an AI agent reads patient-authored text or attachments in the same context as system instructions, clinical data, and tool access.

Why portal messages are a trust boundary problem

The model cannot reliably separate data from instructions. Text written by a patient, or contained in an attachment, sits in the same context as the instructions the agent is meant to follow, the clinical data it can read, and the tools it can call.

For this reason, patient portal messages should be treated as an untrusted-input boundary for any AI agent that processes them.

Mapping the attack path from ingestion to data exposure

The path from portal message to impact has four stages. Mapping each one for your own deployment shows where an injected instruction could travel, and where it can be stopped.

  1. Untrusted inputPatient-authored text and attachments enter the agent's context.
  2. Privileged contextSystem instructions, clinical data, and tool definitions share that context.
  3. Tool executionEHR, scheduling, routing, and reply tools act on the model's output.
  4. Runtime containmentScoped identity, policy checks, approvals, and audit logs bound the impact.

Containing impact when injection succeeds

Because the model cannot be relied on to tell data from instructions, the dependable defense is containment at runtime. The layers are:

  • A scoped agent identity for the portal agent.
  • Least-privilege permissions for the tools and data the agent can reach.
  • Policy checks on every tool call before it executes.
  • Output controls on what the agent can return or send.
  • Audit logging of the activity around each message.

Tradeoffs and limits

Detection helps but cannot be the only layer. Containment limits what a compromised agent can do even when an injected instruction is not caught.

Where runtime governance fits

Runtime governance is where these containment controls are applied: scoped identity, tool-call policy, approval steps, and audit logging, evaluated outside the model's own output.

Evaluation questions for a portal agent deployment

  • Which tools and data stores can the agent reach when it processes an inbound message, and are those permissions scoped to the task?
  • Does the agent run under its own scoped identity, or does it inherit broader service-account or user privileges?
  • Is every tool call evaluated against policy at runtime, independent of the model's output, before it executes?
  • Which actions, such as sending replies, changing routing, or writing to the EHR, require human approval?
  • Do audit logs capture the inbound message, requested tool calls, policy decisions, and data returned in enough detail to reconstruct an incident?

Review your portal agent's blast radius

Talk through agent identity, tool-call policy, approval steps, and audit logging for your healthcare AI agent workflows.

Talk to an Expert