Agents
Agents are specialized AI assistants configured for specific tasks and workflows. They enable focused tools with custom prompts, models, and tool access.
Agent Types
Primary Agents
Main assistants for direct interaction. Cycle through them via Tab key.
- Build: Default agent with all tools enabled
- Plan: Restricted agent for planning and analysis
Subagents
Specialized assistants invoked by primary agents or via @ mentions.
- General: General-purpose for multi-step tasks
- Explore: Fast codebase exploration
Configuration Methods
JSON Configuration
{
"agent": {
"review": {
"mode": "subagent",
"model": "anthropic/claude-sonnet-4",
"tools": {
"write": false,
"edit": false
}
}
}
}Markdown Configuration
Place in ~/.config/opencode/agent/ or .opencode/agent/:
---
description: Reviews code for quality
mode: subagent
temperature: 0.1
tools:
write: false
edit: false
---
You are in code review mode. Focus on quality and security.Configuration Options
| Option | Purpose |
|---|---|
description | Brief description (required) |
temperature | Response randomness (0.0-1.0) |
maxSteps | Limit agentic iterations |
model | Override global model |
tools | Enable/disable tools |
permission | Tool access control |
mode | primary, subagent, or all |
Creating Agents
opencode agent createCommon Use Cases
- Build agent: Full development
- Plan agent: Analysis without changes
- Review agent: Code review (read-only)
- Debug agent: Investigation
- Docs agent: Documentation writing