· Sourceplane engineering · AI agents · 4 min read

Guardrails, not gates: governing what agents can change

Approval queues do not scale to the volume of work agents produce. Guardrails do. A practical model for giving agents real access without giving them the keys to production.

The first instinct when coding agents arrive is to put a human in front of everything they do. Every pull request needs an approval. Every deploy needs a sign-off. Every infrastructure change waits for the one person who understands it.

That works for a week. Then the queue of agent-produced changes outgrows the people reviewing it, approvals become rubber stamps, and the control that was meant to keep things safe becomes theatre.

The alternative is not to remove control. It is to move it from people to the platform: from gates to guardrails.

Gates and guardrails

A gate stops work until a person approves it. It is only as good as the attention of the person at the gate, and attention does not scale.

A guardrail shapes what work is possible in the first place, and checks every change automatically. It applies the same way to the hundredth change of the day as to the first, to an agent as to a senior engineer.

Good platforms use both, but in proportion: guardrails for the routine, gates for the genuinely risky.

Start with identity

An agent should never act as somebody else.

  • Its own identity. Each agent, or each agent session, gets an identity of its own, so every action can be attributed to it.
  • Short-lived credentials. Tokens that expire in minutes or hours, minted for the task, not keys that live for years in a settings page.
  • Least privilege. Read access can be broad; write access should be narrow and specific to the repository, environment and resources the task needs.

If an agent today uses a shared admin token or a senior engineer’s personal access token, that is the first thing to change. It is also the change with the biggest reduction in risk.

Scope by blast radius

Not every action carries the same risk. Scope access accordingly:

  • Code: agents propose changes through pull requests. They do not push to protected branches.
  • Environments: agents can deploy to preview and development environments freely. Staging and production are reached only through the pipeline, under its rules.
  • Data: agents work with synthetic or masked data by default. Access to production data is explicit, time-boxed and logged.
  • Infrastructure: agents can propose infrastructure changes as code, and the pipeline shows the plan. Applying it follows the same rules as any other change.

Declare policy as code

The rules that matter should be written down once and enforced by the pipeline on every change, regardless of who or what made it. Examples that pay off quickly:

  • Changes to infrastructure code require a plan to be produced and attached to the pull request.
  • Database migrations must be backward compatible, and destructive ones need an explicit marker and a named approver.
  • New dependencies are checked against an allow list and a vulnerability scan.
  • Changes to authentication, payments or access control always require review by a named owner.
  • Secrets never appear in code; a scanner blocks the merge if they do.

Each of these replaces a judgement call that a tired reviewer might miss with a check that never gets tired.

Make every action auditable

When something goes wrong, the first questions are who changed what, when and why. With agents in the loop, the answers have to be recorded automatically:

  • Every change links to the task or ticket that asked for it.
  • Every deploy records the commit, the pipeline run and the identity that triggered it.
  • Every credential issued to an agent is logged with its scope and lifetime.

This is not only for incidents. It is what lets you answer a customer’s security questionnaire with evidence instead of reassurance.

Keep humans where they add value

Guardrails free reviewers from the mechanical parts of review. What remains is the part only people can do well:

  • Is this the right change to make at all?
  • Does it fit how the system is meant to evolve?
  • Is the risk acceptable, given what it touches?

Reviewing intent and risk is a better use of a senior engineer’s attention than checking formatting and folder structure, and it scales far better with agent volume.

A starting set

If you are introducing agents to a team this quarter, these six guardrails cover most of the risk:

  1. A separate, short-lived, least-privilege identity for every agent.
  2. Protected branches; all agent work arrives as pull requests.
  3. Production reachable only through the pipeline.
  4. Required checks on every change: tests, secret scanning, dependency scanning, policy.
  5. Named owners who must review changes to sensitive areas.
  6. An audit trail linking every change and deploy to a task and an identity.

None requires a large platform team. Together they let agents do real work without anyone having to hope that nothing goes wrong.


How we help. We set up identity, policy as code and audit for people and agents alike, in your pipeline and your cloud accounts. See security and guardrails, or talk to an engineer.

Share:
All articles