Coding agents delegate isolated work to named subagents with their own context
Answer: Subagents are specialized agents that operate within your main Gemini CLI session. They handle specific, complex tasks without cluttering the main agent's context or toolset. Each subagent is exposed as a tool of the same name. Calling that tool is how the main agent delegates the task.
Gemini CLI usage
You can use subagents through automatic delegation. You can explicitly direct a task to a specific subagent. Use the @ symbol followed by the subagent's name at the beginning of your prompt. Interactions with a subagent happen in a separate context loop.
OpenCode
Create a Markdown file to add a reusable agent. Save Markdown agents under ~/.config/opencode/agents for all projects. Save them under .opencode/agents inside a project. Frontmatter can set mode: subagent. The Markdown body becomes the agent's system prompt. You can also define agents under agents in an OpenCode configuration file.
See also
Claims
- id: C1 claim: Gemini subagents operate within the main CLI session. source: S1 evidence: "Subagents are specialized agents that operate within your main Gemini CLI"
- id: C2 claim: The main agent calls a tool of the same name to delegate. source: S1 evidence: "Subagents are exposed to the main agent as a tool of the same name"
- id: C3 claim: OpenCode adds a reusable agent as a Markdown file. source: S2 evidence: "Create a Markdown file to add a reusable agent"
- id: C4 claim: An OpenCode example sets mode to subagent in front matter. source: S2 evidence: "mode: subagent"
Sources
- [S1] Subagents (Gemini CLI docs). google-gemini/gemini-cli (GitHub). https://github.com/google-gemini/gemini-cli/blob/main/docs/core/subagents.md . License: Apache-2.0. Accessed 2026-11-16.
- [S2] Agents (OpenCode docs). anomalyco/opencode (GitHub). https://github.com/anomalyco/opencode/blob/dev/services/site/src/docs/content/agents.mdx . License: MIT. Accessed 2026-11-16.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: google-gemini/gemini-cli (GitHub), Subagents (Gemini CLI docs), Apache-2.0 (https://raw.githubusercontent.com/google-gemini/gemini-cli/main/LICENSE). Copyright (c) Google LLC; anomalyco/opencode (GitHub), Agents (OpenCode docs), MIT (https://raw.githubusercontent.com/anomalyco/opencode/dev/LICENSE). Copyright (c) 2025 opencode. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: google-gemini/gemini-cli (GitHub), Subagents (Gemini CLI docs), Apache-2.0 (https://raw.githubusercontent.com/google-gemini/gemini-cli/main/LICENSE). Copyright (c) Google LLC; anomalyco/opencode (GitHub), Agents (OpenCode docs), MIT (https://raw.githubusercontent.com/anomalyco/opencode/dev/LICENSE). Copyright (c) 2025 opencode.
Cite this
iinventedlight. 2026. "Coding agents delegate isolated work to named subagents with their own context." iinventedlight Library, iil:note:7whkf9fq, version of 2026-11-16. https://iinventedlight.com/library/notes/ao-subagent-delegation/. License: CC-BY-4.0.
@misc{iil_note_7whkf9fq,
author = {{iinventedlight}},
title = {{Coding agents delegate isolated work to named subagents with their own context}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-16},
url = {https://iinventedlight.com/library/notes/ao-subagent-delegation/},
note = {Permanent ID iil:note:7whkf9fq. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/ao-subagent-delegation.md.