This extension provides a set of Language Model Tools for Copilot agent mode, enabling one Copilot instance to initiate, monitor, and receive results from another asynchronous Copilot task.
It allows a primary Copilot agent to delegate a task to a secondary Copilot agent running in a separate chat session, track the progress of this sub-task, and retrieve its outcome.
- Asynchronous Task Delegation: Copilot can start a new Copilot agent session (sub-agent) with a custom prompt without blocking its own execution.
- Session Tracking: Uses unique session IDs (UUIDs) to track each delegated task.
- Status Monitoring: Provides a tool for the primary agent to poll the status (
pending,completed,error) of the sub-task. - Result Retrieval: Allows the primary agent to retrieve the final result or error message from the completed sub-task.
- Completion Signaling: Includes a tool for the sub-agent to signal its completion or failure back to the tracking system.
- Initiation: The primary Copilot agent calls the
copilot-task-delegate_starttool with a prompt. - Session ID: The tool immediately returns a unique
sessionId(UUID) to the primary agent. - Sub-Agent Spawn: In the background, the extension prepares a modified prompt (instructing the sub-agent to report back upon completion using
copilot-task-delegate_complete) and opens a new VS Code agent chat session with this prompt, effectively spawning the sub-agent. - Polling (Optional): The primary agent can periodically call the
copilot-task-delegate_statustool with thesessionIdto check if the sub-task is stillpendingor has finished. - Completion: Once the sub-agent completes its assigned task, it must call the
copilot-task-delegate_completetool, providing the originalsessionIdand either aresultor anerrormessage. - Result Retrieval: The primary agent calls
copilot-task-delegate_statusagain. The status will now becompletedorerror, and the corresponding result or error message will be included in the response.
copilot-task-delegate_start- Purpose: Starts the asynchronous sub-agent task.
- Input:
prompt(string, Markdown supported). - Output: Confirmation message with the unique
sessionId(string, UUID).
copilot-task-delegate_status- Purpose: Checks the status and result/error of a sub-agent task.
- Input:
sessionId(string, UUID). - Output: JSON string representing the current state (
{status: 'pending'|'completed'|'error', result?: any, error?: string, startTime: number}).
copilot-task-delegate_complete- Purpose: Used by the sub-agent to signal completion or failure.
- Input:
sessionId(string, UUID),result(string, optional),error(string, optional). One ofresultorerrormust be provided. - Output: Confirmation message.
This extension is designed for interaction between Copilot agents via tool calling. Direct user invocation of these tools is not the intended use case.
A primary agent could be configured with a persona prompt to manage complex tasks by delegating them to sub-agents. See the example prompt file:
This example prompt ("Experimental Commander") outlines how a primary agent might:
- Break down a large task.
- Use
copilot-task-delegate_startto initiate sub-tasks. - Instruct the sub-agent on context, scope, and the requirement to call
copilot-task-delegate_completeupon finishing. - Potentially use
copilot-task-delegate_statusto monitor progress.
To build a VSIX package:
npm run vsixAGPL-3.0-or-later
