◀ Playbook index
NO.07

Custom Agent

Updated: 2026-07-22

In a nutshell

A Custom Agent is a specialist profile that hands Copilot a role, tools, and behavior all at once.

Even with the "same AI", you can switch between personas like Planner, Reviewer, and Tester — each with its own permissions.

What does it lock in?

A Custom Agent locks in not just a prompt, but the entire “working style” of an agent.

ElementWhat does it define?Example
IdentityWhat persona to adoptPlanner, Security Reviewer, Test Specialist
DescriptionWhen to invoke it”When creating a plan before implementation”
ToolsWhich tools to useread, search, edit, agent, github/*
AgentsWhich subagents it can delegate to (requires agent in tools)Explore, *
ModelWhich model to run onStrong model for design, fast model for exploration
TargetWhich runtime to targetgithub-copilot, vscode
MCPDedicated external toolsJira, Figma, Playwright, internal API
PromptDecision criteria & output formatSuccess criteria, restrictions, review focus

Two scopes

👥 Team shared👤 Personal
📁 Location.github/agents/*.agent.md~/.copilot/agents/
🎯 ScopeThat repository / workspaceAll your workspaces
🤝 SharingManaged in Git, shared with teamLocal only
💡 Use caseTeam-standard Planner / Reviewer / TesterPersonal work style & preferences

Inside .agent.md

A Custom Agent is a Markdown file. The YAML frontmatter at the top is configuration; the body below is the instruction to the agent. For all configurable fields, see the Custom agents configuration reference.

---
name: design-reviewer
description: Review UI differences between Figma and implementation
target: github-copilot
model: Claude Sonnet 4.5
tools:
  - read
  - search
  - github/pull-request-read
  - figma/*
mcp-servers:
  figma:
    type: local
    command: npx
    args: ["-y", "figma-mcp-server"]
---

# Role

You are a design reviewer for UI implementations.
Compare Figma specifications against Pull Request diffs and review only visual differences: appearance, spacing, colors, and state variations.

# Rules

- Do not edit code
- Separate blocking vs. non-blocking findings
- Always include reproduction steps and screen widths to check
- Only flag issues grounded in Figma or the diff — no guesses

A good Custom Agent is defined not by “who” it is, but by which decisions to delegate to it.

Built-in agent examples

Copilot Chat and CLI come with purpose-built agents out of the box.
Custom Agents are the mechanism for extending this to your own team.

SurfaceAgentWhat does it do?
Copilot Chat / VS CodeAskAnswers questions without making changes
Copilot Chat / VS CodeExploreFast read-only codebase exploration and Q&A subagent
Copilot Chat / VS CodePlanResearches and outlines multi-step plans
Copilot CLIExploreQuick codebase analysis. Ask questions about the code without adding to the main context
Copilot CLITaskRuns commands such as tests and builds, returning a brief summary on success and full output on failure
Copilot CLIGeneral-purposeHandles complex multi-step tasks requiring the full toolset and high-quality reasoning in a separate context
Copilot CLIRubber-duckGives high-signal feedback on plans and implementations, catching bugs, logic errors, and design flaws (never edits code)
Copilot CLICode-reviewReviews changes and surfaces only genuinely important issues with low noise
Copilot CLIResearchA subagent that runs thorough searches: digs through GitHub repos, fetches files, and reports findings with citations
Copilot CLISecurity-reviewReviews changes for high-confidence security vulnerabilities (11 categories) with severity and confidence scores

Display names may appear shortened depending on the UI preview, but the official CLI names are General-purpose and Code-review. For how to create custom agents in the CLI, see About Copilot CLI custom agents and Create custom agents for CLI.

What happens inside the harness?

When a user invokes a Custom Agent, the harness fetches its .agent.md, narrows the available tools, injects the agent definition, and appends the prompt. The model ends up with a four-layer context: SYSTEM & TOOLS / INSTRUCTIONS / CUSTOM AGENT / PROMPT.

USER "/TDD-RED ADD API ENDPOINT" CUSTOM AGENT PROMPT HARNESS RETRIEVES .agent.md FILE HARNESS ADJUSTS AVAILABLE TOOLS HARNESS INJECTS AGENT DEFINITION HARNESS APPENDS PROMPT MODEL CONTEXT SYSTEM & TOOLS INSTRUCTIONS CUSTOM AGENT PROMPT

💡 INSTRUCTIONS is already there for every run. A Custom Agent only adds the three layers above it: tool narrowing, agent definition, and prompt.

Subagents — offloading task-specific context

When you need a deep dive, have the harness spin up a subagent. It does the heavy reading in its own context window and returns only a summary to the main session.

"FIND MY FEATURE" MAIN SESSION SYSTEM & TOOLS INSTRUCTIONS PROMPT SUMMARY LLM → HARNESS "CREATE SUBAGENT" SUBAGENT SYSTEM & TOOLS INSTRUCTIONS PROMPT FILE 1 FILE 2 FILE 3 SUMMARY HARNESS PUTS SUMMARY BACK INTO MAIN

Use the Right LLM for Each Job with Custom Agents

AI models are trained on different data with different architectures. No single model is best at everything.

📚 Different Training Data
Models trained on different corpora have different knowledge gaps and strengths.
⚙️ Different Architectures
Reasoning vs speed vs context window; each model excels at different task types.
✅ Cross-Validation
Running multiple models on the same task catches bugs one model alone would miss.
🎯 Cost Optimization
The right model per task won't just be about quality, it'll be about budget.

Only Copilot lets enterprises run Claude + Gemini + Codex + Microsoft in one governed, auditable platform.

What Is the Best Model? ❌

  • “What is the best model?” ➡️ Wrong question
  • “What is the best model for this job?” ➡️ Good question
Dev TaskBest Model Cost/Performance (Example)
Writing RequirementsClaude Opus 4.8
Architecture & DesignGemini 3.1 Pro
Code PlanningClaude Opus 4.8
Code GenerationClaude Sonnet 4.6
Test CreationClaude Sonnet 4.6
Code ReviewGPT-5.5 Codex
CI/CD & AutomationGPT-5.4 Codex
DocumentationGemini 3.1 Pro
High Volume & CostMAI-Code-1-Flash
● Anthropic  ● OpenAI  ● Google  ● Microsoft

Sources (benchmarks): SWE-bench Verified ↗ · Terminal-Bench ↗ · Aider Polyglot ↗ · LMArena ↗. Models are examples only and vary by task and preference.