Subagents
A subagent is a second agent the main agent launches for a bounded job, so the main conversation stays clean. It reports back a summary. The agent uses the agent tool for this.
Built-in types
| Type | Purpose | Tools |
|---|---|---|
Explore |
Read-only search: locate code, files and facts. It is instructed never to write, edit, delete, install or restart anything. | read, list, grep, glob, read-only shell |
general-purpose |
Multi-step tasks and research. | all tools |
Call the agent tool with no arguments and it lists the available types. You can also just ask: "use an Explore subagent to find where we create invoices".
Continuing a subagent
Each run returns an agent_id (looks like ag_3f9c1a7b...). The parent can send a follow-up to the same subagent with agent_id plus message, and the earlier conversation is replayed as context. Stored transcripts keep up to 60 turns; when replayed, the first turn and the newest turns that fit in about 14,000 characters are kept.
Custom subagents
Create a markdown file in <project>/.ccd/agents/ (or ~/.ccd/agents/ for the machine). Project definitions override user ones, which override the built-ins.
---
name: test-writer
description: Writes focused unit tests for a file or function
tools: read_file, grep, glob, write_file, exec
model:
---
You write unit tests. Read the target code first, match the existing test style,
write tests that fail for the right reason, then run them and report results.
Never change non-test files.
Frontmatter keys: name (letters, digits, _, -; at most 64 characters), description, tools (comma list, empty means all), model (optional preference), read_only (true to apply the explorer restrictions). The body is the subagent's role prompt.
Be aware that tools and model are passed to the subagent as instructions in its context, not as a hard technical lock. read_only: true and the Explore type use a stricter read-only directive, but if you need a hard guarantee that nothing is written, use permission rules instead.
Custom definitions follow the same availability rule as skills: they are read from the project folder on the machine CCD runs on, so repositories that exist only on a dedicated node use the built-in types.
Limits
- Nesting is depth-limited. Subagents launched through
dispatch_aistop at a recursion depth of 3. - Subagent work counts toward your run and credit limits like any other work. See Plans and limits.