# Why Guardrails — AI Coding-Agent Guardrails

Source: https://www.geekswithgeeks.com/en/coding-agent-guardrails/tm-why

> Explain why a coding agent needs limits even when the model is usually right.

## Power plus mistakes

A coding agent can read files, edit code, run shell commands and sometimes reach the network, all with **your** permissions. Even a very good model sometimes misreads a request, takes a shortcut, or follows an instruction it should not have. If it is right 99% of the time, an agent doing a hundred actions a day is still wrong once. **Guardrails** make sure that when it is wrong, the damage is small, visible and reversible.

## Layers around the agent

No single control is enough. Permissions, sandbox, network, Git and review each catch what the others miss.

![Four layers: policy, sandbox, repository, review.](assets/figures/coding-agent-guardrails/section-1-map.svg) — Figure 1.1 — Policy, sandbox, repository and review.

## Seat belts, not brakes only

Good drivers still wear seat belts, because the goal is not to expect crashes but to survive them. Guardrails are the seat belts, airbags and speed limits of agent work.

## Do not rely on the prompt alone

"Never delete files" in a prompt is a request the model may ignore or be talked out of. A permission rule that blocks deletion is enforced by the system. Prefer enforcement over instruction for anything that matters.

**Quiz:** What is the main goal of guardrails?

- [ ] To make mistakes impossible
- [ ] To slow the agent down
- [x] To make mistakes small, visible and reversible
- [ ] To replace code review

*Answer:* To make mistakes small, visible and reversible. You cannot remove all errors, but you can limit what an error can do.
