OpenCode Runs
opencode_runsManage opencode agent runs: start, poll status, list recent, or cancel.
Instructions
Manage opencode agent runs: start, poll status, list recent, or cancel.
Return Format
{"success": bool, "message": str, "data": dict} Fire-and-forget starts return a job_id; poll with action="status".
Examples
opencode_runs(action="start", prompt="Refactor main.py", wait=False) opencode_runs(action="start", prompt="Fix tests", model="deepseek/deepseek-flash", agent="build", auto=True) opencode_runs(action="start", prompt="Continue", session_id="ses_123", fork=True) opencode_runs(action="status", job_id="abc123") opencode_runs(action="list", limit=20, offset=0)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| auto | No | Auto-approve permissions not explicitly denied (start, opencode --auto). Needed for unattended runs; without it a prompt stalls the run. | |
| fork | No | Fork before continuing; requires session_id or continue_session (start) | |
| wait | No | Block until done (start; default false = fire-and-forget) | |
| agent | No | opencode agent name, e.g. 'build' or 'plan' (start) | |
| files | No | Files to attach to the message (start). Must exist on disk. | |
| limit | No | Page size (list) | |
| model | No | Model as provider/model, e.g. 'deepseek/deepseek-flash' (start). Default: opencode's | |
| action | Yes | start: launch an agent run. status: poll a run. list: recent runs. cancel: stop a run. | |
| job_id | No | Job ID (required for status/cancel) | |
| offset | No | Page offset (list) | |
| prompt | No | Agent prompt (required for start) | |
| project | No | Project directory (optional, start) | |
| timeout | No | Max seconds for the run (start) | |
| variant | No | Provider reasoning variant, e.g. 'high', 'max', 'minimal' (start) | |
| thinking | No | Include thinking blocks in output (start) | |
| session_id | No | Continue this session instead of a new one (start) | |
| output_format | No | Output format (start) | text |
| continue_session | No | Continue the most recent session (start; ignored when session_id is set) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | ||
| message | Yes | ||
| success | Yes |