Loading…
Gates retrieval and external API calls that touch regulated records — restricted subjects never leave the boundary.
For: Teams running RAG or external API calls over regulated customer data
Blocks retrieval or action on a customer marked restricted.
Restrains a retrieval whose declared purpose is not on the approved list.
Escalates any call that would send regulated fields to a host outside the boundary.
# LangChain Regulated-Data RAG Gate
# Fork: set approved_purposes and boundary_hosts for your environment.
apiVersion: decionis.dev/v1
kind: PolicyPack
metadata:
name: langchain-regulated-data-rag-gate
surface: langchain
workflow_key: regulated_retrieval
standards: [HIPAA-164.312, SOC2-CC6.1, ISO27001-A.5.34]
defaults:
mode: shadow
emit_dossier: true
approved_purposes: [care_coordination, billing_support, member_service]
boundary_hosts: ["internal.records.local"]
rules:
- name: restricted_subject_block
when: "tool in ['retrieve', 'lookup_customer']"
decision: |
BLOCK IF subject.restricted == true
ALLOW OTHERWISE
reason_code: restricted_subject
- name: purpose_limitation_check
when: "tool == 'retrieve'"
decision: |
RESTRAIN IF request.purpose not in approved_purposes
ALLOW OTHERWISE
reason_code: purpose_not_approved
- name: external_egress_escalation
when: "tool_call.egress_host != null"
decision: |
ESCALATE IF payload.contains_regulated_fields == true AND tool_call.egress_host not in boundary_hosts
ALLOW OTHERWISE
reason_code: regulated_data_leaving_boundary
Fork it, change the thresholds to match your environment, and deploy in shadow mode first — it defaults to listen-only so nothing in your live pipeline changes.
Wraps any LangChain BaseTool. The LLM still picks the tool on the same prompt; Decionis decides if the call fires.
# pip install decionis-langchain
from decionis import DecionisClient
from decionis_langchain import DecionisGateTool
client = DecionisClient(api_key="...", base_url="https://api.decionis.com")
gated_refund = DecionisGateTool.wrap(
inner_tool=send_refund,
client=client,
tenant_id="org-uuid",
workflow_key="refund_execution",
shadow_mode=True, # ← every verdict recorded; inner tool always runs
site_base_url="https://decionis.com",
)
agent.bind_tools([gated_refund])