Approval agent
Approval agent evaluates every new commit on a pull request against policy files in the repository. Rules match changed paths and authors, including GitHub teams, and can send the change to LLM classifiers that rate its risk against criteria you write. When every requirement passes, Inspect submits a GitHub approval. Anything else goes to human review. Organization policies can add requirements that every repository must meet.
Requirements
- The organization switch Automated approvals is on in Settings → Approval agent. Changing it, and Timing, requires the Manage code review role or Admin.
- The repository's default branch has a valid policy bundle under
.inspect/approvals/. A repository without one is never evaluated. - The pull request's head branch is in the same repository. Pull requests from forks are not evaluated.
- Organization policies require the Manage PR approval policies role or Admin. Organization policies are rolling out and may not be available in your organization yet.
Set up a repository
Once Automated approvals is on, run the /configure-approvals skill in a session for the repository. Inspect asks what policy you want, writes or updates the files under .inspect/approvals/ while keeping existing rules, and validates them. Merge the result to the default branch; Approval agent reads policy only from there.
Timing chooses between On every commit and On every commit, after review agent, the default. The second waits for Review agent to finish before evaluating.
Policy bundle
.inspect/approvals/path_rules.yamlholdsrulesthat cover changed files, and an optionaldefaultfor files no rule matches..inspect/approvals/classifiers/<name>.yamlholds one named classifier per file.<name>is what rules target asclassifier:<name>..inspect/approvals/repo_rules.yamlholds repository-wide settings: the ownership gate, a classifier for every pull request, and shadow mode.
Each file is limited to 128 KiB, and all classifier files together to 128 KiB. Classifier files can end in .yaml or .yml. Duplicate YAML keys are rejected, and only true and false parse as booleans (yes and on are strings).
Path rules
Every changed file must be covered by a rule or by default before Inspect can approve.
# .inspect/approvals/path_rules.yaml
default:
action: classify
targets: [classifier:change-risk]
rationale: Evaluate changes not covered by a specific rule.
rules:
- paths: ['docs/**']
action: allow_bot_approval
rationale: Documentation-only changes are safe to approve.
- paths: ['migrations/**', 'security/**']
action: deny
rationale: These changes always need human review.
- name: Dependency bumps
paths: ['package.json', 'bun.lock']
authors: ['@dependabot[bot]']
action: classify
targets:
- target: classifier:change-risk
threshold: no_risk
rationale: Bot dependency bumps must be rated no risk.| Field | Type | Required | Default | Description |
|---|---|---|---|---|
paths | string[] | Yes | 1 to 100 case-sensitive, repository-relative globs. ** crosses directories. No leading '/', '..', or backslashes. | |
excluded_paths | string[] | No | Up to 100 globs that stop a file from matching. | |
paths_match | 'any' | 'all' | No | any | any: a file matches when any pattern matches it. all: every pattern must match the same file. |
authors | string[] | No | Everyone | '*', '@user', '@app[bot]', or '@org/team'. Quote each. '*' cannot be combined with other authors. |
excluded_authors | string[] | No | Authors the rule skips, in the same form. | |
action | 'allow_bot_approval' | 'deny' | 'classify' | Yes | allow_bot_approval also accepts its older name, allow. | |
targets | array | No | Required with classify. Classifiers to run, as classifier:<name> or {target: classifier:<name>, threshold: <tier>} to override that classifier's threshold. | |
rationale | string | Yes | Why the rule exists, shown on the pull request. Up to 2,000 characters. | |
name | string | No | Shown on the pull request instead of the rationale. Up to 200 characters. |
default takes action, targets, and rationale and applies only to files no rule matches. A file can have at most 200 rules.
Overlapping rules accumulate. An allow_bot_approval rule does not cancel a matching deny or classifier; it only lets Approval agent approve those files. Required human reviews in GitHub branch protection still apply separately.
Classifiers
A classifier describes risk tiers in your own words. Inspect sends the whole pull request diff to it and approves only when the rating is at or below the threshold.
# .inspect/approvals/classifiers/change-risk.yaml
threshold: low
risk_tiers:
major: Authentication, authorization, or privileged access changes.
medium: User-visible production behavior changes.
low: Bounded internal changes with limited operational impact.
no_risk: Documentation, comments, and formatting only.threshold is no_risk, low, medium, or major. risk_tiers needs at least one of those four keys, each up to 10,000 characters. Classifier names are lowercase, start with a letter, use letters, digits, -, or _, and are at most 64 characters.
Repository rules
# .inspect/approvals/repo_rules.yaml
gates:
author_ownership: true
classifier:
threshold: medium
risk_tiers:
major: Changes that could cause data loss or a security incident.
medium: Changes to production behavior.
shadow_mode: false| Field | Type | Description |
|---|---|---|
gates.author_ownership | boolean | true requires human review unless the author is a CODEOWNER of every changed file. Inspect reads CODEOWNERS at the base commit. |
classifier | object | A classifier that runs on every pull request. Prefer named classifiers, which path rules apply only where needed. |
shadow_mode | boolean | true runs evaluations and posts results, marked as shadow evaluations, but never submits a GitHub approval. Use it to trial a policy. |
How evaluation works
- A new commit starts an evaluation of that revision. A newer commit supersedes it.
- Gates run first. If the ownership gate fails, no classifiers run.
- Organization and repository rules are matched against the changed files and author. Any matching
deny, or any uncovered file, sends the pull request to human review. - Each classifier that a matching rule targets rates the diff. Every one must be at or below its threshold.
- If everything passes, Inspect submits or updates its GitHub approval. A later rejection can dismiss an earlier approval.
Inspect posts a result comment on the pull request: ✅ Approved, 🧮 Requires human approval with the reason, or ⚠️ Evaluation failed. To evaluate again without a push, comment /inspectapprove on the pull request. Only people with write or admin access can trigger it.
Organization policies
Organization policies add requirements on top of each repository's policy. A repository policy cannot loosen them, and they never approve on their own: the repository's policy still has to approve the pull request.
Manage them in Settings → Approval agent under Organization policies. Create policy offers three starts: describe what to enforce and let Inspect write it, start from a template, or Write a policy from scratch. Each policy has:
- A Name, up to 64 characters, shown in the list and on pull requests.
- A scope: All repositories, Only these repositories, or All repositories except these, listing up to 500 repositories.
- One YAML document in the policy format, up to 128 KiB. The editor validates it as you type and shows each problem under its line.
An organization can have up to 50 policies. A saved change applies to evaluations that start afterward. If any organization policy is added, edited, or deleted while an evaluation runs, that evaluation does not approve; push a new commit or comment /inspectapprove to evaluate against the current policies. Deleting a policy stops new checks against it; earlier evaluations keep the version they used.
Each saved change to a policy's document creates a new version; renaming does not. Version history lists every version with who saved it and when. Restore this version loads a version into the editor, and saving it creates a new version.
Try a policy on pull requests
Try on pull requests in the editor takes up to 10 pull request links, one per line, and shows what the policy you are editing would require of each. It matches every rule against the changed files and author and checks the ownership gate against the repository's CODEOWNERS. It does not run classifiers; it lists the ones that would decide and the threshold each must meet.
Policy format
An organization policy document has up to three top-level keys, all optional: gates, rules, and classifiers. Unknown keys are rejected.
# Require the author to own every changed file in CODEOWNERS.
gates:
author_ownership: true
rules:
# No paths: applies to every pull request.
- name: General risk
action: classify
targets: [classifier:general]
rationale: Every change gets a general risk check.
# Changes here always need a human.
- name: CI and deploy configuration
paths: ['.github/workflows/**', 'infra/**']
action: deny
rationale: CI and deploy changes always need human review.
# Changes here must pass the security classifier.
- name: Authentication
paths: ['**/auth/**', '**/permissions/**']
action: classify
targets: [classifier:security]
rationale: Authentication changes need a security classification.
classifiers:
general:
threshold: low
risk_tiers:
major: Weakens authentication, authorization, or secret handling.
low: Bounded changes that keep existing security controls.
security:
threshold: low
risk_tiers:
major: Weakens authentication, authorization, or secret handling.
medium: Changes who can reach existing sensitive data or actions.
low: Bounded changes that keep existing security controls.
no_risk: Comments, tests, and formatting only.gates
| Field | Type | Description |
|---|---|---|
author_ownership | boolean | true requires human review unless the author is a CODEOWNER of every changed file. |
Gates apply to every pull request in the policy's scope. When one fails, no classifiers run.
rules
Up to 200 rules. Each matches changed files and, optionally, authors.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | No | Shown on pull requests. Up to 200 characters. | |
paths | string[] | No | Up to 100 case-sensitive, repository-relative globs. ** crosses directories. Leave out to match every pull request. | |
excluded_paths | string[] | No | Up to 100 globs that stop a file from matching, even when paths match it. | |
paths_match | 'any' | 'all' | No | any | any: a file matches when at least one pattern matches it. all: every pattern must match the same file. |
authors | string[] | No | Everyone | '*', '@octocat', '@dependabot[bot]', or '@acme/platform'. Quote each. |
excluded_authors | string[] | No | Authors the rule skips, in the same form. | |
action | 'deny' | 'classify' | Yes | allow is not accepted, because organization policies cannot approve changes. | |
targets | string[] | No | Required with classify. Classifiers to run, like [classifier:security]. Each must be defined under classifiers. Not accepted with deny. | |
rationale | string | Yes | Why the rule exists, shown on pull requests. Up to 2,000 characters. |
A rule without paths still honors excluded_paths, authors, and excluded_authors, so it can apply to every pull request except some files or authors.
If a deny rule matches any changed file, the pull request goes to human review, even when a repository rule would allow it. If a classify rule matches, every classifier in targets must rate the change at or below its threshold. Organization rules do not have to cover every changed file. A file no organization rule matches gets no organization requirement, and the repository's policy must still cover it.
classifiers
Up to 200 classifiers, which run only when a classify rule names them in targets. Each key is the classifier's name: lowercase, starting with a letter, using letters, digits, -, or _, up to 64 characters.
| Field | Type | Description |
|---|---|---|
threshold | 'no_risk' | 'low' | 'medium' | 'major' | The highest risk that can still be approved. |
risk_tiers | object | What each level means for this classifier. Set at least one of major, medium, low, and no_risk, each up to 10,000 characters. |
The classifier compares the pull request's diff with these descriptions, so describe the risk you care about rather than specific files.
Troubleshooting
A file under .inspect/approvals/ on the default branch failed validation, so the pull request is
not auto-approved. Run /configure-approvals to fix it.
A changed file matches no rule. Add a rule or a default.
Inspect could not read the files from GitHub. Comment /inspectapprove to retry.
An organization deny rule matched. The change needs human review.
The author does not own every changed file in CODEOWNERS, or the repository has no CODEOWNERS
file.
Automated approvals is off, the default branch has no .inspect/approvals/ bundle, or the pull
request comes from a fork.
Policy is read from the default branch. Merge the fix there, then push a new commit or comment
/inspectapprove.
shadow_mode: true is set in repo_rules.yaml. Remove it to let Approval agent approve.