PR agent
The PR Agent is a data-aware pull request reviewer that analyzes PRs modifying data models, pipelines, or transformations. Unlike generic code reviewers, it uses Monte Carlo observability data — lineage, active alerts, asset importance, and monitor coverage — to assess the real production impact of code changes.
The PR Agent is part of the MC Prevent suite alongside the CI Agent and Code Change skill.
How it works
When a PR is opened or updated, the PR Agent runs a multi-step analysis:
-
Code risk factor extraction — Analyzes the PR diff to identify column-level changes (added, removed, renamed, modified), upstream reference changes, and potentially risky code patterns. Each finding gets a risk and confidence score.
-
Downstream impact analysis — Traces Monte Carlo lineage to identify which tables, BI reports, and downstream consumers would be affected by the changes.
-
Risk assessment — Assigns a risk tier (Low, Medium, or High) to each affected Monte Carlo asset based on:
- Breaking changes detected in the code
- Active Monte Carlo alerts on modified or upstream assets
- Downstream blast radius
- Write query volume on affected tables
- Monitor coverage gaps
-
PR comment — Posts a structured comment on the PR organized by change group — related changes are merged and sorted by risk and blast radius. Each group includes its own alert breakdown, diff links, and downstream counts. Key assets are marked with a star so your most important tables are impossible to miss. A thumbs-up/down reaction footer lets you give feedback on each review.
Risk scoring
The PR Agent produces an overall risk score using configurable weight categories:
| Category | Default weight | What it measures |
|---|---|---|
| Code review findings | 40% | Risky code patterns, breaking changes, schema modifications |
| Lineage blast radius | 15% | Number and importance of downstream assets affected |
| Open alerts | 15% | Active Monte Carlo alerts on assets in the change's path |
| Monitoring gaps | 15% | Unmonitored assets in the blast radius |
| Schema/contract changes | 10% | Breaking schema changes or interface contract violations |
| Asset criticality | 5% | Business importance score of affected assets |
Review types
| Review type | What's included | Cost |
|---|---|---|
| Free review | Risk score and high-level summary on every PR | No charge |
| Full review | Specific risky code sections, detailed recommendations, auto-generated SQL validation queries, and coverage gap suggestions | Charged |
Accessing the PR Agent
Automatic trigger
The PR Agent triggers automatically when a PR is opened in a GitHub repository that is in your allowlist. Configure which repos are enabled in Settings > Integrations > GitHub.
The PR Agent requires the
pr_agentfeature flag to be enabled on your account. Existing GitHub integration customers need to reauthenticate to use this feature.
Manual trigger
Comment mc review on any PR in an enabled repo to trigger the agent manually.
Configuration
Configure the PR Agent in Settings > AI Agents:
- Unrestricted — Full reviews on all PRs in enabled repos
- Free-only — Free reviews only (risk score and summary, no detailed findings)
Validation notebooks
When the PR Agent detects dbt SQL changes, it can automatically generate a SQL Notebook containing targeted validation queries to verify the change behaved as intended. These queries cover null checks, distribution analysis, before/after row counts, and other verifications specific to the columns and logic modified in the PR.
CI Agent integration
The PR Agent's risk assessment feeds into the CI Agent, which can enforce merge gating based on the risk score. The CI Agent is available as a GitHub Action (monte-carlo-data/mc-prevent-action) or CircleCI orb (monte-carlo-data/mc-prevent-orb).
Gate policy options:
| Policy | Behavior |
|---|---|
low+ | Block all PRs with any risk |
medium+ | Block medium and high risk (default) |
high+ | Block only high-risk PRs |
none | Show results without blocking |
Teams can add the mc-override label to bypass the gate for a specific PR.
Security & data privacy
The PR Agent reads code diffs from GitHub and correlates them with Monte Carlo metadata (lineage, alerts, monitor coverage). It does not access the actual data in your tables. For more detail on security and data privacy, see the AI Features and Technical Information documentation.
