gh-agent
GitHub Copilot CLI custom agent invocation
TLDR
SYNOPSIS
gh copilot --agent name [--prompt text] [options]
DESCRIPTION
gh agent functionality is provided through GitHub Copilot CLI's custom agent system, accessible via `gh copilot --agent` or the `/agent` slash command in an interactive session. Agents are defined by Markdown files with an `.agent.md` extension that specify the agent's name, description, prompt instructions, and available tools.Custom agents can be defined at user level (~/.copilot/agents/), repository level (.github/agents/), or organization level ({org}/.github/agents/). In case of naming conflicts, user-level agents override repository-level, which override organization-level.The `/delegate` slash command commits unstaged changes to a new branch and delegates the task to the Copilot coding agent, which opens a draft pull request and works in the background.
PARAMETERS
--agent name
Specify the custom agent to use (matches the .agent.md filename).--prompt text
Provide a prompt for programmatic (non-interactive) usage.--allow-tool tool
Specify tools the agent can use (shell, write, url, MCP server tools).
SEE ALSO
gh-copilot(1), gh(1)
