github / github/copilot-cli

Support explicit inline custom agent invocation and agent chaining within prompts

Open
#4,208 0 comments 4 reactions 0 assignees View on GitHub
area:agents
Dominant language
Shell
Stars
11.2k
Forks
1.9k
Avg merge
14h 16m
Merged PRs (30d)
6

Description

### Describe the feature or problem you'd like to solve

Copilot CLI currently supports custom agents from .github/agents, but there is no clear, concise way to explicitly invoke a specific agent in the middle of a prompt while preserving the current conversation context and accumulated results. Today, users can select an agent before a task or rely on automatic delegation. However, complex workflows often require intentionally switching between specialized agents during a single task. For example, I may want to: Analyze a codebase using the default agent. Pass the findings to a custom architecture-review agent. Pass the review results to a migration-planning agent. Generate implementation tasks using another specialized agent. The lack of an explicit inline invocation mechanism makes these multi-agent workflows harder to express, less predictable, and more dependent on model inference.

### Proposed solution

Add inline agent invocation syntax that allows users to explicitly delegate part of a workflow to a named custom agent while preserving prior context and generated artifacts.

### Example prompts or workflows

// assuming that '$' would be a trigger to call existing agents selection, like '@' does for files

> Analyze the repository and identify technical debt.
>
> $agent: architecture-review
> Review the findings and propose architectural improvements.
>
> $agent: migration-planner
> Create a phased migration plan based on the review.

### Additional context

Custom agents are one of the most powerful extensibility features in Copilot CLI. Explicit agent invocation would make agent-based workflows easier to discover, document, reproduce, and share among team members.

It would also reduce ambiguity around whether Copilot has actually used a particular custom agent or simply attempted to perform the task itself. For advanced users who invest in creating specialized agents, deterministic invocation would significantly improve confidence and workflow predictability.

Contributor guide

Open the contributing guide

Research direction

The issue names .github/agents and the existing custom-agent selection as starting points; inspect how prompts select agents and how conversation context and generated artifacts are retained. Define and validate inline syntax for invoking named agents and chaining their results, with completion shown by the example workflow working predictably.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
ai, cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.