opencode_run_agent
Execute an AI coding agent with a prompt, either as a background job with polling or synchronously with a timeout.
Instructions
Run an opencode agent with a prompt.
Launches as background job; returns job_id for polling. Set wait=true to block until done.
Return Format
{"success": bool, "message": str, "data": {"job_id": str, "status": str}}
Examples
opencode_run_agent(prompt="Refactor main.py", wait=False) opencode_run_agent(prompt="Summarize README", format="json", wait=True, timeout=120)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| wait | No | Wait for completion (true) or return immediately with job_id (false) | |
| format | No | Output format: 'text' or 'json' | text |
| prompt | Yes | The prompt/message to send to the opencode agent | |
| project | No | Project directory path (optional) | |
| timeout | No | Max seconds to wait when wait=true (default 300) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||