The agent-framework-purview package allows you to enforce Microsoft Purview (Microsoft Graph dataSecurityAndGovernance) policies on both the prompt (user input + history) and the model response. This enables Data Loss Prevention (DLP) and governance by blocking or allowing content based on centrally managed policies.
Key Capabilities:
- Ingress Protection: Blocks sensitive content before it reaches the LLM.
- Egress Protection: Blocks disallowed model output before it leaves the system.
- Middleware Integration: Works with any
Agent or orchestration using the standard middleware pipeline. - Audit & Governance: Logs AI interactions for Audit, Communication Compliance, and Insider Risk Management.
Status: Preview
import asyncio
from agent_framework import Agent, Message
from agent_framework.openai import OpenAIChatCompletionClient
from agent_framework.microsoft import PurviewPolicyMiddleware, PurviewSettings
from azure.identity import InteractiveBrowserCredential
async def main():
client = OpenAIChatCompletionClient()
purview_middleware = PurviewPolicyMiddleware(
credential=InteractiveBrowserCredential(),
settings=PurviewSettings(app_name="My Sample App")
)
agent = Agent(
client=client,
instructions="You are a helpful assistant.",
middleware=[purview_middleware]
)
response = await agent.run(Message("user", ["Summarize zero trust in one sentence."]))
print(response)
asyncio.run(main())