Configure observability and control for autonomous agents
Unlock the complete study guide.
Bundled into the existing Developing in Agentic AI Systems premium course — no separate purchase.
14-day money-back guarantee — no questions asked.
Included in this chapter:
- Where control and evidence live for an autonomous agent
- Control which tools Copilot CLI sees and may run
- Bound how long autopilot keeps going
- Oversee an agent while it is still running
- Hooks that decide on individual tool calls
- Hooks that observe rather than approve
- Keep cloud agent hook records outside the sandbox
- Keep workflow secrets out of cloud agent sessions
- Repository acceptance still governs agent pull requests
- Approve workflow runs on agent pull requests
- Put the approval on the job that acts: environments
- Package evidence a reviewer can trust
- Evidence a run leaves beyond its artifacts
- Exam reasoning: match the requirement to the control
Requirement to control: what meets it, and the tempting control that does not
| Requirement | Control that meets it | Tempting control that does not |
|---|---|---|
| Routine test commands run without prompts, URL checks stay | A scoped --allow-tool pattern | --allow-all or --yolo, which also enables all paths and URLs |
| Local Git work runs; git push is always refused | Allow the Git pattern and --deny-tool for git push | Leaving push unapproved, which still offers a prompt |
| The model must not see a tool at all | --available-tools or --excluded-tools | --deny-tool, which governs permission rather than visibility |
| Refuse one dangerous command based on its arguments | A preToolUse hook returning permissionDecision: deny | postToolUse, which runs after the call has succeeded |
| Block the call when the policy check crashes or exits nonzero | A command hook, whose crash or nonzero exit denies (a timeout still falls through) | An HTTP hook, whose errors and timeouts fall through |
| A person must decide before a risky cloud agent change takes effect | Refuse it in the run, and put the person at a later checkpoint: required review or a protected environment | A preToolUse ask, which cloud agent treats as deny |
| Keep hook audit records from a cloud agent session | An HTTP hook to a firewall-permitted destination | Files written inside the ephemeral sandbox |
| Changes to agent configuration need a named team's approval | CODEOWNERS plus Require review from Code Owners | An instruction in .github/copilot-instructions.md |
| Someone other than the initiator approves the deploy job | An environment with required reviewers and Prevent self-review | A wait timer, or simply listing more reviewers |
| Reviewers and later jobs inspect the plan and traces | actions/upload-artifact, with needs on the consuming job | A dependency cache or the job's local filesystem |
| Keep a portable record of a programmatic CLI session | --share=PATH, or /share file interactively | Raising --log-level without setting --log-dir |
Decision tree
Cheat sheet
Unlock with Premium — includes all practice exams and the complete study guide.