Integrate agents within development environments
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 the agent runs decides what it can reach
- Which MCP file each session harness reads
- Stdio MCP servers need attached, clean streams
- Worktree sessions keep agent edits out of your primary worktree
- Reviewing agent edits depends on the session harness
- How the agent's terminal succeeds or stalls
- Preparing the cloud environment before the agent starts
- Choosing a runner the cloud agent can work with
- Where cloud-agent hooks are discovered, and what they run with
- The cloud agent's working-branch scope
- Which custom-agent definition a task gets
- Driving agents from scripts and workflows
- Pull-request base and head in agent workflows
Where the change belongs
| Requirement or symptom | Where to make the change | What it governs | What it does not govern |
|---|---|---|---|
| A server must run on the laptop while the editor is connected to a remote machine | MCP scope: user profile versus workspace or remote user settings | Which machine starts the server process | Whether the Agent Host reads the file natively |
| An Agent Host session (the current VS Code chat harness, not a machine) is missing a server defined in `.vscode/mcp.json` | Check whether the definition uses `${input:...}` values: VS Code does not forward servers that require them; for native configuration use workspace `.mcp.json` or user `~/.copilot/mcp-config.json` | Configuration the Agent Host reads itself rather than through forwarding | The `.vscode/mcp.json` servers VS Code already forwards |
| The cloud agent needs `uv`, `pipx` or a project toolchain that the runner lacks | `copilot-setup-steps.yml`, merged to the default branch | What exists in the environment before the agent starts | The agent's prompt, its tool allowlist, or its working-branch scope |
| The agent must be able to push somewhere other than a fresh `copilot/` branch | How the task is started — `@copilot` on an existing pull request | Which single branch receives the agent's commits | Branch protection and required checks, which still apply |
| A setup step needs to read the repository | `permissions` on the `copilot-setup-steps` job | What the setup steps themselves may do | Copilot's own working-branch scope |
| A cloud-agent hook must notify an external service during a session | Where the integrated firewall is in use, an administrator-configured allow rule; plus the hook on the default branch | Whether that firewall lets the destination be reached | Which credentials the hook sandbox provides |
| A workflow step must hand the agent one instruction and then continue | Copilot CLI `-p`/`--prompt` | Execute-and-exit behaviour for the step | Which custom agent runs, which `--agent` selects |
| `gh workflow run` reports that the workflow cannot be dispatched | The target workflow's `on:` triggers | Whether a `workflow_dispatch` event is accepted | Which branch the resulting pull request targets |
| Clients fail to initialize a locally launched MCP server | Where the launcher writes its diagnostics | Whether stdout carries only valid protocol messages | Whether stderr output means the server failed |
| The integrated firewall cannot be used because the runner is self-hosted or Windows | Network controls outside the integrated firewall | How outbound network traffic (egress) is restricted for that runner | Whether the agent is compatible with the runner at all |
Decision tree
Cheat sheet
Unlock with Premium — includes all practice exams and the complete study guide.