◀ Playbook index
NO.07

Custom Agent

Updated: 2026-09-11

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)Research, Reviewer, *
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

Four scopes

The same .agent.md can be published at four levels. The wider the reach, the more governance it needs.

🏢 Enterprise🏛️ Organization👥 Repository👤 Personal
📁 LocationDesignated org’s .github-private/agents/Org’s .github or .github-private/agents/.github/agents/~/.copilot/agents/
🎯 ScopeEvery repository in the enterpriseEvery member of the organizationThat repository / workspaceAll your workspaces
🤝 Managed byEnterprise owners / AI managersOrganization ownersThe repo’s team, via GitYou only
💡 Use caseCompany-wide standards & complianceDivision-standard Planner / ReviewerProject-specific Tester / ReviewerPersonal work style & preferences

🆕 Organization and enterprise scopes are in public preview. Members receive the agents even without access to the source repository itself. 🛡️ Enterprise owners can protect agent files with a ruleset — but scope it to the designated organization, otherwise it also blocks org owners from editing organization-level agents.

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.

Agents vs. internal subagents

VS Code exposes Agent, Plan, and Ask to users. Internal helpers such as searchSubagent are tools invoked by another agent, not selectable .agent.md profiles.

SurfaceAgent / toolWhat does it do?
Copilot Chat / VS CodeAgentImplements complex tasks with editing and tool access
Copilot Chat / VS CodeAskAnswers questions and researches without making changes
Copilot Chat / VS CodePlanResearches and outlines multi-step plans
VS Code internalsearchSubagentRuns isolated, parallel codebase research and returns a summary

🔑 VS Code’s former Explore behavior now appears through searchSubagent. Its prompt and tool are implemented in TypeScript/TSX, so there is no editable Explore .agent.md.

Copilot CLI built-in subagents

AgentBest for
ExploreFast, read-only codebase research
TaskRunning tests, builds, and verbose commands
General-purposeComplex multi-step work with the full toolset
Rubber-duckIndependently reviews plans and implementations. Assign it a different model with /subagents to test work from a perspective other than the model that created it
Code-reviewHigh-confidence review of a diff
ResearchThorough GitHub and web research with citations
Security-reviewHigh-confidence vulnerability review

🦆 Rubber-duck’s strength is cross-model review. Instead of asking a model to evaluate its own work, use another model to critique the plan or implementation and expose blind spots or reasoning biases.

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.