opencode subagent
agentDelegate a self-contained task to a subagent that runs in your project and returns only its final report. Supports worktree isolation and background execution.
Instructions
Launch a subagent that runs on an opencode model (default opencode-go/deepseek-v4.1-flash) in the current project. Mirrors the built-in Agent tool: give a self-contained task prompt; the agent starts with no conversation context and returns only its final report. subagent_type accepts Claude agent definitions from .claude/agents/ (their prompt, tools, permissionMode and maxTurns apply) or opencode agents (general, explore, plan, build). isolation 'worktree' runs it in a temporary git worktree off the default branch, removed if unchanged. The call blocks until the agent finishes (it is backgrounded automatically after a while); set run_in_background to return at once and collect the result with wait.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Working directory (default: the project directory) | |
| model | No | opencode model as provider/model (default: opencode-go/deepseek-v4.1-flash) | |
| tools | No | Allowlist of tools (Claude or opencode names) | |
| effort | No | Model variant/reasoning effort, e.g. low, high, max | |
| prompt | Yes | The task for the agent to perform | |
| isolation | No | ||
| max_turns | No | ||
| description | Yes | Short (3-5 word) description of the task | |
| output_schema | No | JSON Schema the final answer must satisfy; returned as structured output | |
| subagent_type | No | Claude agent definition name or opencode agent name (default: general) | |
| permission_mode | No | Permission mode (default: auto) | |
| disallowed_tools | No | ||
| run_in_background | No |