MSBA-371 · Lesson 8 of 12 · 19 min

Guardrails and policies

▶ Video coming soon A video version of this lesson is on the way.

Rosa Delgado manages Tidewater's money, which includes the Copilot bill, and she came to the eighth session with a question that sounded simple. "What is the agent allowed to do without asking anyone?" Nobody in the room could answer in one sentence. The cloud agent could push to its own branches but not to main. Editor agents could run some commands without asking and not others, depending on each developer's settings. The trail-units release process had an environment with a required reviewer, but nobody had checked whether an agent could trigger the workflow that used it. Rosa wanted a table. By the end of the afternoon she had one.

The GH-600 domain on guardrails and accountability carries 10 to 15 percent of the exam. Its objectives ask candidates to define autonomy levels by classifying actions by operational, security and compliance risk and assigning autonomy within security and Responsible AI standards, and to implement guardrails with human-in-the-loop: identify actions that need human judgement, block actions that violate policy, scope permissions and execution contexts to least privilege, require explicit authorization or controlled paths for irreversible or compliance-sensitive changes, and minimize approvals that do not materially reduce risk. This lesson covers both objectives. The next covers accountability and audit trails.

Classifying actions by risk

Guardrails start with an inventory of what agents can do, sorted by what could go wrong. The study guide names three kinds of risk.

Operational risk is the chance of breaking something that works: a failed deployment, a broken build on the default branch, data changed in a way that is hard to undo, a large bill. Security risk is the chance of exposing or weakening something: leaking a secret, widening access, adding a vulnerable dependency, changing a workflow so it runs untrusted code with privileges. Compliance risk is the chance of breaking a rule the organization must follow: changing licence terms, altering audit-relevant configuration, touching personal data, or skipping a required approval.

Each action gets a rating for each kind of risk, and the highest rating usually decides its class. Reversibility matters throughout: an action that can be undone in a minute is less risky than the same action that cannot.

Tidewater's action classification. The highest risk usually sets the class, and reversibility lowers it.
ActionOperationalSecurityComplianceClass
Read code and issues in the repositoryLowLowLowFree
Edit files on the agent's own branchLowLowLowFree
Run tests and builds in the sandboxLowMedium (runs code)LowFree inside sandbox
Add a dependencyMediumMediumMedium (licence)Allowed, checked in review
Change a workflow fileMediumHighMediumNeeds code owner approval
Merge to the default branchHighMediumMediumPerson only
Deploy to productionHighMediumHighPerson only, through a protected environment
Change repository settings or rulesetsHighHighHighNever by an agent

Autonomy levels

Classes map to autonomy levels: how much an agent may do on its own. Different organizations name the levels differently; what matters is that each level is defined and each action class is assigned one.

A staircase of four steps rising from left to right. Step one: observe, read and report only. Step two: propose, branches and draft pull requests reviewed before merge. Step three: act with approval, the agent waits for a person before specific actions. Step four: act within policy, routine actions inside enforced limits. Beside the staircase, risk arrows point down, showing higher-risk actions belong on lower steps.
Autonomy levels. Higher-risk actions belong on lower steps, where people do more and agents do less.

Tidewater set its four levels in the first course, and they are typical of the schemes organizations use. At observe, the agent reads and reports only, and a person makes every change; this suits the highest-risk areas, such as workflow files and settings. At propose, the agent creates branches and draft pull requests, changing code freely on its own branch while a person reviews before anything merges; this is how the cloud agent works. At act with approval, the agent may perform specific risky steps only after a person approves each one, as editor agents do for terminal commands outside an allow list. At act within policy, the agent carries out pre-approved routine actions automatically, with logging, inside limits enforced by software; this suits low-risk, reversible, well-tested work. Irreversible and compliance-sensitive actions stay with people at every level.

The study guide adds that autonomy must be assigned within security and Responsible AI standards. In practice that means the organization's existing security policies still apply to agents, and the Responsible AI principles Microsoft publishes, which include accountability, transparency, reliability and safety, privacy and security, fairness and inclusiveness, shape where people must stay involved. An agent's autonomy can never exceed what the organization would allow a person in the same role.

Guardrails that block, and guardrails that ask

Guardrails come in two kinds. Blocking guardrails make a policy-violating action impossible: a ruleset that refuses a push to main, a firewall that refuses a connection, a token without permission to change settings, an MCP allow list that refuses an unapproved server. Asking guardrails pause an action until a person approves: a required review, an environment with required reviewers, an editor's prompt before a terminal command.

Blocking guardrails are deterministic and cheap to operate. Asking guardrails cost human attention every time they fire. A good design blocks what should never happen, asks only where human judgement adds something, and lets everything else through.

GitHub guardrails that apply to agents. Most were covered in earlier courses; here they are viewed as agent controls.
GuardrailKindWhat it controls
Rulesets and branch protectionBlock and askWho may push or merge; required reviews and checks
CODEOWNERS with required code owner reviewAskWhich people must approve changes to which paths
Required status checksBlockMerging until tests, scans and other checks pass
Push rulesetsBlockPushing changes to protected paths, such as workflow or agent files
Environment protection rulesAskDeployments to protected environments
Token permissionsBlockWhat the agent's token can read or write
Cloud agent firewallBlockWhich network destinations the agent can reach
MCP server allow lists and registriesBlockWhich MCP servers agents may use
Enterprise AI controls and policiesBlockWhich agents and features are enabled for whom
Editor command approvalsAskTerminal commands and tool calls in interactive sessions

Least privilege for agents

Least privilege means giving each agent exactly the access its role needs and no more. For the cloud agent much of this is built in: its token is scoped to the one repository, it can push only to its own branches, and its network access is filtered. Teams still decide what to add. Each MCP server given to the agent, each secret placed in the Copilot environment and each firewall exception widens its reach, and each should have a reason.

Execution contexts matter as much as permissions. An agent running in a developer's editor inherits the developer's access: their credentials, their network and their files. The same task run in the cloud agent's sandbox has far less. For risky tasks, choosing the execution context is itself a guardrail: run them where the agent can reach least.

Custom agents allow finer least privilege. A review agent needs read tools only. A documentation agent needs write access to docs folders but no terminal. A dependency-update agent needs the package registry and nothing else on the network. Writing these limits into each custom agent's tool list makes the role's privilege explicit and reviewable.

Controlled paths for irreversible changes

Some changes cannot be undone, or can be undone only at great cost: a production deployment that migrates data, a release published to a package registry, a deleted branch with unmerged work, a change to an audit-relevant setting. The outline asks for explicit authorization or controlled paths for these.

A controlled path is a route that forces the change through checks that cannot be skipped. For deployments that means a workflow that deploys only through a protected environment with required reviewers and only from the default branch. For releases it means a release workflow triggered by a person and protected by a ruleset on tags. For settings it means changes made only through reviewed configuration, never by an agent's token. The agent may prepare the change, such as writing the migration or the release notes, but a person triggers the irreversible step through the controlled path.

Worked problem

Checking the release path

Rosa's question exposed a gap: could an agent trigger the trail-units release workflow, which publishes a new version tag and updates the Marketplace listing?

Show solution
  1. Dmitri checked the workflow triggers. It ran on workflow_dispatch and on pushes of tags matching v*.
  2. The cloud agent's token could not create tags matching the protected pattern, because a tag ruleset limited them to Dmitri and Priya. Blocked.
  3. Dispatching the workflow needed write access. Nothing in the cloud agent's configuration gave it a way to dispatch workflows, but an editor agent running with Dmitri's own credentials could do it if he approved the command.
  4. The release job used an environment named release with Priya as a required reviewer. Even a dispatched run would wait for her.
  5. Result: two independent guardrails, one blocking and one asking. The team wrote this into Rosa's table and added the release workflow file to the paths protected by code owner review.

Minimizing approvals that do not reduce risk

The last objective in this domain is easy to overlook: minimize approvals that do not materially reduce risk. Every approval prompt costs attention, and people who approve dozens of prompts a day stop reading them. Approval fatigue turns an asking guardrail into a rubber stamp, which is worse than no guardrail because everyone believes there is one.

To find wasted approvals, look at what people actually approve. If a prompt is approved almost every time, without changes, and the action is low risk and reversible, it can probably be allowed outright, perhaps with a narrower scope. If a prompt is sometimes refused, it is doing real work and should stay. If a risky action is being approved without reading, replace the prompt with a blocking guardrail or move the action to a controlled path.

Seraphine described Skerry's review of editor approvals. Developers had approved about ninety-seven percent of terminal command prompts without changes, mostly test and build commands. Skerry added those commands to an allow list in the shared editor settings, which cut prompts by more than two thirds. The prompts that remained, for package installs, network tools and anything with elevated rights, were refused or edited far more often, which showed they were catching real decisions.

Policy as code

Guardrails are easier to keep correct when they are written as code and reviewed like code: rulesets exported and managed through configuration, custom agent files in .github/agents protected by code owner review, AGENTS.md and instruction files reviewed in pull requests, firewall allow lists and MCP configuration in the repository's Copilot settings documented in the repository. MSBA-370 noted a push rule that can protect agent files from unreviewed edits; that is a guardrail on the guardrails, and it matters because an agent that can rewrite its own instructions can remove its own limits.

Rosa's table

The session ended with the one-page table Rosa had asked for. It listed each agent Tidewater used, editor agents, Copilot CLI and the cloud agent, against each action class, with the autonomy level and the guardrail that enforced it, and a column naming the person who owned each guardrail. It fitted on one page because the classification did the work: once actions were grouped into classes, the question for each agent was only which level applied to each class.

Rosa's one-page autonomy table for Tidewater, with the guardrail that enforces each level.
Action classEditor agents and CLICloud agentEnforced by
Read and edit on a branchAct within policyProposeBranch rules; own copilot/ branches for the cloud agent
Run tests and buildsAct within policy for allow-listed commands; act with approval for othersAct within policy, in the sandboxEditor allow list; sandbox and firewall
Add dependenciesAct with approvalPropose; reviewedDependency review check; code review
Change workflow filesObserveObserveInstructions; push ruleset requiring code owner review
Merge, release, deployNeverNeverRulesets; tag rules; protected environments
Change settings and rulesetsNeverNeverToken permissions; organization roles

Rosa's last question was about money, as everyone expected: did any of these guardrails cost anything? Most did not, because they were settings Tidewater already paid for. The real cost was attention, and the session's work on approval fatigue had reduced that.

Common mistakes

  • MistakeLetting each developer decide what agents may do.

    InsteadClassify actions by operational, security and compliance risk and assign autonomy levels centrally.

  • MistakeRelying on approval prompts for actions that should never happen.

    InsteadBlock them with rulesets, permissions, firewalls or allow lists.

  • MistakeRunning high-risk tasks in an editor with the developer's full access.

    InsteadChoose the execution context with the least reach, such as the cloud agent sandbox.

  • MistakeKeeping prompts that are approved almost every time.

    InsteadAllow low-risk routine actions and keep prompts for real decisions.

  • MistakeLetting agents edit their own instruction and agent files without review.

    InsteadProtect those paths with code owners or push rules.

Summary and key terms

  • Classify each agent action by operational, security and compliance risk, adjusted for reversibility.
  • Assign autonomy levels such as observe, propose, act with approval and act within policy.
  • Autonomy stays within security and Responsible AI standards and never exceeds what a person in the role may do.
  • Blocking guardrails make violations impossible; asking guardrails pause for judgement.
  • Least privilege covers tools, tokens, MCP servers, secrets, network access and execution context.
  • Irreversible or compliance-sensitive changes go through controlled paths or explicit authorization.
  • Remove approvals that do not reduce risk to avoid approval fatigue.
Autonomy level
A defined degree of independence an agent has for a class of actions.
Guardrail
A control that blocks or pauses agent actions that break policy or need judgement.
Blocking guardrail
A deterministic control that makes an action impossible.
Asking guardrail
A control that pauses an action until a person approves it.
Controlled path
A route for a change that forces it through checks that cannot be skipped.
Approval fatigue
Approving prompts without reading them because there are too many.
Least privilege
Giving each agent only the access its role needs.

Practice problems

Work each problem on paper first, then reveal the answer to check.

  1. Which three kinds of risk does the GH-600 outline use to classify actions?

    Show answer

    Operational, security and compliance risk.

  2. What two guardrails protected the trail-units release?

    Show answer

    A tag ruleset that blocked agents from creating release tags, and an environment with a required reviewer.

  3. What does it suggest if an approval prompt is approved nearly every time without changes for a low-risk action?

    Show answer

    It probably does not reduce risk and can be replaced by an allow rule.

Lesson quiz · 5 questions

Score 60% or more to complete this lesson.

Take the quiz