Install
openclaw skills install cursor-cloud-agentLaunch and manage Cursor Cloud Agents via the official API v0. Use when user asks to delegate a coding task to Cursor's cloud agent, create a PR automaticall...
openclaw skills install cursor-cloud-agentManages Cursor Cloud Agents via the official API v0 (api.cursor.com). Cloud Agents run in isolated cloud VMs, onboard to your codebase, write code, test it, and deliver merge-ready PRs.
SKILL=~/.openclaw/workspace/skills/cursor-agent/scripts/cursor_bga.py
# First-time setup: get your API key
python3 $SKILL setup
# Launch an agent and wait for it to finish
python3 $SKILL create \
--repo owner/repo-name \
--prompt "Add unit tests for the auth module, run tests, submit PR" \
--auto-pr --wait
# Launch without waiting (returns immediately)
python3 $SKILL create \
--repo owner/repo-name \
--prompt "Refactor utils module" \
--auto-pr
# List recent agents
python3 $SKILL list
# Check agent details (one-time query)
python3 $SKILL get --agent-id <ID>
# Poll agent until finished (blocks, prints summary when done)
python3 $SKILL check --agent-id <ID> --interval 15 --timeout 600
# Send follow-up instructions
python3 $SKILL followup --agent-id <ID> --message "Also add integration tests"
# Stop a running agent
python3 $SKILL stop --agent-id <ID>
# List available models
python3 $SKILL models
# List accessible repos
python3 $SKILL repos
API key is read from (in priority order):
--api-key KEY argumentCURSOR_API_KEY environment variable~/.cursor_api_key file (recommended)# Save API key
echo 'your_api_key_here' > ~/.cursor_api_key
chmod 600 ~/.cursor_api_key
Get your key at: https://cursor.com/dashboard → Integrations → Generate API Key
| Command | Description |
|---|---|
create | Launch a new Cloud Agent (--wait to block until done, --no-direct to skip auto-execute hint) |
list | List recent agents (filter by PR URL, limit) |
get | Get agent details (status, summary, PR info) |
check | Poll agent until finished, print final summary |
conversation | View full agent conversation history |
followup | Send additional instructions to a running agent |
stop | Pause a running agent |
delete | Permanently remove an agent |
models | List available LLM models |
repos | List accessible GitHub repositories (outputs owner/repo format for --repo) |
setup | Print API key setup instructions |
https://api.cursor.com/v0When user asks to delegate a task to Cursor Cloud Agent:
The create command now runs automatic pre-flight checks before launching an agent:
/models endpoint--auto-pr) — Checks GitHub push/admin access via gh CLIIf any check fails, the script exits with a clear error message before incurring API costs.
Use --skip-preflight to bypass these checks if needed.
You still need to confirm with the user:
create --wait --auto-pr with the confirmed repo and prompt--no-direct to disable)--wait blocks until agent finishes and prints a full summary including conversation excerptcheck reports --auto-pr was set but no PR URL, it will print the gh pr create command as fallback — run itfollowup to refine instructions if agent output needs adjustmentCREATING — Agent is being set upRUNNING — Agent is actively workingFINISHED — Agent has completed the taskFAILED / STOPPED — Agent terminated abnormally--repo 必须为 owner/repo 格式,不支持完整 URL 或纯仓库名check 默认超时 600 秒create 都会产生 API 用量费用,请勿重复创建相同任务--auto-pr 依赖 Cursor GitHub App 权限,可能静默失败(无报错),需在 Post-check 阶段处理[ERROR] Authentication failed (401). Check your API key.
原因:API Key 无效、过期或格式错误
解决:
~/.cursor_api_key 文件内容是否以 crsr_ 开头,无多余空格或换行python3 $SKILL models 验证新 Key 是否生效[ERROR] Forbidden (403). Your plan may not support this feature.
原因:当前 Cursor 计划不支持 Cloud Agent API,或未开启 Usage-based pricing
解决:到 Cursor Dashboard 确认计划类型,确保已开启 Usage-based pricing
[ERROR] Not found (404): /agents
原因:仓库名格式错误,或 Cursor GitHub App 未授权该仓库
解决:
--repo 为 owner/repo 格式(如 siaslfs/ai-xxx)[ERROR] Rate limited (429). Please wait and try again.
原因:短时间内请求过多
解决:等待 1-2 分钟后重试。避免频繁调用 create 或短间隔轮询(check --interval 建议 ≥ 10 秒)
现象:Agent 状态 FINISHED,但 filesChanged 为 0,对话记录显示 Agent 在等待确认
原因:Prompt 被 Agent 理解为需要先确认再执行
解决:
--no-direct,去掉该参数重试followup --message "直接执行,不需要确认" 追加指令现象:Agent FINISHED,有代码变更,但无 PR URL
原因:Cursor GitHub App 缺少创建 PR 的权限
解决:check 会自动输出 gh pr create 回退命令,直接执行即可。或到 GitHub 手动创建 PR