Chapter 15: Working with Agents — Assignment & Workflow
Part V: Agentic Development Prerequisites: Chapter 13: Copilot Coding Agent — Setup & Operations, Chapter 14: Agent Skills — Writing & Managing GH-100 Exam Mapping: Beyond GH-100 — Enterprise Copilot mastery Verified: 2026-02-01 against official documentation
1. Introduction
Learning Objectives
After completing this chapter, you will be able to:
- Design GitHub Issues optimized for agent consumption with clear acceptance criteria, small scope, and reproducible steps
- Assign multiple issues to the Copilot coding agent in a sprint-like cadence and manage parallel agent work streams
- Review and iterate on agent-generated Pull Requests (PRs) using structured feedback patterns that improve subsequent agent output
- Configure and deploy Copilot Extensions (third-party agents) and Model Context Protocol (MCP) servers for enterprise context injection
- Implement governance policies for agent-generated code including audit trails, approval gates, and quality thresholds
- Measure and optimize agent productivity across teams using quantitative metrics and feedback loops
Exam Domain Coverage
| Domain | Topics in This Chapter |
|---|---|
| Beyond GH-100 | Issue design for agents, multi-agent sprint workflows, Copilot Extensions architecture, MCP server integration, agent-human collaboration patterns, governance for agent-generated code, scaling agent usage across enterprise teams |
Chapter Overview
The previous two chapters established the foundations: Chapter 13 covered how to enable, configure, and operate the Copilot coding agent at the infrastructure level, and Chapter 14 explained how to write and manage agent skills that shape agent behavior within repositories. This chapter shifts focus from setup to daily execution. The central question is no longer "How do I turn the agent on?" but rather "How do I organize my team's work so the agent delivers production-ready contributions consistently?"
For enterprise organizations with 200 or more developers, agents represent a force multiplier, but only when integrated into existing software development lifecycle (SDLC) processes. An agent that receives a vague, sprawling issue produces code that requires more review effort than writing it manually. An agent that receives a well-scoped issue with explicit acceptance criteria, clear boundaries, and reproducible test scenarios can produce a mergeable PR in minutes. The discipline of writing agent-ready issues improves not just agent output but also human-to-human collaboration, because the same clarity that helps an agent helps a new team member.
This chapter covers the full workflow: designing issues for agent consumption, running agent-driven sprints, reviewing and iterating on agent PRs, extending the agent ecosystem with Copilot Extensions and Model Context Protocol (MCP) servers, and establishing governance guardrails for organizations scaling agent usage across dozens of teams. By the end, you will have a repeatable playbook for running agent-augmented development at enterprise scale.
2. Theory & Deep Dive
2.1 Designing Issues for Agent Consumption
The quality of an agent's output is directly proportional to the quality of the issue it receives. An issue designed for a human developer can afford to be terse because the developer can ask follow-up questions, read surrounding code for context, and make judgment calls. An agent cannot negotiate scope mid-task. It reads the issue body, the repository code, any configured skills (see Chapter 14), and produces a PR. If the issue is ambiguous, the PR will reflect that ambiguity.
The Five Properties of an Agent-Ready Issue
Every issue assigned to the Copilot coding agent should satisfy five properties:
-
Single Responsibility: The issue describes exactly one change. "Add a health check endpoint" is agent-ready. "Add a health check endpoint and refactor the middleware pipeline" is not.
-
Explicit Acceptance Criteria: Use a checklist of verifiable conditions. The agent uses these to validate its own output before opening the PR.
-
Bounded Scope: Specify which files or directories are in scope. If the change should not touch the database layer, say so.
-
Reproducible Context: Include relevant configuration values, API contract snippets, or schema fragments inline in the issue body. Do not assume the agent will find them.
-
Test Expectations: State what tests should pass, what new tests should be written, and what the expected behavior looks like.
Issue Template for Agent Assignment
Organizations should create a dedicated issue template that enforces these properties:
---
name: Agent Task
about: Issue optimized for Copilot coding agent assignment
labels: agent-task
---
## Summary
<!-- One sentence describing the change -->
## Acceptance Criteria
- [ ] Criterion 1
- [ ] Criterion 2
- [ ] Criterion 3
## Scope
- **In scope**: <!-- files, directories, modules -->
- **Out of scope**: <!-- what must NOT be changed -->
## Context
<!-- Inline any API contracts, schema fragments, config values -->
## Test Requirements
- [ ] Existing tests continue to pass
- [ ] New test: <!-- describe the test -->
## Definition of Done
- [ ] PR passes CI (Continuous Integration)
- [ ] Code reviewed by at least one human
- [ ] No new linting warnings
To create this template from the CLI:
# Create the issue template directory (bash)
mkdir -p .github/ISSUE_TEMPLATE
Then add the template file at .github/ISSUE_TEMPLATE/agent-task.md with the content above.
Enterprise Scenario: A logistics company with 250 developers noticed that 60% of agent-generated PRs required significant rework. After adopting the five-property issue format, the first-pass acceptance rate increased to 85% within two sprints. The key improvement was adding inline context -- pasting the relevant API contract directly into the issue body rather than linking to a Confluence page the agent could not access.
Common Anti-Patterns in Agent Issues
| Anti-Pattern | Problem | Fix |
|---|---|---|
| "Fix the bug" with no reproduction steps | Agent cannot identify the bug | Include stack trace, input, expected vs. actual output |
| Multi-file refactor in a single issue | Agent produces a monolithic PR that is hard to review | Split into one issue per file or module |
| References to external documents | Agent cannot browse URLs or access third-party wikis | Paste relevant content inline |
| Implicit conventions | Agent does not know your naming conventions unless told | Reference your .github/copilot-instructions.md or skills |
| Missing test expectations | Agent may skip tests or write incorrect assertions | Specify exact test scenarios in the issue |
2.2 Assigning Multiple Issues in a Sprint-Like Cadence
The Copilot coding agent can work on multiple issues concurrently. Each issue triggers an independent agent session that runs in its own sandboxed environment (see Chapter 13 for the sandbox architecture). This means you can assign five, ten, or even twenty issues to the agent simultaneously, and each one will produce a separate PR on its own branch.
The Agent Sprint Pattern
An agent sprint is a batch of issues assigned to the Copilot coding agent at the start of a development cycle. The pattern has four phases:
-
Issue Grooming: The team reviews and refines issues to meet the five-property standard. Issues that require human judgment, architectural decisions, or cross-repository coordination are excluded.
-
Batch Assignment: The team assigns the groomed issues to
@copilot(the Copilot coding agent identity). Each assignment triggers an independent agent session. -
PR Review Wave: As PRs arrive (typically within 5-30 minutes per issue), reviewers evaluate them against the acceptance criteria. PRs are approved, requested for changes, or closed.
-
Iteration: For PRs that need changes, the reviewer leaves structured feedback as PR comments. The agent reads these comments and pushes follow-up commits to the same branch.
# Assign an issue to the Copilot coding agent (bash)
gh issue edit 101 --add-assignee @copilot
# Assign multiple issues in a batch
for ISSUE_NUM in 101 102 103 104 105; do
gh issue edit "$ISSUE_NUM" --add-assignee @copilot
echo "Assigned issue #$ISSUE_NUM to @copilot"
done
# Assign multiple issues in a batch (PowerShell)
$issues = @(101, 102, 103, 104, 105)
foreach ($issue in $issues) {
gh issue edit $issue --add-assignee @copilot
Write-Host "Assigned issue #$issue to @copilot"
}
Sizing the Batch
Not all issues are suitable for agent assignment. A useful heuristic for enterprise teams:
| Issue Characteristic | Agent Suitability | Reasoning |
|---|---|---|
| New endpoint following existing pattern | High | Clear pattern to replicate |
| Bug fix with reproduction steps | High | Agent can verify the fix |
| Unit test for existing function | High | Well-bounded scope |
| Cross-module refactor | Low | Requires holistic understanding |
| Performance optimization | Low | Requires profiling and benchmarking |
| New architectural component | Low | Requires design decisions |
| Documentation update | Medium | Agent writes well but may miss context |
| Dependency upgrade | Medium | Depends on breaking changes |
Enterprise Scenario: A fintech company runs two-week sprints with 40-60 tickets per team. After adopting agent sprints, each team designates 10-15 issues per sprint as "agent-eligible." A designated "agent sprint lead" grooms these issues on Monday, assigns them on Tuesday morning, and the team reviews the resulting PRs by Wednesday. This frees human developers to focus on the complex architectural work that agents cannot handle.
Monitoring Agent Session Status
After assigning issues, track the agent's progress:
# List all open PRs created by the Copilot agent (bash)
gh pr list --author "copilot[bot]" --state open --json number,title,createdAt \
--jq '.[] | "\(.number)\t\(.title)\t\(.createdAt)"'
# Check the status of a specific agent session via the PR
gh pr view 42 --json statusCheckRollup,reviews,mergeable
2.3 Reviewing and Iterating on Agent PRs
Agent-generated PRs follow the same review process as human PRs, but the feedback mechanism differs. When a human developer receives a review comment, they interpret nuance, ask clarifying questions, and apply judgment. The agent reads the comment text literally and attempts to resolve it in a follow-up commit.
Structured Feedback for Agent Iteration
Write review comments that the agent can act on:
Effective feedback:
The function `calculateDiscount` should return 0 when the input price is negative,
not throw an exception. Add a guard clause at line 15 of src/pricing.ts that returns
0 for negative values, and add a unit test for this case.
Ineffective feedback:
This doesn't handle edge cases well. Please fix.
The first comment is actionable: it specifies the function, the file, the line, the expected behavior, and the required test. The agent can execute on it directly. The second comment is ambiguous: the agent does not know which edge cases, what "fix" means, or where to look.
The Review Checklist for Agent PRs
Enterprise teams should use a consistent checklist when reviewing agent-generated PRs:
- Correctness: Does the code do what the issue asked for? Check each acceptance criterion.
- Scope compliance: Did the agent stay within the boundaries specified in the issue? Check for unrelated file changes.
- Test coverage: Did the agent write the tests specified in the issue? Do they pass?
- Code style: Does the code follow the repository's conventions? The agent respects
.github/copilot-instructions.mdand skills, but may drift. - Security: Does the code introduce hardcoded secrets, SQL injection vectors, or insecure defaults? Agent-generated code must pass the same security review as human code.
- Performance: Are there obvious inefficiencies such as N+1 queries, unbounded loops, or excessive memory allocation?
# Approve an agent PR after review (bash)
gh pr review 42 --approve --body "All acceptance criteria met. Tests pass. Merging."
# Request changes with structured feedback
gh pr review 42 --request-changes --body "Two issues:
1. src/api/handler.ts line 23: Missing null check on request.body.userId — add guard clause returning 400.
2. tests/api/handler.test.ts: Add test case for empty request body."
Enterprise Scenario: A healthcare platform with 300 developers established a rule: every agent-generated PR must receive at least one human review before merge, regardless of the change size. They created a GitHub Actions workflow that automatically adds the
agent-generatedlabel to PRs fromcopilot[bot]and requires approval from a CODEOWNERS-designated reviewer. This ensures compliance with their SOC 2 (Service Organization Control Type 2) audit requirements.
2.4 Copilot Extensions: Third-Party Agents in Chat
Copilot Extensions extend the GitHub Copilot ecosystem beyond code generation. They are third-party applications that integrate into the Copilot Chat interface, allowing developers to interact with external services, databases, monitoring tools, and domain-specific knowledge bases directly from the IDE or github.com.
How Extensions Work
A Copilot Extension is a GitHub App that implements the Copilot agent protocol. When a user invokes an extension in chat using the @extension-name mention syntax, GitHub routes the conversation to the extension's backend, which processes the query and returns a response.
Extensions can:
- Access external APIs and data sources on behalf of the user
- Execute queries against databases, monitoring systems, or documentation platforms
- Provide domain-specific knowledge that the base Copilot model does not have
- Perform actions such as creating tickets, updating configurations, or triggering deployments
Installing and Managing Extensions
Extensions are installed at the organization level by administrators:
# List available Copilot Extensions in the GitHub Marketplace (bash)
gh api /marketplace_listing/stubbed/search \
--jq '.applications[] | select(.copilot_extension) | .name'
# View installed extensions for your organization
gh api /orgs/my-org/copilot/extensions --jq '.[].name'
Organization administrators control which extensions are available to members through the Copilot policy settings (see Chapter 5: Copilot Policies & Content Controls).
Building a Custom Copilot Extension
For enterprise teams that need domain-specific integrations, building a custom Copilot Extension involves:
- Create a GitHub App: Register a new GitHub App with Copilot extension capabilities enabled.
- Implement the Agent Protocol: Build a backend service that handles the Copilot agent protocol -- receiving conversation context and returning structured responses.
- Deploy and Register: Host the backend service and configure the GitHub App's webhook URL to point to it.
- Install in Organization: Install the GitHub App in your organization and enable it in Copilot policies.
# Create a new GitHub App for a Copilot Extension (bash)
# This is done through the GitHub UI at:
# https://github.com/organizations/my-org/settings/apps/new
# Enable "Copilot Agent" under the Copilot section
# After creation, verify the app is registered
gh api /orgs/my-org/copilot/extensions --jq '.[].name'
Enterprise Scenario: An e-commerce company with 400 developers built a custom Copilot Extension called
@inventory-agentthat connects to their internal inventory management system. When a developer types@inventory-agent what is the current schema for the product catalog?in Copilot Chat, the extension queries the internal schema registry and returns the latest Protobuf definition. This eliminates the need to switch between the IDE and internal documentation portals.
2.5 Model Context Protocol (MCP) Servers for Enterprise Context
The Model Context Protocol (MCP) is an open standard that allows AI models to interact with external tools and data sources through a unified interface. In the context of GitHub Copilot, MCP servers provide the agent with access to enterprise-specific context that lives outside the repository: internal APIs, documentation systems, configuration management databases (CMDBs), and proprietary knowledge bases.
Why MCP Matters for Enterprise Agents
The Copilot coding agent, by default, has access only to the repository contents and any configured skills. For many enterprise tasks, this is insufficient. Consider these scenarios:
- A developer asks the agent to implement a new API endpoint, but the API contract is defined in a separate service registry.
- A bug fix requires understanding a configuration value stored in HashiCorp Vault.
- A migration task requires querying the current database schema from a schema registry.
MCP servers bridge these gaps by giving the agent secure, controlled access to external data sources.
MCP Server Architecture
An MCP server exposes a set of tools (functions) that the agent can invoke. Each tool has:
- A name and description that the agent uses to decide when to invoke it
- An input schema (JSON Schema) that defines the parameters
- An implementation that performs the action and returns results
MCP servers can be configured at the repository level using the .github/copilot/mcp.json configuration file:
{
"mcpServers": {
"schema-registry": {
"type": "http",
"url": "https://mcp.internal.example.com/schema-registry",
"headers": {
"Authorization": "Bearer ${MCP_SCHEMA_TOKEN}"
},
"tools": ["get_table_schema", "list_tables", "get_migration_history"]
},
"feature-flags": {
"type": "http",
"url": "https://mcp.internal.example.com/feature-flags",
"headers": {
"Authorization": "Bearer ${MCP_FLAGS_TOKEN}"
},
"tools": ["get_flag_status", "list_flags_for_service"]
}
}
}
Secrets referenced via ${VARIABLE_NAME} are resolved from the repository's GitHub Actions secrets, ensuring that sensitive credentials are never stored in plaintext.
Deploying MCP Servers
Enterprise teams typically deploy MCP servers as internal microservices behind their corporate network or VPN (Virtual Private Network). The deployment pattern involves:
- Build the MCP Server: Implement the MCP protocol handler with your enterprise-specific tools.
- Secure the Endpoint: Use mutual TLS (mTLS) or token-based authentication. Restrict network access to GitHub's IP ranges.
- Register in Repository: Add the server configuration to
.github/copilot/mcp.json. - Test with Agent: Assign an issue that requires the MCP server's data and verify the agent invokes the tools correctly.
# Verify MCP configuration is valid JSON (bash)
python3 -c "import json; json.load(open('.github/copilot/mcp.json')); print('Valid')"
# Test an MCP server endpoint manually using curl
curl -s -H "Authorization: Bearer $MCP_SCHEMA_TOKEN" \
https://mcp.internal.example.com/schema-registry/tools \
| python3 -m json.tool
Enterprise Scenario: A banking institution with 500 developers deployed three MCP servers: one for their internal API gateway catalog, one for their compliance rule engine, and one for their database schema registry. When the Copilot coding agent works on an issue, it can query the API catalog to discover available endpoints, check compliance rules before generating code that handles sensitive data, and retrieve the current database schema to write accurate migration scripts. The MCP servers run behind their corporate VPN and authenticate using short-lived tokens rotated every 4 hours.
2.6 Custom Agents via Copilot Agent Mode
Beyond the built-in Copilot coding agent and Copilot Extensions, organizations can create custom agent personas by combining skills (Chapter 14), custom instructions, and MCP servers. These custom agents are not separate applications but rather configurations that shape how the Copilot coding agent behaves within a specific repository or context.
Creating Specialized Agent Personas
A repository can define multiple skill files that, when combined with custom instructions, create specialized behavior profiles:
- Security Reviewer Agent: Skills focused on OWASP (Open Web Application Security Project) vulnerability patterns, with instructions to flag insecure coding practices.
- Migration Agent: Skills that understand the organization's database migration framework, with MCP access to the schema registry.
- API Agent: Skills containing the organization's API design standards (REST naming conventions, pagination patterns, error response formats).
These personas are activated by referencing the relevant skills in the issue body or by structuring the repository's .github/copilot-instructions.md to load them conditionally.
Agent Mode in the IDE
Copilot agent mode in VS Code and other supported IDEs allows developers to use the agent interactively. Unlike the coding agent (which operates asynchronously on issues), agent mode operates synchronously within the editor:
- The developer describes a task in the Copilot Chat panel.
- The agent proposes a plan, including which files to create or modify.
- The developer approves, modifies, or rejects the plan.
- The agent executes the approved plan, making changes to the workspace.
- The developer reviews the changes and provides follow-up instructions.
This interactive loop is particularly useful for exploratory tasks where the scope is not fully defined upfront, unlike the issue-based workflow which requires clear upfront specification.
2.7 Agent-Human Collaboration Patterns
Effective agent usage is not about replacing human developers but about optimizing the division of labor. Enterprise teams that achieve the highest productivity gains follow deliberate collaboration patterns.
The Triage Pattern
Human: Designs architecture and creates well-scoped issues
Agent: Implements issues and opens PRs
Human: Reviews PRs and provides feedback
Agent: Iterates based on feedback
Human: Approves and merges
This pattern works best for feature development where the architecture is established and the work can be decomposed into independent units.
The Pair Programming Pattern
Human: Works in IDE with agent mode active
Agent: Suggests implementations, generates tests, explains code
Human: Accepts, modifies, or rejects suggestions in real time
This pattern works best for exploratory development, debugging, and learning new codebases.
The Assembly Line Pattern
Agent A: Generates initial implementation from issue
Human: Reviews and approves
Agent B: Generates tests for the approved implementation
Human: Reviews test coverage
Agent C: Generates documentation for the feature
Human: Final review and merge
This pattern is aspirational and requires Copilot Extensions or multiple tool integrations, but it illustrates the direction enterprise agent workflows are heading.
Enterprise Scenario: A media company with 200 developers adopted the Triage Pattern for their mobile backend team. The tech lead spends Monday mornings writing 8-12 agent-ready issues for the week. The agent produces PRs by Monday afternoon. The team spends Tuesday through Thursday reviewing and iterating on agent PRs while working on complex features themselves. Friday is reserved for integration testing and retrospective. The team's throughput increased by 35% in the first quarter after adoption.
2.8 Scaling Agent Usage Across Teams
Moving from a single team experiment to organization-wide agent adoption requires infrastructure, process standardization, and cultural change.
Centralized Issue Templates
Create organization-wide issue templates that enforce the five-property format. Store these in the .github repository (the organization's default community health files repository):
# Create the organization's default issue template (bash)
gh repo clone my-org/.github
cd .github
mkdir -p .github/ISSUE_TEMPLATE
Then distribute the agent-task.md template shown in Section 2.1 to all repositories automatically.
Agent Usage Dashboards
Track agent adoption and effectiveness across the organization:
# Count agent-generated PRs per repository in the last 30 days (bash)
gh api graphql -f query='
query {
search(
query: "org:my-org author:app/copilot-swe-agent is:pr created:>2026-01-01"
type: ISSUE
first: 100
) {
issueCount
edges {
node {
... on PullRequest {
repository { name }
state
merged
}
}
}
}
}
' --jq '.data.search'
Key metrics to track:
| Metric | Description | Target |
|---|---|---|
| First-Pass Acceptance Rate | % of agent PRs approved without revision | > 70% |
| Time to First Review | Hours between PR creation and first human review | < 4 hours |
| Iteration Count | Average number of review cycles before merge | < 2 |
| Agent PR Merge Rate | % of agent PRs ultimately merged (vs. closed) | > 80% |
| Issue-to-PR Time | Minutes from issue assignment to PR creation | < 30 min |
| Lines of Code per Agent PR | Average size of agent contributions | 50-300 lines |
Rollout Strategy
A phased rollout minimizes risk:
- Phase 1 -- Pilot (Weeks 1-4): One team, 5-10 agent issues per sprint. Establish templates and review practices.
- Phase 2 -- Expand (Weeks 5-8): Three to five teams. Standardize templates across teams. Begin tracking metrics.
- Phase 3 -- Scale (Weeks 9-16): Organization-wide rollout. Publish internal playbook. Train reviewers.
- Phase 4 -- Optimize (Ongoing): Refine issue templates based on data. Build custom MCP servers. Develop specialized skills.
2.9 Monitoring Agent Productivity
Quantitative measurement is essential for justifying and optimizing agent investment at the enterprise level.
Compute and Cost Tracking
The Copilot coding agent consumes compute resources measured in agent minutes. Enterprise administrators can monitor and set limits through organization settings:
# View current usage for the organization (bash)
gh api /orgs/my-org/copilot/usage --jq '.agent_minutes_used'
# View per-repository breakdown
gh api /orgs/my-org/copilot/usage/repos --jq '.[] | "\(.repo): \(.agent_minutes)"'
Set spending limits to prevent runaway costs:
# View current spending limit (bash)
gh api /orgs/my-org/settings/billing/copilot --jq '.spending_limit'
Productivity Metrics Framework
Beyond raw compute costs, measure the impact on developer productivity:
- Cycle Time Reduction: Compare time from issue creation to PR merge before and after agent adoption.
- Developer Satisfaction: Survey developers quarterly on their experience with agent workflows.
- Code Quality: Track defect rates in agent-generated code vs. human-written code over time.
- Review Burden: Measure whether agent PRs increase or decrease the time human reviewers spend per sprint.
2.10 Governance for Agent-Generated Code
Enterprise organizations in regulated industries must maintain audit trails and compliance controls for all code changes, regardless of whether a human or an agent wrote them.
Labeling and Traceability
Automatically label agent-generated PRs for audit purposes:
# .github/workflows/label-agent-prs.yml
name: Label Agent PRs
on:
pull_request:
types: [opened]
jobs:
label:
runs-on: ubuntu-latest
if: github.actor == 'copilot-swe-agent[bot]'
permissions:
pull-requests: write
steps:
- name: Add agent-generated label
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit ${{ github.event.pull_request.number }} \
--add-label "agent-generated" \
--repo ${{ github.repository }}
Branch Protection for Agent PRs
Configure branch protection rules that apply equally to agent and human PRs:
- Require at least one human approval (CODEOWNERS review)
- Require all CI checks to pass (linting, tests, security scans)
- Require linear history (squash merge)
- Require signed commits where supported
# Verify branch protection includes required reviews (bash)
gh api repos/my-org/my-repo/branches/main/protection \
--jq '.required_pull_request_reviews.required_approving_review_count'
Compliance Controls
For organizations subject to SOC 2, ISO 27001, HIPAA, or similar frameworks:
- Audit Log: All agent activity is recorded in the GitHub Enterprise audit log. Ensure log forwarding to your SIEM (Security Information and Event Management) system is configured.
- Approval Gates: Use CODEOWNERS to require senior developer approval for agent PRs touching sensitive directories (e.g.,
src/auth/,src/payments/,infrastructure/). - Automated Security Scanning: Ensure GitHub Advanced Security features (CodeQL, secret scanning, Dependabot) run on every agent-generated PR before merge.
- Retention: Maintain agent PR history and review comments as part of your change management records.
Enterprise Scenario: A government contractor with 350 developers operates under FedRAMP (Federal Risk and Authorization Management Program) requirements. They configured a mandatory approval workflow where agent-generated PRs to any repository containing PII (Personally Identifiable Information) data handling code require approval from both a code owner and a security team member. The
agent-generatedlabel triggers an additional CodeQL scan with a custom query suite that checks for data classification violations. All agent activity is forwarded to their Splunk SIEM instance in real time.
3. Diagrams
Agent-Driven Sprint Workflow
flowchart TD
A[Sprint Planning] --> B[Groom Issues for Agent]
B --> C{Issue Meets\n5-Property Standard?}
C -->|No| D[Refine Issue]
D --> C
C -->|Yes| E[Add to Agent Backlog]
E --> F[Batch Assign to @copilot]
F --> G[Agent Sessions Start\nParallel Execution]
G --> H[Agent Creates Branch]
H --> I[Agent Writes Code]
I --> J[Agent Runs CI Checks]
J --> K[Agent Opens PR]
K --> L{Human Review}
L -->|Approved| M[Merge PR]
L -->|Changes Requested| N[Reviewer Adds\nStructured Feedback]
N --> O[Agent Reads Comments]
O --> P[Agent Pushes\nFollow-Up Commits]
P --> L
L -->|Rejected| Q[Close PR\nRewrite Issue]
Q --> B
M --> R[Issue Closed\nMetrics Recorded]
style A fill:#e1f5fe
style F fill:#fff3e0
style G fill:#f3e5f5
style L fill:#fff9c4
style M fill:#c8e6c9
style Q fill:#ffcdd2
Figure 15.1: Agent-driven sprint workflow showing the lifecycle from issue grooming through batch assignment, parallel agent execution, human review, iteration via structured feedback, and final merge. The feedback loop between review and agent iteration is the critical path for quality.
Copilot Extensions Architecture
flowchart LR
subgraph Developer["Developer Environment"]
A1[IDE / Copilot Chat]
A2[github.com Chat]
end
subgraph GitHub["GitHub Platform"]
B1[Copilot Chat Router]
B2[Extension Registry]
B3[Auth & Permissions]
end
subgraph Extensions["Copilot Extensions"]
C1["@sentry-agent\n(Error Tracking)"]
C2["@datadog-agent\n(Monitoring)"]
C3["@internal-docs\n(Custom Extension)"]
end
subgraph Backends["Extension Backends"]
D1[Sentry API]
D2[Datadog API]
D3[Internal Wiki API]
end
A1 -->|"@extension-name query"| B1
A2 -->|"@extension-name query"| B1
B1 --> B2
B2 --> B3
B3 -->|Authorized| C1
B3 -->|Authorized| C2
B3 -->|Authorized| C3
C1 --> D1
C2 --> D2
C3 --> D3
D1 -->|Response| C1
D2 -->|Response| C2
D3 -->|Response| C3
C1 -->|Formatted Answer| B1
C2 -->|Formatted Answer| B1
C3 -->|Formatted Answer| B1
B1 -->|Display| A1
B1 -->|Display| A2
style Developer fill:#e3f2fd
style GitHub fill:#fce4ec
style Extensions fill:#f3e5f5
style Backends fill:#e8f5e9
Figure 15.2: Copilot Extensions architecture showing how developer queries are routed through the GitHub platform to third-party or custom extension backends. Each extension authenticates independently and returns formatted responses to the chat interface.
MCP Server Integration
flowchart TD
subgraph Repo["Repository"]
A1[".github/copilot/mcp.json"]
A2["Issue Assigned to @copilot"]
end
subgraph Agent["Copilot Coding Agent"]
B1[Read Issue & Code]
B2[Load MCP Configuration]
B3[Plan Implementation]
B4[Invoke MCP Tools]
B5[Generate Code]
B6[Open PR]
end
subgraph MCP["MCP Servers (Internal)"]
C1["Schema Registry\nget_table_schema\nlist_tables"]
C2["API Catalog\nget_endpoint_spec\nlist_services"]
C3["Compliance Engine\ncheck_data_rules\nget_classification"]
end
subgraph Security["Security Layer"]
D1[Token Rotation\n4-hour TTL]
D2[Network ACL\nGitHub IP Allow-list]
D3[Audit Logging]
end
A2 --> B1
A1 --> B2
B1 --> B3
B2 --> B3
B3 --> B4
B4 --> C1
B4 --> C2
B4 --> C3
C1 -->|Schema Data| B5
C2 -->|API Specs| B5
C3 -->|Rules| B5
B5 --> B6
D1 --> C1
D1 --> C2
D1 --> C3
D2 --> C1
D2 --> C2
D2 --> C3
D3 --> C1
D3 --> C2
D3 --> C3
style Repo fill:#e3f2fd
style Agent fill:#fff3e0
style MCP fill:#e8f5e9
style Security fill:#ffcdd2
Figure 15.3: MCP server integration showing how the Copilot coding agent reads the MCP configuration from the repository, invokes enterprise tools during code generation, and how the security layer protects MCP servers with token rotation, network ACLs, and audit logging.
4. Summary
Key Takeaways:
- Agent-ready issues must satisfy five properties: single responsibility, explicit acceptance criteria, bounded scope, reproducible context, and test expectations. Investing time in issue quality is the single most effective way to improve agent output.
- Batch assignment of issues to the Copilot coding agent enables a sprint-like cadence where 10-20 well-scoped issues can be processed in parallel, with PRs arriving within minutes for human review.
- Structured PR review feedback with specific file references, line numbers, and expected behaviors allows the agent to iterate effectively. Vague comments produce vague fixes.
- Copilot Extensions and MCP servers extend the agent's reach beyond the repository, connecting it to enterprise knowledge bases, monitoring systems, and compliance engines that are essential for production-grade code generation.
- Governance for agent-generated code -- including automatic labeling, branch protection, CODEOWNERS enforcement, and SIEM integration -- is non-negotiable for regulated enterprises and should be established before scaling agent usage beyond a pilot team.
What's Next: See Chapter 16: Training, Adoption & Change Management for strategies to roll out agent workflows across your entire organization, including developer training programs, change management frameworks, and organizational readiness assessments.
5. Hands-On Assignment
Prerequisites Check: Before starting this lab, ensure you have completed:
- Copilot coding agent enabled and tested (Chapter 13: Copilot Coding Agent — Setup & Operations)
- Custom agent skills created (Chapter 14: Agent Skills — Writing & Managing)
- A repository with multiple open issues suitable for agent assignment
Lab: Run an Agent-Driven Sprint
Objective: Design three agent-ready issues, assign them to the Copilot coding agent, review the resulting PRs, and iterate on at least one PR using structured feedback. This lab simulates the agent sprint pattern described in Section 2.2.
Prerequisites:
- A GitHub Enterprise Cloud organization with the Copilot coding agent enabled (see Chapter 13)
- A repository with an existing codebase (at least a basic web application or API with a test suite)
- Owner or admin access to the repository
- The GitHub CLI installed and authenticated (see Chapter 9)
- Agent skills configured for the repository (see Chapter 14)
Assignment:
-
Create an agent-task issue template in your repository following the five-property format from Section 2.1. Include the
agent-tasklabel. -
Write three agent-ready issues using the template. Each issue should:
- Describe a single, bounded change (e.g., add an endpoint, write a test, fix a documented bug)
- Include at least three acceptance criteria as checkboxes
- Specify in-scope and out-of-scope files
- Include inline context (e.g., API contract, schema fragment)
- Specify test requirements
-
Assign all three issues to
@copilotusing the GitHub CLI. Record the timestamp of assignment. -
Monitor the agent's progress and record the time each PR is created. Calculate the issue-to-PR time for each.
-
Review each PR against the acceptance criteria. For at least one PR, request changes using structured feedback that specifies the file, line, and expected behavior.
-
After the agent pushes follow-up commits based on your feedback, re-review and approve.
-
Create a simple metrics summary: first-pass acceptance rate, average issue-to-PR time, and iteration count for each PR.
Expected Outcome: Three agent-generated PRs in your repository, at least one of which has gone through a review iteration cycle. A metrics summary demonstrating the sprint pattern in practice.
Validation:
- Three issues with the
agent-tasklabel exist in the repository - Three PRs created by
copilot[bot]orcopilot-swe-agent[bot]are visible in the PR list - At least one PR has review comments and follow-up commits showing the iteration cycle
- All three PRs either pass CI or have clear explanations for failures
- A metrics summary file or comment documenting the sprint results
6. Step-by-Step Walkthrough
This section provides a guided solution for the hands-on assignment above. If you completed the assignment independently, you can skip this section or use it to verify your approach.
Step 1: Create the Agent-Task Issue Template
# Create the issue template directory (bash)
mkdir -p .github/ISSUE_TEMPLATE
Create the file .github/ISSUE_TEMPLATE/agent-task.md with the following content:
---
name: Agent Task
about: Issue optimized for Copilot coding agent assignment
labels: agent-task
---
## Summary
<!-- One sentence describing the change -->
## Acceptance Criteria
- [ ] Criterion 1
- [ ] Criterion 2
- [ ] Criterion 3
## Scope
- **In scope**: <!-- files, directories, modules -->
- **Out of scope**: <!-- what must NOT be changed -->
## Context
<!-- Inline any API contracts, schema fragments, config values the agent needs -->
## Test Requirements
- [ ] Existing tests continue to pass
- [ ] New test: <!-- describe the test case -->
## Definition of Done
- [ ] PR passes CI
- [ ] Code reviewed by at least one human
- [ ] No new linting warnings
Commit and push the template:
# Stage, commit, and push (bash)
git add .github/ISSUE_TEMPLATE/agent-task.md
git commit -m "Add agent-task issue template"
git push origin main
Create the agent-task label:
# Create the label (bash)
gh label create agent-task \
--description "Issue designed for Copilot coding agent" \
--color 7057ff
Expected output:
✓ Label "agent-task" created in my-org/my-repo
Step 2: Write Three Agent-Ready Issues
Create the first issue -- adding a health check endpoint:
# Create issue 1: Health check endpoint (bash)
gh issue create --label "agent-task" --title "Add /healthz endpoint" --body '## Summary
Add a GET /healthz endpoint that returns HTTP 200 with a JSON body.
## Acceptance Criteria
- [ ] GET /healthz returns HTTP 200 with body `{"status": "ok", "timestamp": "<ISO8601>"}`
- [ ] The endpoint does not require authentication
- [ ] Response Content-Type header is application/json
## Scope
- **In scope**: src/routes/ directory, src/app.ts (to register the route)
- **Out of scope**: Database layer, authentication middleware, existing endpoints
## Context
The application uses Express.js. Routes are defined in src/routes/ as individual files
and registered in src/app.ts using `app.use()`. Example existing route:
```typescript
// src/routes/users.ts
import { Router } from "express";
const router = Router();
router.get("/", (req, res) => { res.json({ users: [] }); });
export default router;
Test Requirements
- Existing tests continue to pass
- New test: GET /healthz returns 200 with valid JSON containing status and timestamp fields
- New test: GET /healthz response timestamp is a valid ISO 8601 string
Definition of Done
- PR passes CI
- Code reviewed by at least one human
- No new linting warnings'
Create the second issue -- adding input validation:
```bash
# Create issue 2: Input validation (bash)
gh issue create --label "agent-task" --title "Add request body validation to POST /users" --body '## Summary
Add Zod schema validation to the POST /users endpoint to reject invalid payloads.
## Acceptance Criteria
- [ ] POST /users validates that `name` is a non-empty string (max 100 chars)
- [ ] POST /users validates that `email` is a valid email format
- [ ] Invalid requests return HTTP 400 with `{"error": "validation_failed", "details": [...]}`
- [ ] Valid requests continue to work as before
## Scope
- **In scope**: src/routes/users.ts, package.json (to add zod dependency)
- **Out of scope**: Other routes, database schema, authentication
## Context
Zod is the organization standard for runtime validation. Install with `npm install zod`.
Example validation pattern:
```typescript
import { z } from "zod";
const schema = z.object({ name: z.string().min(1).max(100) });
const result = schema.safeParse(req.body);
if (!result.success) { return res.status(400).json({ error: "validation_failed", details: result.error.issues }); }
Test Requirements
- Existing tests continue to pass
- New test: POST /users with missing name returns 400
- New test: POST /users with invalid email returns 400
- New test: POST /users with valid body returns 201
Definition of Done
- PR passes CI
- Code reviewed by at least one human
- No new linting warnings'
Create the third issue -- adding a test for an existing function:
```bash
# Create issue 3: Missing test coverage (bash)
gh issue create --label "agent-task" --title "Add unit tests for calculateDiscount utility" --body '## Summary
Write unit tests for the existing calculateDiscount function in src/utils/pricing.ts.
## Acceptance Criteria
- [ ] Test: returns 0 when price is 0
- [ ] Test: returns correct 10% discount for orders over $100
- [ ] Test: returns correct 20% discount for orders over $500
- [ ] Test: returns 0 (no negative prices) when input is negative
- [ ] Test: throws TypeError for non-numeric input
## Scope
- **In scope**: tests/utils/pricing.test.ts (new file)
- **Out of scope**: src/utils/pricing.ts (do not modify the implementation)
## Context
The function signature is:
```typescript
// src/utils/pricing.ts
export function calculateDiscount(price: number): number
Discount rules: 0-99.99 = 0%, 100-499.99 = 10%, 500+ = 20%. Negative prices should return 0. Non-numeric input should throw TypeError. The project uses Jest for testing. Test files go in tests/ mirroring the src/ structure.
Test Requirements
- All existing tests continue to pass
- New test file tests/utils/pricing.test.ts with at least 5 test cases
Definition of Done
- PR passes CI
- Code reviewed by at least one human
- No new linting warnings'
**Expected output** (for each issue):
Creating issue in my-org/my-repo
https://github.com/my-org/my-repo/issues/1
Note the issue numbers for the next step.
### Step 3: Assign All Three Issues to the Agent
```bash
# Record the start time (bash)
echo "Agent sprint started at: $(date -u +%Y-%m-%dT%H:%M:%SZ)"
# Assign all three issues (replace with your actual issue numbers)
for ISSUE_NUM in 1 2 3; do
gh issue edit "$ISSUE_NUM" --add-assignee @copilot
echo "Assigned issue #$ISSUE_NUM to @copilot at $(date -u +%H:%M:%S)"
done
# Record the start time (PowerShell)
Write-Host "Agent sprint started at: $(Get-Date -Format 'yyyy-MM-ddTHH:mm:ssZ')"
# Assign all three issues (replace with your actual issue numbers)
foreach ($issue in @(1, 2, 3)) {
gh issue edit $issue --add-assignee @copilot
Write-Host "Assigned issue #$issue to @copilot at $(Get-Date -Format 'HH:mm:ss')"
}
Expected output:
Agent sprint started at: 2026-02-01T14:00:00Z
Assigned issue #1 to @copilot at 14:00:01
Assigned issue #2 to @copilot at 14:00:02
Assigned issue #3 to @copilot at 14:00:03
Step 4: Monitor Agent Progress
Poll for agent-generated PRs:
# Check every 2 minutes for new agent PRs (bash)
watch -n 120 'gh pr list --author "copilot[bot]" --state open \
--json number,title,createdAt \
--jq ".[] | \"PR #\(.number): \(.title) (created: \(.createdAt))\""'
Alternatively, check manually:
# Manual check for agent PRs (bash)
gh pr list --author "copilot[bot]" --state open --json number,title,createdAt
Expected output (after 5-30 minutes):
[
{
"number": 4,
"title": "Add /healthz endpoint",
"createdAt": "2026-02-01T14:08:23Z"
},
{
"number": 5,
"title": "Add request body validation to POST /users",
"createdAt": "2026-02-01T14:12:45Z"
},
{
"number": 6,
"title": "Add unit tests for calculateDiscount utility",
"createdAt": "2026-02-01T14:05:11Z"
}
]
Record the timestamps and calculate issue-to-PR times.
Step 5: Review PRs and Provide Feedback
Review the first PR:
# View the PR diff (bash)
gh pr diff 4
# View the PR details
gh pr view 4
# If acceptable, approve
gh pr review 4 --approve --body "All acceptance criteria met. Endpoint returns correct JSON structure with timestamp."
Review the second PR and request changes (demonstrating the iteration cycle):
# View the diff for the validation PR
gh pr diff 5
# Request changes with structured feedback
gh pr review 5 --request-changes --body 'Two changes needed:
1. **src/routes/users.ts line 12**: The error response format uses `message` instead of the required `error` field. Change the response to match the contract:
```json
{"error": "validation_failed", "details": [...]}
- src/routes/users.ts line 8: The email validation should use
z.string().email()instead of a custom regex pattern, per our organization standard for Zod usage.'
The agent will read the review comments and push follow-up commits. Wait a few minutes, then check:
```bash
# Check for new commits on the PR (bash)
gh pr view 5 --json commits --jq '.commits | length'
# Re-review after the agent pushes fixes
gh pr diff 5
# If the changes address the feedback, approve
gh pr review 5 --approve --body "Feedback addressed. Error format and email validation now match requirements."
Review and approve the third PR:
# Review the test PR (bash)
gh pr diff 6
gh pr review 6 --approve --body "All 5 test cases present and passing. Good coverage of edge cases."
Step 6: Compile Sprint Metrics
# Generate a metrics summary (bash)
echo "=== Agent Sprint Metrics ==="
echo "Date: $(date -u +%Y-%m-%d)"
echo ""
echo "Issue-to-PR Times:"
echo " Issue #1 (healthz): ~8 minutes"
echo " Issue #2 (validation): ~13 minutes"
echo " Issue #3 (tests): ~5 minutes"
echo " Average: ~8.7 minutes"
echo ""
echo "First-Pass Acceptance Rate: 2/3 (67%)"
echo " PR #4: Approved on first review"
echo " PR #5: Required 1 iteration"
echo " PR #6: Approved on first review"
echo ""
echo "Iteration Counts:"
echo " PR #4: 0 iterations"
echo " PR #5: 1 iteration"
echo " PR #6: 0 iterations"
echo " Average: 0.33 iterations"
Verification
Run the following commands to confirm all lab objectives are met:
# 1. Verify the issue template exists (bash)
gh api repos/my-org/my-repo/contents/.github/ISSUE_TEMPLATE/agent-task.md \
--jq '.name'
# 2. Verify the agent-task label exists
gh label list --search "agent-task" --json name --jq '.[].name'
# 3. Verify three issues with the agent-task label
gh issue list --label "agent-task" --json number,title \
--jq '.[] | "Issue #\(.number): \(.title)"'
# 4. Verify three PRs from the agent
gh pr list --author "copilot[bot]" --json number,title,state \
--jq '.[] | "PR #\(.number): \(.title) (\(.state))"'
# 5. Verify at least one PR has review iteration
gh pr view 5 --json reviews --jq '.reviews | length'
7. Q&A -- Chapter Review
Instructions: Select the best answer for each question. Answers and explanations follow after all questions.
Question 1
A team assigns an issue to the Copilot coding agent with the description "Fix the login bug." The agent produces a PR that changes the wrong file. What is the most likely root cause?
- A) The agent does not have access to the repository
- B) The issue lacks specific reproduction steps, file references, and acceptance criteria
- C) The agent's compute budget was exhausted
- D) The repository does not have branch protection enabled
Question 2
Which of the following is NOT one of the five properties of an agent-ready issue?
- A) Single responsibility
- B) Explicit acceptance criteria
- C) Estimated story points
- D) Bounded scope
Question 3
An enterprise team assigns 15 issues to the Copilot coding agent simultaneously. How does the agent handle these assignments?
- A) It processes them sequentially in the order they were assigned
- B) It processes them in parallel, each in an independent sandboxed session
- C) It batches them into groups of 5 and processes each batch sequentially
- D) It rejects assignments beyond the first 3 until those are completed
Question 4
A reviewer wants the Copilot coding agent to fix a validation error in a PR. Which review comment is most effective?
- A) "This validation is wrong. Please fix it."
- B) "The email validation in src/routes/users.ts at line 15 should use
z.string().email()instead of the custom regex. Add a test case forinvalid-emailinput." - C) "LGTM but needs some work on the validation side."
- D) "Can you improve the validation logic? It does not seem robust enough."
Question 5
What is a Copilot Extension?
- A) A VS Code extension that enhances Copilot autocomplete
- B) A GitHub App that implements the Copilot agent protocol to provide third-party capabilities in Copilot Chat
- C) A browser extension that adds Copilot to non-supported IDEs
- D) A GitHub Actions action that runs Copilot in CI pipelines
Question 6
An enterprise team configures an MCP server in .github/copilot/mcp.json. What is the primary purpose of MCP servers in the agent workflow?
- A) To replace the Copilot coding agent with a custom AI model
- B) To provide the agent with access to enterprise-specific external data sources such as schema registries and API catalogs
- C) To encrypt all agent-generated code before it is committed
- D) To route agent requests through a corporate proxy server
Question 7
Which GitHub Actions workflow configuration correctly labels PRs created by the Copilot coding agent?
- A) Trigger on
pull_request: openedand checkgithub.actor == 'copilot' - B) Trigger on
pull_request: openedand checkgithub.actor == 'copilot-swe-agent[bot]' - C) Trigger on
pushand checkgithub.event.pusher == 'copilot' - D) Trigger on
issue_comment: createdand checkgithub.actor == 'github-copilot'
Question 8
A regulated enterprise requires that all agent-generated code be reviewed by a security team member before merge. Which mechanism enforces this?
- A) A GitHub Actions workflow that blocks the merge button
- B) A CODEOWNERS file that maps sensitive directories to the security team, combined with required reviews in branch protection
- C) An MCP server that performs security scanning
- D) A Copilot Extension that runs security checks
Question 9
During an agent-driven sprint, the team observes that the first-pass acceptance rate is 40%. Which action is most likely to improve this metric?
- A) Increase the agent's compute budget
- B) Assign fewer issues per sprint
- C) Improve issue quality by adding inline context, explicit acceptance criteria, and bounded scope
- D) Switch to a different AI model
Question 10
An organization wants to track agent productivity across 50 repositories. Which metric best indicates whether the agent is producing useful output?
- A) Total number of agent PRs created
- B) Average agent compute minutes consumed per PR
- C) Agent PR merge rate (percentage of agent PRs that are ultimately merged)
- D) Number of issues assigned to the agent per sprint
Answer Key
| Q | Answer | Explanation |
|---|---|---|
| 1 | B | Vague issues without reproduction steps, file references, or acceptance criteria leave the agent guessing. The agent reads the issue literally and makes its best attempt, but without specific guidance it may target the wrong files or implement the wrong fix. |
| 2 | C | Estimated story points are a project management metric that has no bearing on agent task execution. The five properties are: single responsibility, explicit acceptance criteria, bounded scope, reproducible context, and test expectations. |
| 3 | B | The Copilot coding agent processes each assignment in an independent sandboxed session. Multiple issues run in parallel, each producing a separate PR on its own branch. This is a key enabler of the agent sprint pattern. |
| 4 | B | Effective agent feedback specifies the exact file, line number, the current problem, the expected behavior, and any additional test requirements. The agent reads comments literally, so precision directly improves the quality of follow-up commits. |
| 5 | B | A Copilot Extension is a GitHub App that implements the Copilot agent protocol. It integrates into Copilot Chat, allowing users to interact with external services (monitoring, documentation, databases) directly from the chat interface using the @extension-name syntax. |
| 6 | B | MCP servers give the Copilot coding agent access to enterprise-specific data sources that live outside the repository. This includes schema registries, API catalogs, configuration databases, and compliance engines -- all accessed through a standardized tool-calling protocol. |
| 7 | B | The Copilot coding agent creates PRs under the copilot-swe-agent[bot] actor identity. The workflow should trigger on pull_request: opened and check github.actor against this bot identity to apply the agent-generated label. |
| 8 | B | CODEOWNERS files combined with required pull request reviews in branch protection rules enforce that specific team members (such as the security team) must approve changes to designated directories. This applies equally to agent and human PRs. |
| 9 | C | A low first-pass acceptance rate almost always indicates issue quality problems. Adding inline context so the agent has all necessary information, writing explicit acceptance criteria so the agent knows what "done" looks like, and bounding scope so the agent does not make unrelated changes are the most effective improvements. |
| 10 | C | The agent PR merge rate measures the percentage of PRs that ultimately deliver value by being merged into the codebase. A high creation count with a low merge rate indicates the agent is producing unusable output. Merge rate captures both quality and relevance. |