PlainID integrates with modern AI application frameworks to enforce centralized, fine-grained Policy decisions across agent workflows, retrieval-augmented generation (RAG) pipelines, tool execution, and response generation. Both human users and AI agents operate within clearly defined authorization boundaries.
By embedding guardrails at key execution points, organizations can control prompt validation, data retrieval, tool invocation, and response exposure without implementing custom security logic inside the application. You manage Policies centrally in the Platform, and the SDK enforces them inside the agent's own workflow.
Available Packages
PlainID provides the following packages:
- Core (
core-plainid): the pure Python library that the framework packages build on. Call it directly from any Python application. - LangChain (
langchain-plainid): enforces Policy in LangChain agents and chains. - LangGraph (
langgraph-plainid): enforces Policy in LangGraph workflows. - Microsoft Agent Framework (
maf-plainid): enforces Policy in Microsoft Agent Framework (MAF) agents and workflows.
How SDK Enforcement Works
Each request carries a request context that identifies who is acting. In agentic scenarios, the context holds two identities: the initiating identity, such as the user, and the AI agent acting on the user's behalf as an additional identity. The SDK sends both to the PlainID Policy Decision Point (PDP), so your Policies evaluate the user and the agent together. An agent never inherits the user's full access.
The framework packages read the request context from the framework's own state, such as the agent session in Microsoft Agent Framework, and delegate to the same Core components underneath. Guardrails behave the same way in every framework.
Guardrails at Each Execution Point
| Execution point | Guardrail | What it does |
|---|---|---|
| Before the agent runs | Prompt categorization | Classifies the user's message against the categories your Policies allow. If a category isn't allowed, the SDK blocks the request before the agent runs. |
| During retrieval | Retrieval filtering | Filters the documents a RAG pipeline retrieves, so the agent sees only the content the user-agent combination may read. |
| During tool execution | SQL authorization | Sends the agent's SQL query to the PlainID SQL Authorizer, which rewrites it according to your row and column Policies. |
| Before the response | Anonymization | Detects personally identifiable information (PII) in text and masks or encrypts it, based on your Policies. |
For the Policy side of each guardrail, see Input and Response Guardrails and Data and RAG.
Installation
Install the package for your framework. Core installs automatically as a dependency:
pip install langchain-plainid
pip install langgraph-plainid
pip install maf-plainid
Some guardrails need optional extras, such as LLM-based or zero-shot categorization, retrieval, and anonymization. Each package's page lists its extras.
The framework packages require Core 3.x: use langchain-plainid 3.0.0, langgraph-plainid 3.0.0, and maf-plainid 2.0.0 or later.
When to Use an SDK
| If you want to | Use |
|---|---|
| Enforce guardrails inside the agent's workflow, on prompts, retrieval, or responses | Integration via SDKs |
| Protect agents that reach data directly, without passing through a gateway | Integration via SDKs |
| Enforce Policy without changing agent code | Integration via Gateways |
Many organizations use both: a gateway for traffic that crosses it, and an SDK for what happens inside the agent.