AI Agent Allowlist
Home Page-Types Database Agent Guardrails 2026 Incidents API Docs Pricing
Resources
Use Cases (15) Industries & Buyers (12) Learn: Core Concepts (12) Implementation Guides (15) Comparisons (8) Schema & Data Reference (6) FAQ Glossary
Why It Matters
2026 Agent Incidents Category Targeting Database Refreshes Contact Customer Login
Download Free Sample
the same discipline you use for infrastructure, applied to agents

AI Agent Policy as Code

Write each agent's rules in a file. Review it like code, test it in your pipeline, and enforce it before every request the agent sends.

This page shows the file format, the workflow and the tests, using an AI agent allow list for the web rules.

1File per agent
7Web policy fields
3Possible verdicts
5Workflow stages
Why code

Problems that policy documents cannot solve

Most agent rules today live in a document or a prompt. Both fail in the same predictable ways.

Infrastructure teams solved the same problem years ago. Firewall rules and cloud permissions moved from tickets into files, and mistakes dropped because every change was reviewed and tested.

Documents drift

The policy says one thing. The agent's configuration says another.

Nobody notices until an incident.

Prompts are suggestions

"Never sign up for anything" is text the model may ignore.

Injected content can override it.

Reviews are memory

Who approved this agent's access, and when?

Without history, nobody can answer.

Code fixes all three

The file is the configuration, the history is in version control, and the enforcer reads the same file.

The format

One agent, one policy file

Plain JSON, so any language can read it. YAML works too when your enforcer supports it.

Keep files small. A good agent policy fits on one screen, so a reviewer can hold the whole thing in mind.

{ "agent": "vendor-research", "owner": "procurement-lead", "tier": 3, "review_by": "2026-12-31", "web": { "allow_page_types": ["pricing", "documentation", "about", "legal", "security", "status"], "deny_page_types": ["careers"], "allow_domains": ["supplier.example"], "deny_domains": ["competitor.example"], "unclassified": "deny", "on_deny": "ask_owner", "exceptions": [ { "page_type": "checkout", "domain": "supplier.example", "expires": "2027-03-31", "requires_approval": true } ] } }
FieldMeaningGood default
agent, ownerWho the file is for, and who answers for itAlways set both
tierHow much the agent may do alone, 1 to 4Be honest; most real agents are 3 or 4
review_byDate the policy must be reviewed again90 days out
allow_page_typesRead page types this agent may openOnly what its purpose needs
deny_page_typesExtra read types to blockEmpty unless there is a reason
allow_domains, deny_domainsDomain-level overridesShort lists only
unclassifiedWhat happens to pages nobody classifieddeny for tiers 3 and 4
on_denyBlock, or route to the owner for approvalask_owner for tier 3, block for tier 4
exceptionsOne page type, one domain, an end dateAs few as possible
Evaluation order

How a request is judged against the file

The enforcer applies five steps in a fixed order. Knowing the order makes every verdict easy to explain.

1

Baseline first

High-risk hosts, verified page types, URL rules and default-deny for unknown writes. Every agent gets these.

2

Denied domains

If the domain is on deny_domains, the request is denied whatever else is true.

3

Exceptions

A baseline denial can be lifted by a matching, unexpired exception, with or without owner approval.

4

Owner routing

With on_deny set to ask_owner, other denials become approval requests. High-risk hosts never do.

5

Agent tightening

Read pages outside allow_page_types, types in deny_page_types, and unclassified pages under "deny" are blocked.

The file can only open narrow exceptions. It cannot switch off the baseline for high-risk hosts. That protects against a careless edit.

The order also makes verdicts predictable. Given the same file and the same URL, every enforcer returns the same answer.

Workflow

From pull request to enforcement

1. ProposeThe owner edits the file in a branch.
2. ValidateCI checks format, dates and page types.
3. TestCI runs known URLs and compares verdicts.
4. ApproveSecurity reviews the diff and merges.
5. DeployThe enforcer loads the new file.

Diffs are readable

"checkout exception added for supplier.example until March" is one line in a review.

History is free

Version control records who changed what, and who approved it.

Rollback is instant

A bad change is reverted like any other commit.

Validation

What to check before a policy is merged

Errors that block the merge

  • Unknown page type names
  • A type both allowed and denied
  • An action type on the allow list
  • Invalid unclassified or on_deny values
  • Exceptions without a domain

Warnings that need a reply

  • No owner
  • No or overdue review date
  • Exceptions without an end date
  • Expired exceptions still in the file
  • Tier 3 or 4 agents allowing unclassified pages
# in CI, using the free Agent Egress Guard pip install https://www.aiagentallowlist.com/egress-guard/agent_egress_guard-0.2.0-py3-none-any.whl for f in policies/*.json; do agent-egress-guard policy validate "$f"; done
Testing

Golden tests: known URLs, expected verdicts

Keep a small list of URLs per agent with the verdict you expect. Run it on every change.

When a real denial surprises someone, add that URL to the list. The test suite grows from real experience.

# policies/vendor-research.tests (one test per line: METHOD URL EXPECTED) GET https://vendor.example/pricing allow GET https://vendor.example/start-trial approval_required POST https://vendor.example/login approval_required GET http://169.254.169.254/latest/ deny GET https://unknown-site.example/page deny

Test the allows

A policy that blocks everything is safe and useless. Prove the agent can still do its job.

Test the denials

At least one URL per action type the agent could meet.

Test the exceptions

Inside the exception's domain, and just outside it.

Test the tricks

Encoded paths and numeric IP forms of blocked hosts.

Enforcement

Three places the same file runs

In the agent

AgentPolicy.load("policy.json").check(Guard(), url) before each fetch.

At the proxy

An intercepting proxy loads the file for the agent's identity and checks every request.

In your gateway

The format is plain JSON. Apply the same five-step order in any language.

40M+Domains with page types
28Page types
~40URL rules
~60High-risk hosts
Patterns

Five policy patterns that work

Purpose-shaped allow list

List only the read types the agent's purpose needs. A pricing monitor needs pricing, not blog.

Deny by default for autonomy

Tier 4 agents deny unclassified pages. Add domains as they prove necessary.

Narrow, dated exceptions

One type, one domain, an end date. Renewal forces a second look.

Owner in the loop

Tier 3 agents send denials to their owner instead of silently failing.

Shared baseline, small files

Keep the risky-host and rule layers central. Agent files only hold what differs.

Anti-patterns

Five patterns to avoid

Domain allow lists only

Allowing a domain also allows its signup and checkout pages.

One policy for all agents

It ends up as permissive as the most demanding agent.

Exceptions without end dates

Temporary access becomes permanent by default.

Policy in the prompt

The model reads it; nothing enforces it.

No tests

A typo in a page type name silently changes behaviour.

Compared

Agent policy files vs general policy engines

QuestionAgent policy fileGeneral-purpose policy engine
Who can read it?Anyone: plain fieldsEngineers who know the policy language
Knows page types?Yes, built inOnly if you feed it the data
FlexibilityFixed fields, fixed orderAnything you can express
Review effortLowHigher
Best forWeb access per agentComplex rules across many systems

Many teams use both. A general engine decides cross-system rules, and calls the page-type lookup when a rule depends on what a URL is.

Start with agent policy files. Move to a general engine only when rules start depending on other systems, such as ticket status or time of day.

Getting started

Your first week of policy as code

1

Day 1: generate a file per agent

Use the policy builder or agent-egress-guard policy init.

2

Day 2: put them in a repository

One folder, one file per agent, owners as code reviewers.

3

Day 3: add validation to CI

Fail the build on errors, comment on warnings.

4

Day 4: add golden tests

Five to ten URLs per agent, with expected verdicts.

5

Day 5: enforce in log-only mode

Record verdicts for a week, then switch to blocking.

A change, start to finish

How one exception moves through the workflow

The procurement team wants its research agent to place small orders with one supplier.

Monday: the request

The agent owner opens a pull request adding a checkout exception for supplier.example, ending in March, owner approval per order.

Monday: automatic checks

Validation passes. The golden tests are updated: checkout on supplier.example now expects approval_required, checkout elsewhere still expects deny.

Tuesday: review

Security reads a six-line diff, asks for a lower spend limit in the purchasing system, and approves.

Tuesday: deploy

The enforcer reloads the file. The first order request reaches the owner for approval within minutes.

March: expiry

The exception ends on its date. The agent is denied again until someone renews it on purpose.

Every step left a record. An auditor can replay the whole story from the repository history.

Compare that with an email thread and a manual setting change, which leave nothing an auditor can trust.

Review rights

Who may change what

ChangeProposed byApproved by
Add a read page typeAgent ownerAI platform team
Add an allowed domainAgent ownerSecurity
Add an exception for an action pageAgent ownerSecurity and the budget or data owner
Change tier or unclassified settingAgent ownerSecurity and risk
Change the shared baselineSecuritySecurity lead, with notice to all owners

Encode these rules as required reviewers in your repository. Then the workflow enforces the governance, not a meeting.

Keep the list of approvers short. Two named people per change type is enough for most teams, and it keeps reviews fast.

Lifecycle

A policy file's life, from creation to retirement

1

Created with the agent

No agent ships without its file. The pipeline refuses unregistered agents.

2

Changed with the agent

New tool, new task or new model means a new pull request.

3

Reviewed on its date

A scheduled job opens an issue when review_by is close.

4

Retired with the agent

Deleting the file removes all access. The history stays in the repository.

Measuring it

Signs your policy as code is working

Every agent has a file

Compare the repository against discovered agents each month.

No overdue reviews

Count files past their review_by date. The target is zero.

Exceptions are few and dated

A growing exception list means the allow lists need rethinking.

Tests fail before incidents do

A red build that caught a mistake is the system doing its job.

For reviewers

Six questions to ask on every policy change

1

Does the purpose need this?

Every new page type or domain should trace back to the agent's written purpose.

2

Is the exception narrow?

One page type, one domain, a limit and an end date. Anything wider needs a stronger reason.

3

Who approves each action?

For money and publishing pages, a named person should approve each one.

4

Did the tests change too?

A policy change without a test change is a warning sign.

5

Does the tier still fit?

New tools often push an agent up a tier without anyone saying so.

6

Is the review date realistic?

Short dates for wide permissions, longer ones for narrow read-only agents.

Terms

Words used on this page

Baseline

The rules every agent gets: risky hosts, verified page types, URL rules and default-deny for unknown writes.

Golden test

A known request with the verdict you expect, run on every change.

Exception

A narrow, dated permission for one action page type on one domain.

Tier

How far the agent may act without a person deciding each step.

Approval required

A verdict that pauses the request until the agent's owner decides.

Unclassified

A destination no layer can identify. Strict agents deny it.

Would a policy file have stopped the 2026 incidents?

  • The agents involved uploaded datasets, edited wikis and installed a plugin.
  • A tier 4 policy denies upload and post pages and every unclassified write.
  • In our replay, page data plus egress rules would have stopped almost all of them.
The 2026 agent incidents, prevented The wiki edit case

The honest fine print — the same two assumptions we publish, plus two operational ones

  1. The policy engine must see every request — an agent with raw socket access or a second network path bypasses everything; enforcement belongs at the egress proxy/network layer, not only in an SDK hook.
  2. Default-deny must be on. In flag-only mode these become alerts within minutes rather than prevention — still a large improvement on a timeline measured in weeks (the DseWiki edits ran from late May to late June 2026, per the researchers), but not a block.
  3. For full URL+method matching on HTTPS you need to be the proxy or in-process hook — SNI alone shows only the host, which still catches the entire host-list layer.
  4. Policy can’t read intent inside a legitimately allowed action: an agent whose job is publishing packages keeps registry access. In our replay of the 2026 incidents, no crossing fits any plausible allowlist for the agents’ documented tasks.
Related

Keep reading

FAQ

Policy as code questions

What is AI agent policy as code?
Writing each agent's rules in a machine-readable file that is versioned, reviewed and tested like software, and enforced automatically before the agent acts.
Which format should the file use?
JSON is the safest choice because every language reads it. YAML is easier to write by hand and works when the enforcer supports it.
Can a policy file allow an agent to buy things?
Only through an exception: checkout on one named domain, with an end date and ideally owner approval per order. Checkout can never be allowed as a general page type.
What enforces the file?
The free Agent Egress Guard reads it directly from version 0.2.0, inside the agent or at a proxy. Any gateway can apply the same format.
How does the file know which URL is a checkout page?
The enforcer looks the URL up in page-type data. An AI agent allow list covers 28 page types on 40M+ domains, from $99 a month.
Where should policy files be stored?
In a version-controlled repository next to the agent code, or in a dedicated policy repository with required reviewers. Never only on the machine that runs the agent.
What happens if a policy file is missing?
Treat it as the strictest policy: the agent may read only its baseline and every action page is denied. Better still, refuse to start the agent.
How often should policy files change?
Whenever the agent gains a tool or task, and at least at every review date. Frequent small changes are healthier than rare large ones.

Write your first agent policy file in five minutes

Free builder, free enforcer, and page-type data when you need full coverage.

Open the builder