OpenCode Tutorials
Home
Tutorials
Ecosystem
FAQ
Comparisons
Posts
  • Official Website
  • Official Download
  • Official Docs
  • About
  • Contact
  • Privacy Policy
  • Terms of Service
  • Disclaimer
  • Trademark Notice
  • 简体中文
  • English
  • Deutsch
Home
Tutorials
Ecosystem
FAQ
Comparisons
Posts
  • Official Website
  • Official Download
  • Official Docs
  • About
  • Contact
  • Privacy Policy
  • Terms of Service
  • Disclaimer
  • Trademark Notice
  • 简体中文
  • English
  • Deutsch
  • Tutorials

    • Opencode Tutorial Center - From Beginner to Expert
    • Getting Started
    • Advanced Configuration
    • Shortcuts

Agent Configuration Guide

When you master Agent configuration and usage, you can upgrade from "conversational programming" to "orchestrated development". This article will detail Opencode's Agent system.

What is an Agent?

In Opencode, an Agent is an AI unit with specific roles and capabilities. Different Agents excel at different tasks:

  • Some excel at architecture design
  • Some excel at quick search
  • Some excel at documentation writing
  • Some excel at frontend development

Through proper configuration and orchestration of Agents, you can make an AI team collaborate like a real team.

Built-in Agents

Opencode includes multiple professional Agents:

Agent NameRoleSpecialtiesRecommended Model
planPlannerTask breakdown, solution designClaude Opus
buildExecutorCode implementation, file modificationClaude Sonnet
architectArchitectSystem design, technology selectionGPT-5.2
explorerExplorerCode search, structure analysisGemini Flash
documenterDocumentation ExpertDocumentation writing, comment generationClaude Sonnet
reviewerReviewerCode review, security checksClaude Opus

How to Use Agents?

Method 1: Direct @ Mention

Directly @ Agent name in conversation:

Have @architect design a user authentication system architecture

Have @explorer find all API call code

Have @reviewer review this PR's security

Method 2: Switch Default Agent

Run /agents command and select the Agent you want to use.

Method 3: Specify in Configuration

Set default Agent in opencode.json:

{
  "default_agent": "plan"
}

Agent Collaboration Example

Scenario: Developing New Feature

Suppose you want to develop a payment feature:

1. @architect design payment system architecture
2. @explorer search existing payment-related code
3. @plan create implementation plan based on architecture
4. @build implement code according to plan
5. @reviewer review code security and performance

Custom Agents

You can create your own Agents. Add to opencode.json:

{
  "agent": {
    "frontend-expert": {
      "description": "Frontend development expert, proficient in React and Vue",
      "model": "anthropic/claude-sonnet-4-5",
      "prompt": "You are a senior frontend engineer, proficient in React, Vue, TypeScript, and modern CSS.",
      "tools": {
        "read": true,
        "write": true,
        "edit": true,
        "bash": "ask"
      }
    },
    
    "security-auditor": {
      "description": "Security audit expert",
      "model": "anthropic/claude-opus-4-5",
      "prompt": "You are a security audit expert focusing on finding security vulnerabilities, performance issues, and potential bugs.",
      "tools": {
        "read": true,
        "write": false,
        "edit": false,
        "bash": "deny"
      }
    }
  }
}

Agent Configuration Options

OptionTypeDescription
descriptionstringAgent description
modelstringAI model to use
promptstringSystem prompt defining Agent role and behavior
temperaturenumber0-1, controls output randomness
toolsobjectTool permission configuration

Agent Division Strategies

Strategy 1: Division by Task Type

{
  "agent": {
    "quick-fix": {
      "description": "Quick fix for small issues",
      "model": "deepseek/deepseek-coder",
      "prompt": "You focus on quickly fixing simple bugs and small issues."
    },
    "complex-task": {
      "description": "Handle complex tasks",
      "model": "anthropic/claude-opus-4-5",
      "prompt": "You handle complex architecture design and refactoring tasks."
    }
  }
}

Strategy 2: Division by Tech Stack

{
  "agent": {
    "backend-dev": {
      "description": "Backend development",
      "model": "anthropic/claude-sonnet-4-5",
      "prompt": "You are a backend engineer, proficient in Node.js, Python, and database design."
    },
    "frontend-dev": {
      "description": "Frontend development",
      "model": "openai/gpt-5.2",
      "prompt": "You are a frontend engineer, proficient in React, Vue, and modern CSS."
    }
  }
}

Common Questions

Q: How to view all available Agents?

Run /agents command.

Q: Can I use multiple Agents simultaneously?

Yes. @ multiple Agents in conversation, and they will collaborate to complete tasks.

Q: Do Agents share context?

Yes. All Agents in the same session share conversation history.

Next Steps

  • Permissions and Security Configuration
  • Workflow Best Practices
  • Troubleshooting

Compiled by the OpenCodex community.

Last Updated: 2/28/26, 2:48 PM