OpenCode subagents are named helper agents that your main agent launches into their own child sessions, and since v2.3.0 they always run in the background while you keep working.
Get Your Backlink Gameplan →Try Polar Rank Free for 3 Days →
This operator guide covers the built-in subagents, how to write your own in Markdown or JSONC, how to lock their permissions down, and the release changes that matter this week.
If you want agents like these running your SEO and content work, get your Backlink Gameplan and see how Goldie Agency uses them, or try Polar Rank free for 3 days.
Everything below is taken from OpenCode's agents documentation and its official release notes.
What changed in v2.3.0 and v2.3.1
The v2.3.0 release made background subagents the default: they return immediately, keep running, and report back whenever they become idle.
The change landed in pull request 63382, and the parent now gets each child's session ID straight away, so you can run several at once.
The same release fixed a subtle problem: if a subagent goes idle while its own background work is still running, its report now says it is still running, so the parent waits for the final answer.
Then v2.3.1 changed shell timeouts: a command still running when its timeout expires now moves to the background instead of being killed, and a foreground timeout: 0 now means the default 120 seconds.
It also made background compaction the default, which you can switch off with compaction.background: false.
The built-in subagents
| Agent | Mode | What it does |
|---|---|---|
General (general) | subagent | Research and multi-step work with broad tool access; cannot launch more subagents |
Explore (explore) | subagent | Searches and reads code or web sources without editing files |
Build (build) | primary | The default coding agent |
Plan (plan) | primary | Explores and plans without editing normal project files |
V2 has no built-in scout agent, so any guide that tells you to call one is out of date.
Where subagent files live
~/.config/opencode/agents/<name>.md # every project
.opencode/agents/<name>.md # this project only
.opencode/agents/team/reviewer.md # becomes team/reviewer
OpenCode discovers .opencode folders from your current directory up to the project root, and a nested path becomes part of the agent ID.
Write your first subagent in Markdown
The frontmatter holds the settings, and the body becomes the agent's system prompt.
Get Your Backlink Gameplan →Try Polar Rank Free for 3 Days →
---
description: Checks database migrations for unsafe changes
mode: subagent
model: anthropic/claude-sonnet-5-5#high
steps: 12
permissions:
- action: edit
resource: "*"
effect: deny
- action: shell
resource: "*"
effect: deny
---
Read every new migration file. Flag dropped columns, missing
indexes and long table locks. Report in severity order with
file and line references. Do not edit anything.
Save it as .opencode/agents/migration-check.md, then ask your main agent: "Use the migration-check subagent on my latest changes."
The description matters more than it looks, because OpenCode shows it to the model when it decides which subagent to launch.
📞 Want agents like this running your SEO? Get your Backlink Gameplan and we will show you how Goldie Agency uses subagents for audits and content checks, or try Polar Rank free for 3 days. Backlink Gameplan or try Polar Rank free for 3 days
The same subagent in JSONC
If you prefer config files, define agents under agents in any OpenCode configuration file.
{
"$schema": "https://opencode.ai/config.json",
"agents": {
"migration-check": {
"description": "Checks database migrations for unsafe changes",
"mode": "subagent",
"system": "Flag unsafe migrations. Do not edit files.",
"permissions": [
{ "action": "edit", "resource": "*", "effect": "deny" }
]
}
}
}
Modes: primary, subagent or all
| Mode | Behaviour |
|---|---|
primary | Runs as the main agent; the default for a new custom agent |
subagent | Runs only in a child session through the subagent tool |
all | Can run either way |
Forgetting to set mode: subagent is the most common reason a custom agent never gets launched, because new agents default to primary.
Control which subagents a parent may launch
The parent's subagent permission decides which children it may start; the child then uses its own permissions. The rules follow OpenCode's permissions system, where the last matching rule wins.
{
"agents": {
"orchestrator": {
"permissions": [
{ "action": "subagent", "resource": "*", "effect": "deny" },
{ "action": "subagent", "resource": "migration-check", "effect": "allow" },
{ "action": "subagent", "resource": "explore", "effect": "allow" }
]
}
}
}
Put broad rules first and exceptions after them, or the broad rule will override your exception.
🔥 Want ready-made agent setups for your business? Inside the AI Profit Boardroom you get step-by-step video trainings, the installable Agent OS, four coaching calls a week and 3,400+ members. Members get agent workflows they can install and adapt. → Join the AI Profit Boardroom
Get Your Backlink Gameplan →Try Polar Rank Free for 3 Days →
Operator settings worth knowing
steps: a cap on model steps; on the last step tools are removed and the agent summarises.model:provider/model#variant; with none set, a subagent inherits the parent session's model.hidden: true: hides an agent from listings and the subagent catalogue, but it is visibility, not security.disabled: true: removes a built-in or custom agent at that point in config loading.color: a six-digit hex value for the UI.
Running several subagents at once
Because children now run in the background, you can ask for three jobs in one prompt: "Use explore to map the auth code, migration-check on the new migrations and general to draft release notes."
Each returns a session ID immediately, and reports arrive as each one goes idle.
Keep each subagent narrow, with a clear description, so the parent picks the right one every time.
Common mistakes
- Using V1 fields such as
tools,permissionormaxSteps; OpenCode's migration guide explains how old files are read. - Relying on
hiddento stop an agent doing something; use permissions instead. - Giving the General subagent work that needs more subagents; it cannot launch any.
- Forgetting that shell commands now move to the background on timeout; check the tools docs if a long job seems to vanish.
Where to go from here
Once one read-only helper is working, add a second with a different job, and let the parent run both in the background.
Keep a short README in .opencode/agents explaining what each helper does, so teammates know which one to call.
For agent workflows built around business tasks rather than code, see the AI Profit Boardroom.
Get Your Backlink Gameplan →Try Polar Rank Free for 3 Days →
FAQ: OpenCode Subagents
Do OpenCode subagents run in the background?
Yes. Since v2.3.0 they always run in the background, return their session ID immediately and report to the parent when they go idle.
Which subagents come built in?
General, for research and multi-step work (it cannot launch more subagents), and Explore, which searches and reads without editing files.
How do I create a custom OpenCode subagent?
Add a Markdown file to .opencode/agents/ with mode: subagent and a clear description in the frontmatter, or define it under agents in opencode.jsonc.
Can a subagent use a different model?
Yes, set model as provider/model#variant; without it, the subagent inherits the parent session's model.
How do I stop a parent launching certain subagents?
Add subagent permission rules on the parent, denying * and then allowing specific agent IDs, because the last matching rule wins.
📺 Video notes + links to the tools 👉
🎥 Learn how I make these videos 👉
🆓 Get a FREE AI Course + Community + 1,000 AI Agents 👉
About Julian
I'm Julian Goldie, an SEO entrepreneur, author and founder of the AI Profit Boardroom, which has 3,400+ members.
I help business owners scale with AI agents, automation and SEO.
- I've built a 7-figure SEO and link building agency, Goldie Agency, with a team of 70+ SEO experts.
- I've grown a YouTube channel to 400,000+ subscribers.
- I wrote "Link Building Mastery".
- My Udemy courses have taught over 29,000 students.
→ Get my best AI training inside the AI Profit Boardroom
Start with one narrow, read-only helper and you will see why OpenCode subagents change how you work; to put agents to work on your SEO, get your Backlink Gameplan, or try Polar Rank free for 3 days.











