Python: Add Purview Middleware - #1142
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds Microsoft Purview integration to the Python Agent Framework, enabling data security and governance policy evaluation on conversational AI content. The implementation provides middleware that can block prompts or responses based on centrally managed Purview policies.
Key changes:
- Complete Purview middleware integration with authentication, API clients, and content processing capabilities
- Comprehensive model system using Pydantic for Microsoft Graph API interactions and policy evaluation
- Full test coverage with extensive unit tests for all components and integration scenarios
Reviewed Changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| python/samples/getting_started/purview_agent/ | Sample application demonstrating Purview middleware usage with Azure OpenAI |
| python/packages/purview/tests/ | Comprehensive test suite covering all middleware components and edge cases |
| python/packages/purview/pyproject.toml | Package configuration with dependencies and development tools |
| python/packages/purview/agent_framework_purview/ | Core implementation including models, client, processor, middleware, and settings |
| python/packages/purview/README.md | Documentation with usage examples and configuration guidance |
| python/packages/purview/LICENSE | MIT license for the package |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
eavanvalkenburg
left a comment
There was a problem hiding this comment.
I'm no expert on the back and forth to and from Purview, so I haven't looked deeply at that. Overall I think the structure can be simplified, in python we tend to prefer less files even if they are longer, also the models folder is a concern, because even though it appears empty (because of the empty all) it will still be indexed by our api docs tooling. So please fix that. I also wonder about Agent vs ChatMiddleware for this, but it could even be both...
@microsoft-github-policy-service agree company="Microsoft" |
337acdd to
5687104
Compare
e2bbd9d to
458ac54
Compare
|
@eavanvalkenburg Could you have a look. |
6d225c7 to
4e4fc90
Compare
6988296 to
aed9cf0
Compare
2f75be9 to
5af8391
Compare
* [Py Purview] Purview Python Initial Commit * [Py Purview] Purview Python Minor Fixes * [Py Purview] Purview Python Comment Fixesish * [Py Purview] Purview Python Agent Middleware Done * [Py Purview] Purview Python Agent Middleware Done * [Py Purview] Purview Python Lint Errors * [Py Purview] Purview Python Final Hopefully * [Py Purview] Purview Python Final Hopefully * [Py Purview] Purview Python Fix ReadMe * [Py Purview] Purview Python Fix MyPy * [Py Purview] Purview Python Minor Updates on comments * [Py Purview] Purview Python Fix Build Error --------- Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
* [Py Purview] Purview Python Initial Commit * [Py Purview] Purview Python Minor Fixes * [Py Purview] Purview Python Comment Fixesish * [Py Purview] Purview Python Agent Middleware Done * [Py Purview] Purview Python Agent Middleware Done * [Py Purview] Purview Python Lint Errors * [Py Purview] Purview Python Final Hopefully * [Py Purview] Purview Python Final Hopefully * [Py Purview] Purview Python Fix ReadMe * [Py Purview] Purview Python Fix MyPy * [Py Purview] Purview Python Minor Updates on comments * [Py Purview] Purview Python Fix Build Error --------- Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
Motivation and Context
Description
Adds Python Purview Middleware which adds Purview policy evaluation to the Microsoft Agent Framework. It lets you enforce data security / governance policies on both the prompt (user input + conversation history) and the model response before they proceed further in your workflow.
All changes are additive—no breaking changes to existing packages.
Follow-Up Opportunities
Contribution Checklist