# Governing AI coding agents: a guide for engineering and security leaders

Guide · Governance

# Governing AI coding agents.

A practical guide for engineering and security leaders: what to control when developers use Claude Code, Cursor, Codex and other AI agents with access to your code, your shell and your secrets.

[Download the slides (PDF)](https://agentkeyroute.com/resources/governing-ai-coding-agents.pdf)Read online

Free to read, no form · 12 slides · For CTOs, engineering managers, security and compliance leads · December 5, 2026

01 · Inventory

## AI is already in your delivery pipeline

Before writing a policy, find out where AI runs today. It is usually in more places than leadership expects.

### Editor agents

Cursor, Copilot, Windsurf and similar tools send open files and surrounding code as context.

### Terminal agents

Claude Code, Codex CLI, Aider. They read the repository, run commands and edit many files at once.

### AI in your product

SDK calls to OpenAI, Anthropic or Gemini inside your own services, often with a key in an .env file.

### AI websites

ChatGPT, Claude and Gemini in the browser, used to debug logs, explain code or draft documents.

### Bots in CI

Review bots, test generators and agents that open pull requests with a token of their own.

### Personal accounts

Tools paid for on a personal card. They do not appear in any company inventory.

Start with a list of tools, keys and owners. A policy without an inventory governs nothing.

Governing AI coding agents2 / 12

Ask each team three things: which AI tools they use, which keys those tools use, and who pays. Search repositories and CI secrets for provider keys (sk-, sk-ant- and similar prefixes). The answers usually reveal shared keys and personal subscriptions, which are the first two things to fix.

02 · Where control is possible

## You rent the model. The path to it is yours.

You cannot change how a provider's model behaves. You can control everything between your developers and that model.

| Control point | What it decides | The question to ask |
| --- | --- | --- |
| Model choice | Which provider and model see your code | Who approves a new model, and would we notice if one changed? |
| Identity | Whose credential each request uses | One key per person, or a shared key in an .env file? |
| Data out | What leaves the laptop | Are secrets and personal data stopped before they are sent, or found later? |
| Actions | What the agent may run or change | Which commands and repositories can it touch without a person approving? |
| Spend | Who pays, and how much | Is there a limit per person and per agent that actually stops requests? |
| Record | What is kept as evidence | Could we show what was sent last Tuesday, and prove the record was not edited? |

If a control lives only in each developer's settings, it is a recommendation. If it sits in the request path, it is enforced.

Governing AI coding agents3 / 12

Most AI governance documents focus on the model. In practice the model is the part you control least. The six points above are where a decision can actually be made and enforced, and each one has a plain question that an engineering manager can answer yes or no.

03 · Levels of autonomy

## The more an agent can do, the more each control matters

The model can be the same at every level. What changes is how much it can do without a person.

| Level | What it does | What goes wrong | The control |
| --- | --- | --- | --- |
| Chat | Answers questions in a browser or IDE panel | Someone pastes a customer record or a production key | Approved tools, and data rules applied in the browser |
| Suggest | Completes code and edits the open file | Whole files go out as context, including config and .env | Exclude secret files; scan what is sent |
| Agent edits | Changes many files and runs tests | Large diffs merged without review; files read that nobody expected | Per-person keys, review gates, a log of what was sent |
| Agent acts | Runs shell commands, uses credentials, deploys | Destructive commands, found credentials reused, loops running for hours | Sandbox, scoped credentials, budgets, a kill switch |

Governing AI coding agents4 / 12

Teams often approve a tool at the chat level and then adopt its agent mode without a new review. Re-rate a tool whenever it gains the ability to run commands or use credentials, because the risk comes from that authority, not from the model.

04 · Identity

## One API key in .env for twenty developers

The most common setup, and the one that makes every other control impossible.

### No attribution

The invoice says the team spent money. It cannot say who, on what, or why.

### No clean revocation

A lost laptop means rotating the key for everyone and breaking every tool at once.

### No per-person limits

One runaway session uses the whole team's budget, and nobody is alerted.

### Keys that travel

Shared keys end up in repositories, CI logs, screenshots and chat messages.

Give each person and each agent its own key, and keep provider keys in one place developers never see.

Governing AI coding agents5 / 12

Per-person keys are the foundation for everything else: attribution, budgets, revocation and audit. Provider keys should live in a gateway or secrets manager, so that leaving the company, losing a laptop or a leaked key only ever affects one person's access.

05 · Data leaving the laptop

## What coding agents send, and how to stop the wrong parts

| Data | How it gets in | Control |
| --- | --- | --- |
| Secrets | The agent reads .env files, config and shell history as context | Block the request before it is sent |
| Personal data | Test fixtures, logs and database dumps pasted while debugging | Redact before it reaches the provider |
| Source code | The point of the tool | Decide per repository which providers may receive it |
| Regulated data | Production data copied into development | Block, and route only to approved or on-premises models |
| Hidden instructions | Text in files, issues or web pages that tries to steer the agent | Detect prompt injection and limit what tools may do |

Detection that runs after the request has been sent is a report, not a control.

Governing AI coding agents6 / 12

Agents pick up far more context than a person would paste. A request can include the contents of a config file the developer never opened. Check outgoing requests in the network path, where every tool is covered by the same rules, rather than relying on per-tool exclusion lists.

06 · Cost

## Runaway agents show up on the invoice first

Agent spend is spiky. A single session can cost more than a developer's monthly seat.

### Loops

An agent retries a failing test or command for hours, paying for every attempt.

### Context growth

Each turn resends the conversation and more files, so long sessions cost more per step.

### The biggest model by default

The most expensive model handles trivial work such as renaming or summarising.

### No owner

Spend is grouped under one account, so nobody notices until finance asks.

Set a monthly budget per person and per agent that stops requests when it is spent, and attribute every cost to a person, a team and a model.

Governing AI coding agents7 / 12

Budgets that only send an email after the fact do not stop a loop at 2 a.m. Use limits that refuse requests once reached, alert before that point, and review cost by model so that background tasks can move to a cheaper one.

07 · Evidence

## The questions customers and auditors now ask

Security questionnaires and audits increasingly include AI. These are the questions to be ready for.

| Question | What answers it |
| --- | --- |
| Which AI tools do employees use, and with what data? | An inventory with an owner for each tool |
| Can you show what was sent to AI providers? | A request log with who, what, which model and when |
| Are secrets and personal data kept from AI providers? | Blocking and redaction records, not only a policy document |
| Who approved this tool and this model? | An owner and approved models per tool or agent |
| Can you prove the logs were not changed? | A tamper-evident log, such as a hash chain you can verify |
| How long do you keep the records? | A written retention period that the system enforces |

Governing AI coding agents8 / 12

A policy document answers 'what should happen'. Auditors and enterprise customers increasingly ask what did happen. Records produced automatically for every request, kept for a defined period and protected against editing, answer both.

08 · Change

## Models change underneath you

An agent approved in January can behave differently by June without anyone touching it.

### Updates and retirement

Providers update and retire models on their own schedule.

### Moving aliases

Names such as 'latest' point to a different model after an update.

### Different behaviour

The same prompt produces different code, different tool use and different cost.

### Silent rerouting

A routing or fallback change can send code to a provider you never approved.

Approve specific models per team or agent, record which model actually answered each request, and re-test after a change.

Governing AI coding agents9 / 12

Treat a model change like a dependency upgrade. Keep a list of approved models, refuse anything else, and check the model recorded on each response rather than the model that was requested.

09 · Where you are today

## Five stages of AI governance in engineering teams

| Stage | What it looks like | Next step |
| --- | --- | --- |
| 1 · Banned on paper | Policy forbids AI tools; developers use personal accounts anyway | Offer an approved path so use becomes visible |
| 2 · Shadow use | Individuals choose and pay for tools; there is no inventory | Build the inventory and issue company keys |
| 3 · Policy only | A written policy exists; nothing checks it | Put controls in the request path |
| 4 · Some tools governed | One or two tools go through a gateway; others go direct | Close the gaps and restrict direct access |
| 5 · Governed centrally | Every AI request uses one path with identity, data rules, budgets and a log | Review monthly; re-approve after model changes |

Governing AI coding agents10 / 12

Most teams are at stage 2 or 3. Moving from stage 3 to stage 5 is mostly an engineering change rather than a policy change: route AI traffic through one controlled path and remove the routes around it.

10 · A 30-day plan

## From shadow use to governed, in four weeks

1

### Week 1 · Inventory

List tools, keys and owners. Find provider keys in repositories, CI and laptops. Decide where source code may be sent.

2

### Week 2 · Pilot

Give two or three developers personal keys through a gateway. Read what is actually sent and tune the rules.

3

### Week 3 · Rules

Block secrets, redact personal data, approve models per team and set budgets per person and per agent.

4

### Week 4 · Roll out

Push the gateway address through managed settings, remove raw provider keys and restrict direct access to model APIs.

Start small. A one-week pilot shows which rules are too strict and what your team really sends, before anyone is blocked.

Governing AI coding agents11 / 12

The order matters. Rules written before the pilot are guesses; rules written after it reflect real traffic. Removing raw provider keys and restricting direct access comes last, once the governed path works well enough that nobody needs a way around it.

Summary

## Three questions for every AI tool

1

### What can it reach?

Code, data, credentials and the actions it can take.

2

### Who owns it?

One named person, accountable for its use and its cost.

3

### How would we know if it went wrong?

Records, limits and alerts that work without anyone watching.

AgentKeyRoute puts these controls in one place: one gateway for every coding agent, app and AI website, with a key per person, secrets blocked before they leave, budgets that stop requests, approved models, and a tamper-evident log. Setup is a base URL change.

Governing AI coding agents12 / 12

If you can answer these three questions for every AI tool in use, you are governing it, whatever form the paperwork takes. AgentKeyRoute is our product and one way to implement the controls in this guide; the questions apply whichever approach you choose.

Take it with you

Present these slides to your team or your security lead. They are free to share with attribution.

[Download the slides (PDF)](https://agentkeyroute.com/resources/governing-ai-coding-agents.pdf)

[More resources](https://agentkeyroute.com/resources) · [Blog](https://agentkeyroute.com/blog) · [Setup guides for 80+ tools](https://docs.agentkeyroute.com/connect)

## Govern every coding agent from one place.

A key per person, secrets blocked before they leave, budgets and a tamper-evident log. Free for small teams.

[Get started](https://app.agentkeyroute.com/signup)[See agent governance](https://agentkeyroute.com/agents)

---
Source: https://agentkeyroute.com/resources/governing-ai-coding-agents · Markdown: https://agentkeyroute.com/resources/governing-ai-coding-agents.md
