[Multi-Agent Privacy] Integrate privacy into the RAG pipeline#339
Open
JCHAVEROT wants to merge 20 commits into
Open
[Multi-Agent Privacy] Integrate privacy into the RAG pipeline#339JCHAVEROT wants to merge 20 commits into
JCHAVEROT wants to merge 20 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR completes the “post-cloud” half of the multi-agent privacy pipeline and integrates it into the RAG flow, so that (when enabled) retrieval outputs are sanitized/gated before an answer is generated, then the answer is advisorially verified and a PII-free report record is returned alongside the final response.
Changes:
- Extends the privacy graph beyond the HITL gate with new answer, verifier, and report stages (and wires the new routing).
- Integrates the privacy graph into the RAG pipeline as an optional replacement for the normal answer step, surfacing
privacy_reportandprivacy_warningsin outputs. - Adds supporting config/schema, reporting utilities, and DSPy JSON parsing tolerance improvements.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/mmore/run_rag.py | Adds --privacy flag support, builds/loads privacy graph, and exposes privacy fields in JSON/API output. |
| src/mmore/rag/pipeline.py | Adds optional privacy_graph path that replaces the answer step and surfaces privacy report/warnings. |
| src/mmore/privacy/verification.py | Introduces verifier verdict/warning dataclasses + summary helpers. |
| src/mmore/privacy/runner.py | Adds config validation and a single-query runner that drives the compiled privacy graph. |
| src/mmore/privacy/report.py | Defines the PII-free ReportRecord schema and related enums. |
| src/mmore/privacy/report_builder.py | Builds/serializes the final report record from final graph state. |
| src/mmore/privacy/pipeline.py | Wires answer/verifier/report nodes into the LangGraph pipeline and updates routing. |
| src/mmore/privacy/escalation.py | Ensures detection-engine switching also resets per-engine default params. |
| src/mmore/privacy/dspy_llm.py | Adds a tolerant JSON adapter for small/local model formatting issues. |
| src/mmore/privacy/config.py | Adds verifier/answer config types and new enums; adjusts leakage adversary defaults. |
| src/mmore/privacy/answer.py | Adds post-gate answer model that uses sanitized context only and records model identity. |
| src/mmore/privacy/agents/verifier.py | Adds post-cloud advisory verifier agent (residual leakage + faithfulness checks). |
| src/mmore/privacy/agents/state.py | Extends shared privacy graph state to include answer/verifier/report metadata. |
| src/mmore/privacy/agents/analyzer.py | Switches DSPy adapter usage to the new tolerant JSON adapter. |
| src/mmore/privacy/agents/adversary.py | Tweaks adversary probe instructions wording. |
| src/mmore/privacy/agents/init.py | Exports the new verifier agent. |
| src/mmore/cli.py | Adds --privacy option to the mmore rag CLI command. |
| examples/rag/privacy.yaml | Adds an example privacy config including answer + verifier sections. |
| docs/source/index.md | Adds privacy mode doc page to the docs index. |
| docs/source/core_features/privacy_mode.md | Documents privacy mode pipeline, configuration, and report schema. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
JCHAVEROT
force-pushed
the
feat/adversarial-agent
branch
from
June 30, 2026 17:15
c742d63 to
107ec76
Compare
JCHAVEROT
force-pushed
the
feat/privacy-mode
branch
2 times, most recently
from
July 3, 2026 14:30
ba0acc3 to
b303356
Compare
JCHAVEROT
force-pushed
the
feat/adversarial-agent
branch
from
July 8, 2026 08:35
a872863 to
9d83368
Compare
JCHAVEROT
force-pushed
the
feat/privacy-mode
branch
from
July 8, 2026 08:37
15d3722 to
0b72c20
Compare
JCHAVEROT
force-pushed
the
feat/privacy-mode
branch
3 times, most recently
from
July 8, 2026 15:16
3e2f842 to
d969b64
Compare
JCHAVEROT
force-pushed
the
feat/adversarial-agent
branch
2 times, most recently
from
July 13, 2026 09:52
201382c to
4d7562a
Compare
JCHAVEROT
force-pushed
the
feat/privacy-mode
branch
from
July 13, 2026 10:38
273be6f to
24c240a
Compare
JCHAVEROT
force-pushed
the
feat/adversarial-agent
branch
from
July 17, 2026 15:08
4d7562a to
ebcf59d
Compare
JCHAVEROT
force-pushed
the
feat/privacy-mode
branch
from
July 17, 2026 15:47
e95b2b0 to
2f6f8c7
Compare
JCHAVEROT
force-pushed
the
feat/adversarial-agent
branch
from
July 21, 2026 16:46
fe55399 to
c5fa763
Compare
…on_exhaustion, more user-friendly privacy.yaml
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
JCHAVEROT
force-pushed
the
feat/privacy-mode
branch
from
July 21, 2026 17:45
e11c54a to
aef505f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Related issue: #295
Subsequent to: #338
The privacy pipeline stopped at the gate, never producing the answer, checking it, or recording it. This PR adds the post-cloud half: after the gate approves, the answer model answers from the sanitized context alone, a verifier agent checks for residual leakage and unfaithful claims, and every request ends with a short PII-free record.
The chain is now:
Changes
AnswerModel(answer.py): answers from the sanitized context only, never the raw chunks; records the backend and model usedAdvisoryVerifierAgent(agents/verifier.py): reads the full context plus the answer, runs the configured leakage and faithfulness checks, warns when confidence clears the threshold; never re-runs detection or cleaningreport.py) and builder (report_builder.py) to give context to the userpipeline.py): added answer, verifier, and report nodes, routing the proceed, reject, and abort paths through the reportrag/pipeline.py,run_rag.py): the privacy graph replaces the answer step and surfaces the report and warning summary alongside the answerconfig.py): addedVerifierCheckenum,VerifierConfig, andCloudLLMConfigdspy_llm.py): tolerant parsing for small local models that have trouble with formatsDemo with RAG CLI
Note that adversarial agent is turned off here, but it works also fine with (just a bit longer)
CleanShot.2026-07-17.at.16.11.15-compressed.mp4