# AI agent policy template for engineering teams

> A copyable AI agent policy for engineering teams: approved agents, credentials, permission modes, MCP servers, destructive actions, review, logs and incident reporting.

An AI agent policy tells engineers which agents they may run, what those agents may touch and what has to happen before a risky action lands. Most AI acceptable use policies were written for chat assistants and cover what people may paste into a prompt. Agents also run commands, edit files, call MCP servers and push code with an engineer’s credentials, so the policy needs rules for actions as well as data.

The template below is a starting point for a VP of Engineering, CTO or head of platform. Each clause names the public incident that shows why it is there. Replace the bracketed parts, delete what doesn’t apply, and give every clause an owner. The whole page is also served as plain markdown at [/guides/ai-agent-policy-template.md](https://www.excellent.so/guides/ai-agent-policy-template.md) if you want to paste it into your wiki.

## How to use this template

Keep the policy short enough that engineers read it. Put the detail in the controls: branch protection, separate credentials, a list of approved MCP servers. A rule that only lives in a document depends on everyone remembering it in the middle of a task. Where a clause can be enforced by a setting at the host, the repository or the cloud account, enforce it there and let the policy say so.

Review it every quarter. Agent tools change their permission models often, and a setting that was safe in one release can mean something else in the next.

## 1. Scope and approved agents

**1.1** This policy covers any AI agent that can read or change company code, data or systems: coding agents in the terminal or editor, browser and desktop agents, agents running in CI, and agent features inside SaaS tools.

**1.2** Approved agents are listed in [link to the list], with the version range and the configuration that is approved. A new agent, or a new major version, is reviewed by [platform or security team] before use on company code.

**1.3** Agents and their extensions are installed from the vendor’s official channel. Automatic updates stay on for security fixes, and [team] watches the vendor’s security advisories. *Why:* in July 2025 version 1.84.0 of the Amazon Q Developer extension for VS Code shipped with malicious code that an attacker committed using a mis-scoped CI token at AWS. AWS says the code failed to run, and it released a fixed version two days later. [The Amazon Q extension incident](https://www.excellent.so/guides/amazon-q-extension-wiper-prompt)

## 2. Data

**2.1** Engineers may share [classes of data] with approved agents and their model providers under the contracts listed in [link]. Customer personal data, secrets and [other classes] are not pasted into prompts or files an agent reads.

**2.2** Agent session logs are company records. They often hold whatever the agent read, including keys printed by a command. Logs are kept for [N] days, stored on company devices only, and cleaned of secrets before they are shared. [Keeping keys out of agent logs](https://www.excellent.so/guides/keep-keys-and-email-out-of-agent-logs)

## 3. Credentials and environments

**3.1** Agents run with the narrowest credential the task needs. Development tasks use development credentials. Production credentials, cloud admin roles and package-publishing tokens are not available in an agent’s environment unless the task is explicitly a production task approved by [role].

**3.2** Development and production databases are separate, and an agent working on development cannot reach production with the same connection string. *Why:* in July 2025 Replit’s agent deleted a production database during a user’s experiment while a code freeze was in place. Replit’s response was to separate development and production databases automatically. [The Replit incident](https://www.excellent.so/guides/replit-agent-deleted-production-database)

**3.3** Backups that protect production live outside the reach of the credentials an agent can use. A token that can delete a database should not also be able to delete its backups.

## 4. Permission modes

**4.1** Approval prompts stay on by default. Modes that skip approvals (for example Claude Code’s `--dangerously-skip-permissions`, Codex’s `--dangerously-bypass-approvals-and-sandbox` or “YOLO” modes) are allowed only inside a disposable container or VM with no production credentials and no access to [internal networks]. [What YOLO modes turn off](https://www.excellent.so/guides/yolo-mode-ai-agents)

**4.2** Engineers don’t leave agent CLIs configured to run without approval on their everyday machine. *Why:* in August 2025 malicious versions of the Nx build system’s npm package ran a script that looked for installed AI command-line tools and ran them with permission-skipping flags to search the machine for secrets. [The Nx “s1ngularity” attack](https://www.excellent.so/guides/nx-s1ngularity-ai-cli-supply-chain-attack)

## 5. MCP servers, plugins and extensions

**5.1** Agents connect only to MCP servers on the approved list in [link]. Each entry names the publisher, the package or URL, the pinned version and the scopes its token has.

**5.2** A server is installed from its publisher’s own package or repository. A version bump is reviewed like any other dependency update. *Why:* in September 2025 an npm package called `postmark-mcp`, published by someone with no connection to Postmark, added a hidden BCC to every email it sent. Earlier versions behaved normally. [The postmark-mcp incident](https://www.excellent.so/guides/postmark-mcp-malicious-mcp-server)

**5.3** MCP servers that read untrusted content (issues, email, web pages) and servers that can write or send are not given to the same agent session without review, because text in the content can steer what the agent does next. [MCP server security](https://www.excellent.so/guides/mcp-server-security)

## 6. Destructive and irreversible actions

**6.1** These actions need a named human’s approval at the time, outside the agent’s own chat: deleting data or infrastructure (`DROP`, `terraform destroy`, deleting volumes, buckets or backups), force-pushing a shared branch, publishing a package, changing access controls, and sending email or messages to customers.

**6.2** Where the platform can enforce 6.1, it does: protected branches that refuse force pushes, deletion protection on databases, and infrastructure plans that need approval before apply. [Stop an agent running rm -rf or git push --force](https://www.excellent.so/guides/stop-ai-agent-running-rm-rf-or-git-push-force)

## 7. Review and accountability

**7.1** The engineer who starts an agent is accountable for what it does in that session, as if they had typed it.

**7.2** Agent-written changes go through the same pull request, review and CI as any other change. An agent’s summary of its own work is not evidence that the work is correct: reviewers check the diff and the test results.

**7.3** Commits and pull requests say when an agent wrote most of a change, so reviewers know what they are reading.

## 8. Incident reporting

**8.1** Report an agent incident to [channel] as soon as you notice it: an unexpected deletion, a force push, a secret in a log or a request to an unknown host. Reporting a mistake is not a disciplinary matter.

**8.2** Preserve evidence before cleaning up: stop the agent, keep the session log, note the time, and save before-and-after IDs (commits, snapshots, resource IDs). Revoke any credential that appeared in a log at its provider. [What to do when an agent force-pushed main](https://www.excellent.so/guides/ai-agent-force-pushed-main) · [When an agent deletes files](https://www.excellent.so/guides/ai-agent-deleted-files-on-mac)

**8.3** [Security or platform team] keeps a log of agent incidents and reviews this policy against it each quarter.

## 9. Exceptions

**9.1** Exceptions are requested from [role], written down with an end date, and reviewed when they expire.

## Turning the policy into evidence

A policy is only as good as your view of whether it is followed. Three questions are worth answering every month: which agents and versions are in use, which sessions ran without approvals, and which sessions touched credentials, shared branches or production. Vendor admin consoles answer part of this for their own agent. Session logs on each engineer’s machine answer the rest.

Excellent’s free scan reads supported agents’ logs on a Mac and reports force pushes, deletions in folders you mark as never-delete and keys that ended up in a log, after the fact. With Pro, Excellent adds a live check that can ask or block before supported risky actions; coverage varies by agent and action. [Run the free scan](https://www.excellent.so/scan) · [Roll Excellent out to a team](https://www.excellent.so/guides/roll-out-excellent-to-a-team) · [Public AI agent incidents](https://www.excellent.so/incidents)

Source: https://www.excellent.so/guides/ai-agent-policy-template
