MockCertMockCert
Menu

Test yourself in exam conditions

A full GitHub Certified: Agentic AI Developer mock exam: 60 questions in 120 minutes, scored against the real exam's pass mark. Your first one is free.

Start a free mock exam
Domain 2 · 4 topics · about 28 minTopics in this domainTopics

Domain 2 · Overview

Overview

Up next: Select and configure agent tools · 11 steps + check · 7 min

Domain 2 · Topic 1 of 4

Select and configure agent tools

Step 1 of 11

Think first How do you give an agent the tools a task needs while keeping risky actions under your control?

Why it matters: Questions describe a task or a tool setup and ask which tools, configuration, or permission option fits.

Choosing tools means giving an agent only what the task needs. MCP servers and their toolsets add abilities, and a repository can share one MCP configuration. Permission settings then decide which tools run freely, which ask first, and which are blocked.

Step 2 of 11

Term Meaning
MCP server A server that supplies an agent with tools, like the GitHub MCP server.
Toolset A named group of GitHub MCP server tools, such as repos, issues, or pull_requests.
Repository MCP configuration Repository settings that list MCP servers and their tools, shared by cloud agent and code review.
Available set The tools the model can use at all in Copilot CLI, chosen with --available-tools.
Deny rule A rule that blocks a tool; it beats any allow rule or saved approval.

Step 3 of 11

Use edit mode for tight control and agent mode for automation. In edit mode you pick the files Copilot may change and accept or reject each edit. Agent mode handles repetitive workflow work, like opening pull requests or running tests and linters in the background.

Copilot Chat edit mode and agent mode

Feature Edit mode Agent mode
Best for Granular control over changes Automating repetitive workflow tasks
What you decide Which files change and whether to accept each edit Which tasks to hand off while you keep working
Typical work Iterating on chosen files with added context Creating pull requests, running tests and linters

Step 4 of 11

The repos, issues, and pull_requests toolsets are on by default. Some toolsets, such as copilot and github_support_docs_search, exist only on the remote server. Removing /readonly from the remote server URL widens access to all tools.

Remote and local GitHub MCP server setup

Feature Remote server Local server
Selecting toolsets List them in the X-MCP-Toolsets header Use command-line flags or environment variables; variables win
Remote-only toolsets copilot and github_support_docs_search available Not available

Exam trap On a local server, a command-line flag does not win over an environment variable. Environment variables take precedence over flags.

Step 5 of 11

One repository MCP setup serves cloud agent and code review. Cloud agent, including its automations, shares it with Copilot code review. A local server needs a command that starts it and the args passed to that command. String fields other than tools and type can pull in a Copilot environment variable or secret.

Step 6 of 11

Reusing a VS Code setup needs a tools key for each server. Swap any inputs or envFile for env. Give GitHub App values as Agents secrets prefixed COPILOT_MCP_. Install extra dependencies, such as uv or pipx, in a copilot-setup-steps.yml workflow. Then expand the Start MCP Servers log step to see each server's tools.

Exam trap Storing those values as variables is the wrong choice. Only secrets stay available when Copilot runs in a cloud sandbox.

Step 7 of 11

Code review may call MCP tools by default; you can turn that off. Disabling the setting stops code review from calling any MCP tool, even the default GitHub and Playwright servers. An automation can only use the MCP tools picked when it was created or edited. Organizations and enterprises can enforce MCP allowlists tied to each user's Copilot seat.

Exam trap Copilot connectors skip repository MCP setup in cloud sandbox sessions. They do not yet work in sessions on GitHub Actions, such as one started by assigning an issue.

Step 8 of 11

--available-tools keeps only the tools you list. By contrast, --excluded-tools turns off just the tools you name. When you pass both, Copilot CLI uses the allowlist and ignores the denylist.

Two ways to narrow Copilot CLI tools

Feature --available-tools --excluded-tools
What it turns off Every tool you did not list Only the tools you list
When both are passed Applied as the allowlist Ignored

Exam trap Adding --allow-tool cannot rescue a tool outside the available set. The model still cannot use it at all.

Step 9 of 11

Deny rules always beat allow rules. Read-only actions like searching and reading files are generally allowed automatically; edits, destructive commands, and URL access need permission. --allow-tool lets a tool run without a prompt, and --deny-tool blocks it. Pairing --allow-tool='shell(git:*)' with --deny-tool='shell(git push)' permits every git command except git push. --allow-all, or --yolo, equals --allow-all-urls, --allow-all-tools, and --allow-all-paths combined.

Exam trap Using --allow-all does not unlock a denied tool. Deny rules still win, even over a saved approval.

Step 10 of 11

Approvals for a location persist; command-line options do not. Approving a tool for the current location saves it to ~/.copilot/permissions-config.json by default. --allow-tool and --deny-tool last only for the session. /reset-allowed-tools revokes grants from the session. With /permissions assisted, a language model approves eligible requests it judges safe, but enterprise rules still apply.

Step 11 of 11

  • Deny rules win over allow rules, even with --allow-all or a saved approval.
  • With both --available-tools and --excluded-tools, only the --available-tools allowlist applies.
  • The GitHub MCP server turns on the repos, issues, and pull_requests toolsets by default.
  • Each server in a repository MCP configuration needs a tools key naming the tools Copilot may use.
  • An automation can call only the MCP tools picked when it was created or edited.

Sources: Configuring toolsets for the GitHub MCP Server - GitHub Docs (opens in a new tab) · Configure MCP servers for your repository - GitHub Docs (opens in a new tab) · Allowing and denying tool use - GitHub Docs (opens in a new tab) · Choosing the right AI tool for your task - GitHub Docs (opens in a new tab) · Model Context Protocol (MCP) servers, registries, and allow lists - Training | Microsoft Learn (opens in a new tab)

Check

Check: Select and configure agent tools

Cards to recall, then questions on this topic. About 2 minutes. Nothing is saved without an account.

Loading the cards and questions…

Up next: Configure MCP servers · 10 steps + check · 7 min

Domain 2 · Topic 2 of 4

Configure MCP servers

Step 1 of 10

Think first How do you give an agent tools from an MCP server while still controlling which servers your developers are allowed to run?

Why it matters: Questions describe an MCP setup and ask which setting, transport, registry policy or allowlist makes a server work or blocks it.

An MCP server hands an agent tools, and the agent then uses them without asking. You add servers per client or agent. The enterprise decides which servers may run, through a registry policy or, more securely, an allowlist in managed settings.

Step 2 of 10

Term Meaning
MCP registry A server list that follows the MCP registry v0.1 specification and exposes GET /v0.1/servers.
Registry only A policy that lets only servers from the configured registry run, local ones included.
MCP allowlist Allowed and denied servers set in managed-settings.json, matched by name, server URL or command.
Streamable HTTP The transport behind the http server type; sse is the older, deprecated one.

Step 3 of 10

Once a server is configured, Copilot uses its tools autonomously. No approval prompt appears before a tool call. So allowlist specific read-only tools; * in the tools array enables every tool. Copilot cloud agent and Copilot code review use only MCP tools, not resources or prompts. Code review also skips any tool whose annotations.readOnlyHint is missing or false.

Exam trap Expecting Copilot to ask before each MCP tool call is wrong. It acts on its own, which is why you list read-only tools instead of *.

Step 4 of 10

copilot mcp add adds a server without interactive mode. The server lands in the user configuration, ~/.copilot/mcp-config.json. The --transport option takes stdio, http or sse, and stdio is the default. Project-level servers load only after you confirm folder trust. When .mcp.json and .github/mcp.json share a directory, .mcp.json wins.

The three transports for a new MCP server in Copilot CLI

Transport Detail Status
stdio Also accepted by Copilot cloud agent Default for copilot mcp add
http Streamable HTTP Current HTTP transport
sse HTTP with Server-Sent Events Deprecated, still supported for backwards compatibility

Step 5 of 10

The GitHub and Playwright MCP servers are on by default in cloud agent. You add your own servers next to them. The default GitHub server uses a token with read-only access to the current repository. Only Agents secrets and variables named with the COPILOT_MCP_ prefix reach your MCP configuration. In Copilot CLI, the GitHub MCP server is built in and needs no setup.

Exam trap A secret named API_KEY is not visible to the MCP configuration. Rename it with the COPILOT_MCP_ prefix.

Step 6 of 10

In supported IDEs, remote setup is the recommended choice for most users. To add it, pick HTTP as the server type and enter the GitHub MCP server URL. GitHub Enterprise Server supports local configuration. With data residency, GitHub Enterprise Cloud allows either setup, local or remote.

Exam trap Remote servers that need OAuth do not work for cloud agent or code review when set in repository settings or custom agent profiles.

Step 7 of 10

A registry follows the MCP registry v0.1 spec and serves GET /v0.1/servers. Give Copilot the base URL only, because it appends the v0.1 path itself. The registry or its reverse proxy must send CORS headers on every /v0.1/servers endpoint. Once configured, Copilot CLI offers the registry for finding servers, and /mcp search queries it instead of the GitHub registry.

Exam trap Adding /v0.1/servers to the registry URL breaks it. Copilot adds that path automatically, so the doubled path errors out.

Step 8 of 10

The policy decides whether servers outside the registry may run. Nothing runs unless the MCP servers in Copilot policy is enabled for the enterprise or organization. A newly selected policy applies to all developers at once. Registry policies are in public preview and are not the recommended way to restrict servers.

Allow all and Registry only compared

Feature Allow all Registry only
Servers that can run Any MCP server Only servers in the registry
Local servers No restriction Must be in the registry with an exactly matching server ID
Copilot connectors Usable Not usable

Step 9 of 10

managed-settings.json is the generally available, more secure control. Its allowlist and denylist match servers by name, server URL or command. A malformed list counts as an empty allowedMcpServers, so every server except the built-in defaults is blocked. A server whose URL or command holds an unresolved variable such as $VARIABLE is blocked too.

Exam trap allowedMcpServers and deniedMcpServers cover servers from user and repository settings. They do not cover servers defined in repository custom agent profiles.

Step 10 of 10

  • Copilot uses a configured server's tools without asking, so allowlist read-only tools rather than *.
  • Only secrets prefixed COPILOT_MCP_ reach the MCP configuration of Copilot cloud agent.
  • Register only the base registry URL; Copilot appends /v0.1/servers itself.
  • Registry only blocks connectors and unlisted local servers; Allow all has no restrictions.
  • For the most secure restriction, use allowlists and denylists in managed-settings.json.

Sources: Configure MCP servers for your repository - GitHub Docs (opens in a new tab) · Adding MCP servers for GitHub Copilot CLI - GitHub Docs (opens in a new tab) · Configuring an MCP server allowlist for your enterprise - GitHub Docs (opens in a new tab) · Configure an MCP registry for your organization or enterprise - GitHub Docs (opens in a new tab) · Model Context Protocol (MCP) servers, registries, and allow lists - Training | Microsoft Learn (opens in a new tab) · Restrict MCP server access to a custom registry - GitHub Docs (opens in a new tab)

Check

Check: Configure MCP servers

Cards to recall, then questions on this topic. About 2 minutes. Nothing is saved without an account.

Loading the cards and questions…

Up next: Integrate agents within development environments · 11 steps + check · 7 min

Domain 2 · Topic 3 of 4

Integrate agents within development environments

Step 1 of 11

Think first When an agent runs inside your repository or CI pipeline, what actually decides what it can see, change and trigger?

Why it matters: Questions describe where an agent runs and ask which repository, branch, token or environment setting limits what it can do.

An agent works inside an execution context: a repository, a target branch, a workflow and that workflow's permissions. In CI, the agent gets only the permissions that workflow grants. The context, not the agent's own file, enforces branch scope.

Step 2 of 11

Term Meaning
Execution context The repository, target branch, executing workflow and workflow permissions an agent runs under.
Branch-based scope Limiting an agent to one branch, which the execution context enforces.
GITHUB_TOKEN A short-lived, scoped token that GitHub Actions generates for each workflow run.
Cloud sandbox The default place an agent session runs where users can choose; some entry points run only on GitHub Actions.

Step 3 of 11

Four things frame every agent task: repo, branch, workflow, permissions. The agent works in one repository and targets one branch. A workflow runs the task, and the agent gets only the permissions granted to that workflow. Check these before judging what an agent can do.

Exam trap A custom agent file does not enforce branch scope. The execution context always does, whatever the agent profile says.

Step 4 of 11

An agent reads and changes code only in its own repository. It works with that repository's issues, pull requests and workflows. Other repositories stay out of reach unless access is explicitly granted. Chat sessions are scoped by default to one organization or to the user's personal repositories. Custom agents live in .github/agents/ as files ending in .agent.md; applyTo narrows files and tools limits actions.

Step 5 of 11

In CI, the workflow becomes the agent's controlled execution path. The task gets a defined runner, trigger and repository, plus only the workflow's permissions. Copilot CLI run with GITHUB_TOKEN in an organization-owned repository bills usage to the organization. That needs an organization owner to enable the matching policy. After editing Agentic Workflows frontmatter, run gh aw compile before committing.

Example: Runs a named custom agent from a workflow step with a prompt and no user questions.

npx @github/copilot-cli --agent security-reviewer \
  -p "Review this code for vulnerabilities" --no-ask-user
  • --agent security-reviewer: picks the custom agent to run
  • -p: passes the prompt for the task

Step 6 of 11

Agent changes go on a separate branch, not directly on main. That keeps every change isolated until review. When you delegate to Copilot coding agent, you can pick a base branch other than the default. Inside a CI workflow, the workflow decides the branch, and the agent runs in that branch's context.

Step 7 of 11

An agent can branch, edit, commit and open a pull request on its own. The flow runs: pick a base branch, create a working branch, change files, commit, then open the pull request. Copilot in the cloud stops earlier: it prepares changes for review but does not automatically create or merge a pull request. Cloud sessions default to interactive mode with assisted tool approvals.

Exam trap Allow-all mode is not always available. Users can turn it on only if their enterprise has not blocked it.

Step 8 of 11

Prefer GITHUB_TOKEN for automations in organization repositories. Every API request needs a token, such as a PAT, a GitHub App token or GITHUB_TOKEN. GitHub Agentic Workflows add two guards: tokens are read-only by default, and safe outputs let the agent propose actions that a separate gated step approves.

How the token choice affects extra workflow runs

Feature GITHUB_TOKEN PAT or GitHub App token
Extra workflow runs Most actions trigger none Can trigger them, depending on configuration
Loop risk Helps prevent unintended loops Needs careful design to avoid recursive runs
Stored credentials None; a new token per run Not covered here

Step 9 of 11

Sessions run in a cloud sandbox by default, or on GitHub Actions. Both draw compute from the same monthly allowance. Some entry points run only on Actions, such as mentioning @Copilot in a pull request or giving Copilot an issue. Organization owners can set a firewall that limits which external hosts the cloud agent reaches.

Choosing where an agent session runs

Feature Cloud sandbox GitHub Actions
Default where users can choose Yes No
Environment control Not described Secrets, variables and setup steps for dependencies
Runners and networks Not described Self-hosted runners or private networking

Step 10 of 11

Environments add approvals, secret limits and target control for deployments. Each job can reference a single environment. Its protection rules must pass before the job goes to a runner, and secrets unlock only after that. Repository and organization settings also limit which workflows and actions run and what GITHUB_TOKEN may do.

Exam trap Triggers matter too, so review them carefully. Workflows that run on pull request events from forks are a higher-risk entry point for an agent.

Step 11 of 11

  • The execution context, not the custom agent, enforces an agent's branch-based scope.
  • Agents stay in their own repository unless access to another one is explicitly granted.
  • In CI, the workflow picks the branch, runner, trigger and permissions for the agent.
  • GITHUB_TOKEN rarely triggers extra runs; PATs and App tokens can cause loops.
  • Environment protection rules must pass before a job reaches a runner or its secrets.

Sources: Execution context and boundaries - Training | Microsoft Learn (opens in a new tab) · Copilot CLI in GitHub Actions - GitHub Docs (opens in a new tab) · Managing GitHub Copilot in the cloud for your enterprise or organization - GitHub Docs (opens in a new tab) · Develop agentic workflows in GitHub Actions - GitHub Docs (opens in a new tab) · Agent execution limits and protections - Training | Microsoft Learn (opens in a new tab) · How agents interact with GitHub APIs and workflows - Training | Microsoft Learn (opens in a new tab) · Deployment environments - GitHub Docs (opens in a new tab)

Check

Check: Integrate agents within development environments

Cards to recall, then questions on this topic. About 2 minutes. Nothing is saved without an account.

Loading the cards and questions…

Up next: Operate agents with safe execution paths and robust error handling · 10 steps + check · 6 min

Domain 2 · Topic 4 of 4

Operate agents with safe execution paths and robust error handling

Step 1 of 10

Think first When an agent hits an error mid-task, how should it retry, stop or involve a person, and how do you trace what it did?

Why it matters: Questions describe an agent error or risky action and ask which hook, retry, escalation path or audit record handles it.

Hooks let you intercept errors and tool calls, so you can retry, skip or abort, and approve or deny risky actions. When the firewall blocks a request, a visible warning reports it. Signed commits with linked session logs make every agent change traceable.

Step 2 of 10

Term Meaning
onErrorOccurred A Copilot SDK hook that is called when an error occurs during session execution.
errorHandling A hook output field that sets the response to an error: retry, skip or abort.
preToolUse A hook that runs before the agent uses any tool and can approve or deny that use.
Co-author The developer who assigned the issue or asked for the change, credited on Copilot's commits.

Step 3 of 10

onErrorOccurred runs when a session hits an error. Its errorContext input says where the error arose: model_call, tool_execution, system or user_input. One use is triggering alerts for critical errors. Returning null or undefined keeps the default handling. The agent hook event errorOccurred can also log errors, send notifications and track error patterns.

Exam trap The Java SDK has no onErrorOccurred hook. It uses EventErrorPolicy and EventErrorHandler instead.

Step 4 of 10

The hook's output fields decide what happens next. Set errorHandling to pick the response, and retryCount to cap how many retries run. Use suppressOutput only when the user should not see the error output.

Error hook output fields and what they control

Output field Value Effect
errorHandling retry, skip or abort How the error is handled
retryCount A number How many retries run when errorHandling is retry
suppressOutput true The error output is hidden from the user

Step 5 of 10

Stuck cloud agent work has simple manual retries. If a session on GitHub Actions stays stuck, unassign the issue and assign it to Copilot again. If Copilot stalls on a pull request comment, post that comment again. To watch progress, open View session on the "Copilot started work" event; its logs stream live.

Exam trap Commenting on a merged or closed pull request will not restart Copilot. It responds to mentions only while the pull request is open.

Step 6 of 10

preToolUse can approve or deny any tool call. Use it to block dangerous commands or require approval for sensitive operations. postToolUse runs after every tool, successful or failed, and can send failure alerts. In Copilot CLI, you can reject a tool permission request with inline feedback. Copilot cloud agent reads hooks only from the default branch.

Step 7 of 10

Blocked requests surface as visible warnings. When the firewall blocks a request, a warning naming the address and command appears in the pull request body or a comment. The firewall limits internet access by default to manage data exfiltration risk. A ruleset or branch protection rule can block Copilot's pull requests. Repository administrators can set a ruleset bypass for Copilot.

Step 8 of 10

Copilot can test its work in an ephemeral environment. There it runs automated tests and linters before it pushes. It does this most reliably with clear instructions, best kept in .github/copilot-instructions.md. After pushing, Agent Merge, turned on with Watch and fix, works on failed workflows, merge conflicts, or both.

Exam trap An attached image over 3.00 MiB never reaches Copilot cloud agent. It is removed from the request.

Step 9 of 10

Every agent commit links to its session logs. That link shows reviewers and auditors why a change was made. Commits are authored by Copilot, with the requesting developer as co-author, and signed so GitHub shows them as "Verified". Administrators can see session logs and audit log events. Chat data for sessions on GitHub Actions is kept for 28 days.

Step 10 of 10

  • The errorHandling output of onErrorOccurred can be retry, skip or abort.
  • retryCount sets how many retries run when errorHandling is retry.
  • preToolUse can deny a tool call; postToolUse runs after success or failure.
  • Retry a stuck session by unassigning the issue and assigning Copilot again.
  • Copilot's signed commits link to session logs and credit the requester as co-author.

Sources: Error handling hook - GitHub Docs (opens in a new tab) · Hooks for GitHub Copilot - GitHub Docs (opens in a new tab) · Troubleshooting GitHub Copilot cloud agent - GitHub Docs (opens in a new tab) · Risks and mitigations for GitHub Copilot cloud agent - GitHub Docs (opens in a new tab) · Managing agent sessions - GitHub Docs (opens in a new tab) · Steering agents in GitHub Copilot CLI - GitHub Docs (opens in a new tab) · Customize agent workflows with hooks - GitHub Docs (opens in a new tab) · GitHub Copilot on GitHub.com and GitHub Mobile - GitHub Docs (opens in a new tab)

Check

Check: Operate agents with safe execution paths and robust error handling

Cards to recall, then questions on this topic. About 2 minutes. Nothing is saved without an account.

Loading the cards and questions…

Domain 2 · after the last topic

Domain 2 review

Each topic's Check tested it on its own; this mixes them.

Mixed quiz

Take the Domain 2 quiz

14 questions mixed from every topic in this domain, each answer explained. Mixing topics is harder than one at a time, and it is what the exam does. No account needed; with a free account your answers also build your estimated exam score.

Flashcards

Domain 2 flashcards

8 cards with this domain's key facts. Flip each one and check what you knew. No account needed.

Test yourself in exam conditions

A full GitHub Certified: Agentic AI Developer mock exam: 60 questions in 120 minutes, scored against the real exam's pass mark. Your first one is free.

Start a free mock exam
Next domain · 10–15% of the examManage memory, state, and execution3 topics

Report a problem

On “”. Tell us what looks wrong; we read every report.

What is the problem?

Optional.