All posts

What PHI Means for Function Calling

A newly hired data‑science contractor writes a function that forwards raw patient notes to a large‑language‑model API for summarization. The code runs in a CI pipeline, automatically invoking the function whenever a new file lands in a bucket. No one looks at the payload, no audit trail exists, and the raw notes contain protected health information (PHI). The organization now faces a compliance breach the moment the pipeline processes a single record. Why phi matters for function calling Regu

Free White Paper

Function Calling Security: The Complete Guide

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

Free. No spam. Unsubscribe anytime.

A newly hired data‑science contractor writes a function that forwards raw patient notes to a large‑language‑model API for summarization. The code runs in a CI pipeline, automatically invoking the function whenever a new file lands in a bucket. No one looks at the payload, no audit trail exists, and the raw notes contain protected health information (PHI). The organization now faces a compliance breach the moment the pipeline processes a single record.

Why phi matters for function calling

Regulators define phi as any individually identifiable health information that is created, received, stored, or transmitted by a covered entity. When phi travels through a function‑calling interface, it can be logged, cached, or inadvertently exposed in error messages. A breach can trigger hefty fines, loss of trust, and mandatory remediation. The risk is not theoretical; many teams treat function calls like ordinary API requests and rely solely on network firewalls or token scopes.

In practice, developers often grant a service account broad permissions, embed the account’s secret in CI scripts, and let the function call flow unchecked to the downstream model. The result is a blind spot: the identity system knows who can start the request, but nothing monitors what data actually moves across the wire.

The missing control plane

Identity and token provisioning (OIDC, SAML, service‑account roles) answer the question “who may invoke the function?” They do not answer “what data is being sent?” or “has the request been approved?” Without a data‑path enforcement layer, phi can be transmitted, stored, or logged without any real‑time protection. The setup alone cannot enforce inline masking, command‑level audit, or just‑in‑time approval.

hoop.dev as a data‑path gateway for function calls

hoop.dev provides the missing layer by sitting between the caller and the target function endpoint. It authenticates the user or service via OIDC/SAML, then inspects each request at the protocol level. Because hoop.dev is the only place the traffic passes, it can:

  • Mask phi fields in responses before they reach the caller.
  • Record every function‑call session for replay and audit.
  • Require a human approval step when a request contains phi or other high‑risk payloads.
  • Block commands that match a deny list, preventing accidental data exfiltration.

All of these outcomes exist because hoop.dev sits in the data path. The identity system merely decides who can start a request; hoop.dev enforces the policy, logs the interaction, and applies real‑time masking.

Practical steps to protect phi in function calling

1. Identify phi fields. Create a schema that lists the attributes that constitute phi (e.g., patient name, medical record number, diagnosis). This schema drives masking rules in hoop.dev.

2. Deploy hoop.dev near the function endpoint. Use the quick‑start guide to run the gateway as a Docker Compose service or in Kubernetes. The gateway holds the target credentials, so callers never see them.

Continue reading? Get the full guide.

Function Calling Security: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

3. Configure inline masking. In hoop.dev’s policy UI, map the phi schema to redaction patterns. When a response contains those fields, hoop.dev replaces them with placeholders before forwarding the data.

4. Enable just‑in‑time approval. Set a rule that any request whose payload matches the phi schema must be approved by an authorized reviewer. The approval workflow is logged and tied to the user’s identity.

5. Turn on session recording. hoop.dev automatically records the full request/response exchange. Auditors can replay the session to verify that phi was handled correctly.

6. Integrate with CI/CD. Point your CI jobs at the hoop.dev endpoint instead of the raw function URL. The pipeline inherits the same masking and approval controls without code changes.

These steps close the gap between “who can call” and “how phi is protected during the call.” For a deeper dive into deployment, see the getting‑started guide and the learn section for feature details.

FAQ

Can hoop.dev mask phi in real time?

Yes. hoop.dev inspects each response as it passes through the gateway and applies the configured redaction rules before the data reaches the caller.

Does hoop.dev store phi?

No. hoop.dev records session metadata and request/response hashes for audit purposes, but it does not retain the raw phi content. The masking step removes sensitive values before any log is persisted.

How does hoop.dev integrate with existing function‑calling frameworks?

Because hoop.dev works at the protocol layer, you simply point your client library or HTTP wrapper to the hoop.dev endpoint. No code changes are required; the gateway handles authentication, masking, and approval transparently.

Protecting phi in function calling is not an optional add‑on; it is a compliance imperative. By inserting hoop.dev into the data path, you gain the only place where phi can be inspected, masked, approved, and recorded, turning a blind spot into a controlled, auditable process.

Explore the open‑source repository on GitHub to get started.

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