Manage agent lifecycles within workflows
Unlock the complete study guide.
Bundled into the existing Developing in Agentic AI Systems premium course — no separate purchase.
14-day money-back guarantee — no questions asked.
Included in this chapter:
- Where a worker lives decides who can use it
- A profile's two halves: frontmatter configures, body instructs
- The required field is the one that describes the work
- Two independent switches: who may pick it, and whether it is picked for you
- Registering specialists in a Copilot SDK session
- Starting an existing specialist from the CLI
- Versioning: a commit SHA, a branch, and a pull request that remembers
- When a replacement takes no effect: the most local copy of an identity wins
- When a replacement takes no effect: repository MCP settings are applied last
- Capability parity: tools that widen, tools that vanish, and tools that outrank
- Model fallback: list models in priority order
- SDK skills: a replacement worker must opt in to its own
- Retiring an agent: remove it through the source that supplies it
- Retiring a session without destroying its work
- A record you cannot see is usually a record behind a filter
Adding, versioning, and retiring a worker, by the source that supplies it
| Source | How the worker is added | Which version a run gets | How it is retired |
|---|---|---|---|
| Workspace (repository level) | A .agent.md profile committed under .github/agents, with identity and capabilities in the YAML frontmatter and role instructions in the Markdown body; the deprecated chat.agentFilesLocations setting adds other workspace folders for the Local agent only | For a task assigned on GitHub, including one started with gh agent-task create --custom-agent, the latest profile on the repository and branch the task selects, identified by that file's Git commit SHA | Delete the profile file, or use the delete action in the Configure Custom Agents menu |
| User-level agents folder | A profile in the user-level agents folder; Copilot sessions on Agent Host read ~/.copilot/agents rather than VS Code profile user data | Whatever the file currently holds for that user, across all of their workspaces | Delete the profile file from the user-level folder |
| Organization or enterprise | A central definition; an organization-level one is surfaced in VS Code once organization-agent discovery is enabled for the signed-in account | The central definition, unless a more local level - a repository copy with the same file-name identity - overrides it | Withdraw the central definition; a repository copy of the same identity keeps winning until it is removed |
| Extension | An agent contributed by an installed VS Code extension | Whatever the installed extension version provides | Uninstall the extension; hiding the agent in the agent picker only changes visibility |
| Copilot SDK session | A customAgents definition passed when the session is created, each needing a unique name and a prompt | Whatever the application passes at session creation, including its own skills, tools and model | Stop passing the definition; the registration lives and dies with the session |
Decision tree
Cheat sheet
Unlock with Premium — includes all practice exams and the complete study guide.