Original URL: https://getagenttools.com/blog/gemini-cli-subagents/

# Gemini CLI subagents: .gemini/agents/\*.md, invoke\_agent, parallel calls and remote A2A agents

22 Nov 2026Marek.

- gemini-cli
- coding-agents
- agent-ops

Yes. Gemini CLI has subagents. In v0.67.0 they are on by default. Four ship built in. They are `codebase_investigator`, `cli_help`, `generalist` and `browser_agent`, the last one off until you enable it. A custom subagent is a Markdown file with YAML frontmatter in `.gemini/agents/` for a project or `~/.gemini/agents/` for you. This post is for people who know subagents from Claude Code. I do not run Gemini CLI. It is not installed on my machine. Everything here comes from the docs and the v0.67.0 source, read on 6 November 2026.

 

```markdown
---
name: security-auditor
description: Specialized in finding security vulnerabilities in code.
kind: local
tools:
  - read_file
  - grep_search
model: gemini-3-flash-preview
max_turns: 10
---
You are a ruthless Security Auditor. Report findings. Do not fix them.
```

 

Shortened and reworded from the docs example.

  

- **Where.** `.gemini/agents/*.md` in the project, `~/.gemini/agents/*.md` for you, an `agents/` folder inside an extension.
- **Required.** Only `name` and `description`. The file body becomes the system prompt.
- **Parallel.** In the source, tool calls in one turn run in parallel by default, subagent calls included. The docs say nothing. I did not run it.
- **No nesting.** A subagent cannot call another subagent, even with the `*` wildcard.
- **How I know.** Docs and code only. No session of my own.

 

How the same idea works in Claude Code, with my two agent files, is in [Claude Code subagents](https://getagenttools.com/blog/claude-code-subagents/). The GitHub side is in [Copilot CLI subagents](https://getagenttools.com/blog/copilot-cli-subagents/).

 

Per the repository README, read on 6 November 2026, unpaid tier and Google One users moved from Gemini CLI to Antigravity CLI on 18 June 2026. This post covers Gemini CLI only.

 

## Does Gemini CLI have subagents?

 

Yes. The [subagents page](https://geminicli.com/docs/core/subagents/) calls them "specialized agents that operate within your main Gemini CLI session". Each one has its own system prompt, its own tools and a separate context loop. Only the result comes back. The main agent delegates when a task matches a subagent's `description`. Or you force one by starting the prompt with `@codebase_investigator`.

 

The docs say each subagent is exposed "as a tool of the same name". In the v0.67.0 source there is one tool instead, `invoke_agent`, with `agent_name` and `prompt`. The default policy file `agents.toml` allows it in the default, autoEdit and yolo modes, see [Gemini CLI YOLO mode](https://getagenttools.com/blog/gemini-cli-yolo-mode/).

 

## How do I create custom subagents in Gemini CLI?

 

Write one Markdown file per agent in `.gemini/agents/` or `~/.gemini/agents/`, starting with YAML frontmatter. Then run `/agents reload`. `name` is a slug of lowercase letters, numbers, hyphens and underscores. `description` tells the main agent when to delegate.

 

The optional fields, per the docs table, are `kind`, `tools`, `mcpServers`, `model`, `temperature`, `max_turns` and `timeout_mins`. The defaults are the session model, temperature 1, 30 turns and 10 minutes. Without `tools` the subagent inherits every tool of the parent session.

 

Project agents have two gates in `registry.ts`. In an untrusted folder they are skipped. The loader also hashes each file. In the source, a project agent whose hash you have not acknowledged is not registered until you approve it. An edit changes the hash.

 

`/agents list`, `enable`, `disable` and `config` manage agents in a session. `agents.overrides` in `settings.json` makes it permanent.

 

## Is it mcpServers or mcp\_servers in a Gemini CLI agent file?

 

The docs write `mcpServers`. The v0.67.0 loader reads `mcp_servers`. In `agentLoader.ts` the local agent schema ends with `.strict()`, so an unknown key fails validation. The security auditor example has no MCP field. `mcpServers` sits in a separate docs snippet on inline MCP servers, which I read as a load error. I have not run it. The `main` branch on 6 November still had `mcp_servers`.

 

## Can Gemini CLI run subagents in parallel?

 

Yes, according to the code. The docs have no section on it. In `scheduler.ts` adjacent tool calls that can run in parallel go out as one batch. Each tool gets a `wait_for_previous` parameter, described as "Set to false (or omit) to run in parallel." File edit tools never join a batch. Two `invoke_agent` calls in one turn should start together.

 

The system prompt sets the rule. In `snippets.ts` it says "Only run multiple subagents in parallel when their tasks are independent". I found no concurrency limit in `settingsSchema.ts`. Depth is fixed at one. `local-executor.ts` drops agent tools from every subagent.

 

## How do Gemini CLI subagents work with skills?

 

A skill is instructions that load into the conversation when the model calls `activate_skill`. A subagent is a separate context that runs and returns. If `activate_skill` is in a subagent's tools, `local-executor.ts` appends the list of skills to its system prompt. A subagent without a `tools` list inherits that tool.

 

There is no `skills` field in the v0.67.0 agent schema. Google's own repo shows the pattern. The bot's worker agent in [tools/gemini-cli-bot/.gemini/agents/WORKER.md](https://github.com/google-gemini/gemini-cli/blob/v0.67.0/tools/gemini-cli-bot/.gemini/agents/WORKER.md) tells it to load its 'memory' and 'prs' skills "via the `activate_skill` tool". Packaging both in one extension is in [Gemini CLI extensions](https://getagenttools.com/blog/gemini-cli-extensions/).

 

## What are remote subagents in Gemini CLI?

 

A remote subagent is an agent on another server that Gemini CLI calls over the Agent-to-Agent (A2A) protocol. It is defined in the same folders with `kind: remote` and an `agent_card_url` or an inline `agent_card_json`. The [remote subagents page](https://geminicli.com/docs/core/remote-agents/) lists four `auth` types: `apiKey`, `http`, `google-credentials` and `oauth`.

 

One file can hold several remote agents as a YAML list. Local agents cannot share a file. In `registry.ts` a remote agent gets an ask-the-user rule by default. Local agents run under the blanket allow.

 

## How do Gemini CLI subagents differ from Claude Code subagents?

 

The file shape is close. Both use Markdown with YAML frontmatter. Both require `name` and `description`, and both pick a subagent by `description`. The limits differ. Claude Code caps concurrency at 20 by default and allows nesting. Gemini CLI documents no cap and allows no nesting.

 

|  | Gemini CLI 0.67.0 | Claude Code |
| --- | --- | --- |
| Folders | `.gemini/agents/`, `~/.gemini/agents/`, extension `agents/` | `.claude/agents/`, `~/.claude/agents/` |
| Required fields | `name`, `description` | `name`, `description` |
| Manual call | `@name` at the start of the prompt | `@agent-<name>` |
| Parallel | In the source: calls in one turn, no documented cap | 20 concurrent by default |
| Nesting | None | Three layers below the main conversation |
| Skills | Through `activate_skill` in `tools` | `skills` field preloads them |

 

The Claude Code column comes from its [subagents docs](https://code.claude.com/docs/en/sub-agents). In a sandbox the browser agent changes mode, see [Gemini CLI sandbox](https://getagenttools.com/blog/gemini-cli-sandbox/).

 

## Frequently asked questions

 

### Are Gemini CLI subagents experimental?

 

Partly. The setting `experimental.enableAgents` sits in the Experimental category, but it is on by default in v0.67.0. The extensions reference calls extension sub-agents "a preview feature currently under active development".

 

### How do I disable subagents in Gemini CLI?

 

Set `"experimental": { "enableAgents": false }` in `settings.json`. That turns off local and remote subagents. For one agent use `/agents disable <name>` or `"enabled": false` under `agents.overrides`.

 

### Can a Gemini CLI subagent call another subagent?

 

No. The docs say subagents "cannot call other subagents". The executor code removes agent tools from every subagent.

 

### Where are Gemini CLI subagent examples on GitHub?

 

In the [google-gemini/gemini-cli](https://github.com/google-gemini/gemini-cli) repository. `docs/core/subagents.md` has the security auditor. `tools/gemini-cli-bot/.gemini/agents/WORKER.md` is a working agent. Community catalogs exist too. I have not read them.

 

### Did you test this?

 

No. Gemini CLI is not installed on my machine. I read the docs and the v0.67.0 source on 6 November 2026. I did not check Antigravity CLI subagents.

 

## The verdict

 

Gemini CLI subagents look familiar from Claude Code. Per the source, write `mcp_servers`, not `mcpServers`, if you need inline MCP servers. Give each agent a short `tools` list. Ask for parallel work only on read-only tasks. I have not run any of this.

 

Sources, read on 6 November 2026: the Gemini CLI [subagents](https://geminicli.com/docs/core/subagents/) and [remote subagents](https://geminicli.com/docs/core/remote-agents/) pages, plus the commands, skills and extensions reference docs. Code from [google-gemini/gemini-cli](https://github.com/google-gemini/gemini-cli) at tag v0.67.0: `agentLoader.ts`, `registry.ts`, `local-executor.ts`, `agent-tool.ts` and `types.ts` in `packages/core/src/agents/`, plus `scheduler.ts`, `tools.ts`, `snippets.ts`, `agents.toml` and `settingsSchema.ts`. Claude Code: [Create custom subagents](https://code.claude.com/docs/en/sub-agents).

Put this into practice

[See the tool list](https://getagenttools.com/tools/)[Train your team](https://getagenttools.com/#training)
