Cursor Cloud Agents Skill
⚡ Quick Reference
Most common commands and patterns:
CODEBLOCK0
Common Options:
- -
--model <name> - Specify model (default: gpt-5.2) - INLINECODE1 - Target branch
- INLINECODE2 - Don't auto-create PR
- INLINECODE3 - Bypass cache
- INLINECODE4 - Debug output
- INLINECODE5 - Run agent in background mode
Background Tasks:
CODEBLOCK1
Max Runtime (Background Tasks):
CODEBLOCK2
Short Commands (cca aliases):
For faster daily usage, source the cca-aliases.sh file:
CODEBLOCK3
Then use cca instead of cursor-api.sh:
CODEBLOCK4
Exit Codes: 0=Success, 1=API Error, 2=Auth, 3=Rate Limit, 4=Repo Access, 5=Invalid Args
Overview
This skill wraps the Cursor Cloud Agents HTTP API, allowing OpenClaw to dispatch coding tasks to Cursor's cloud agents, monitor their progress, and incorporate results.
When to Use
Use this skill when you need to:
- - Delegate coding tasks to Cursor agents running on GitHub repositories
- Generate code, tests, or documentation on existing codebases
- Perform refactoring or feature implementation asynchronously
- Get a "second opinion" on code changes
When NOT to Use
- - For simple questions that don't require code changes
- When you need real-time streaming responses (use local Cursor CLI instead)
- For tasks outside of GitHub repositories
Authentication
The skill automatically discovers your Cursor API key from these locations (in order):
- 1. Environment variable: INLINECODE8
- OpenClaw env file: INLINECODE9
- OpenClaw local env: INLINECODE10
- Project env:
.env in current directory - Cursor config: INLINECODE12
Recommended: Add to ~/.openclaw/.env:
CODEBLOCK5
To get your API key:
- 1. Open Cursor IDE
- Go to Settings → General
- Copy your API key
Verify it's working:
CODEBLOCK6
Workflow Patterns
Pattern A: Fire-and-Forget
Launch an agent and let it work independently. Check back later.
CODEBLOCK7
Note: If no --model is specified, the default model (gpt-5.2) will be used automatically. You'll see a message indicating which model is being used.
Best for: Tasks that don't need immediate attention, exploratory work
Pattern B: Supervised Dispatch
Launch, monitor, and report results when complete.
CODEBLOCK8
Best for: Important tasks where you want to report completion
Pattern C: Iterative Collaboration
Launch, review, and send follow-ups to refine work.
CODEBLOCK9
Best for: Complex tasks requiring multiple iterations
Pattern D: Background Mode
For long-running tasks, launch agents in background mode and check on them later.
CODEBLOCK10
Background tasks are monitored automatically and logs are saved to ~/.cache/cursor-api/background-tasks/.
Best for: Long-running tasks (10+ minutes), batch operations, CI/CD integration
Commands Reference
List Agents
CODEBLOCK11
Returns all agents with status, repo, and creation time.
Launch Agent
CODEBLOCK12
Options:
- -
--repo (required): Repository in owner/repo format - INLINECODE19 (required): Initial instructions for the agent
- INLINECODE20 (optional): Model to use (defaults to
gpt-5.2 if not specified) - INLINECODE22 (optional): Target branch name (auto-generated if omitted)
- INLINECODE23 (optional): Don't auto-create a PR
- INLINECODE24 (optional): Run agent in background mode
Note: When launched without --model, the skill automatically uses gpt-5.2 and displays a message indicating which model is being used.
Background Mode: When using --background, the command returns immediately with a background_task_id. Use bg-list, bg-status, and bg-logs to monitor progress.
Check Status
CODEBLOCK13
Returns:
- -
status: CREATING, RUNNING, FINISHED, STOPPED, ERROR - INLINECODE33 : Summary of work done (if finished)
- INLINECODE34 : URL to created PR (if any)
Get Conversation
CODEBLOCK14
Returns full message history including all prompts and responses.
Send Follow-up
CODEBLOCK15
Resumes a stopped or finished agent with new instructions.
Stop Agent
CODEBLOCK16
Stops a running agent gracefully.
Delete Agent
CODEBLOCK17
Permanently deletes an agent and its conversation history.
List Models
CODEBLOCK18
Returns available models for agent tasks.
Account Info
CODEBLOCK19
Returns account information including subscription tier.
Verify Repository
CODEBLOCK20
Checks if the specified repository is accessible by Cursor agents.
Exit code 4 if repository not accessible.
Usage/Cost Tracking
CODEBLOCK21
Returns usage information including:
- - Agents used vs. limit
- Compute consumption
- Subscription tier
Clear Cache
CODEBLOCK22
Clears the response cache.
Background Task Commands
CODEBLOCK23
List background tasks. By default, excludes completed tasks. Use --all to include finished tasks.
CODEBLOCK24
Get detailed status of a background task including current agent state.
CODEBLOCK25
Show logs for a background task. Logs include status changes and any PR URLs created.
Rate Limiting
The skill enforces a 1 request per second rate limit locally to avoid API rate limits. This is applied automatically to all API calls.
If you hit Cursor's API rate limit (HTTP 429), the script exits with code 3.
Caching
GET requests (list, status, conversation, models, me) are cached for 60 seconds by default. To disable caching for a command:
CODEBLOCK26
To change the cache TTL, set the environment variable:
CODEBLOCK27
Exit Codes
API error (including non-existent resources) |
| 2 | Authentication missing or invalid |
| 3 | Rate limited |
| 4 | Repository not accessible |
| 5 | Invalid arguments |
Testing
The skill includes a comprehensive test suite (cca-comprehensive-test.sh) that validates:
- - Authentication: Auto-discovery, missing key, invalid key handling
- Account Commands: me, usage, models
- Agent Lifecycle: list, launch (with/without model), status, conversation, followup, stop
- Error Handling: Invalid formats, missing args, non-existent agents (all return correct exit codes)
- Options: --verbose, --no-cache, pagination
All tests pass with proper exit codes. Error conditions are correctly handled and return appropriate exit codes.
Concurrent Agent Limits
Based on available documentation and API behavior, Cursor Cloud Agents have the following limits:
| Tier | Concurrent Agents | Notes |
|---|
| Free | 1 | Limited to basic models |
| Pro |
3 | Access to most models |
| Ultra | 5 | Full model access, priority queue |
These limits are enforced at the account level across all agents. If you exceed the limit, the API returns HTTP 429 with code CONCURRENT_LIMIT.
To check your current usage:
CODEBLOCK28
Best practices:
- 1. Stop finished agents when no longer needed
- Use
cursor-api.sh list to monitor active agents - Consider batching work into fewer, larger agents rather than many small ones
Note: Concurrent limits are subject to change. Check cursor-api.sh usage for your current account limits.
Best Practices
1. Always Verify Repository Access
Before launching, verify the repository is accessible:
CODEBLOCK29
2. Use Clear, Specific Prompts
Good prompt:
"Add comprehensive unit tests for the auth module in src/auth/, covering login, logout, and token refresh. Use Jest and mock external API calls."
Bad prompt:
"Add some tests"
3. Check Usage Before Launching
Monitor your quota:
CODEBLOCK30
4. Clean Up Finished Agents
Delete agents you no longer need:
CODEBLOCK31
5. Choose Appropriate Max Runtime for Background Tasks
Typical task durations:
- - Quick fixes (typos, small bugs): 5-15 minutes → INLINECODE45
- Feature implementation: 30-60 minutes → INLINECODE46
- Large refactors: 2-6 hours → INLINECODE47
- Complex migrations: 6-24 hours →
--max-runtime 86400 (default)
CODEBLOCK32
6. Handle Errors Gracefully
Always check exit codes in scripts:
CODEBLOCK33
Follow-up Templates
Use these templates for common follow-up scenarios:
"Add more tests"
CODEBLOCK34
"Fix the implementation"
CODEBLOCK35
"Add documentation"
CODEBLOCK36
"Refactor for clarity"
CODEBLOCK37
Companion Setup: CLI Backend
For local tasks (not on GitHub repos), also configure the Cursor Agent CLI as a cliBackend:
CODEBLOCK38
This enables cursor-agent as a backend for local file operations, while this skill handles Cloud Agents for GitHub repos.
Troubleshooting
"Repository not accessible" (exit code 4)
- 1. Ensure the Cursor GitHub App is installed on the repository
- Check that you have admin/write access to the repo
- Verify the repo name is correct (
owner/repo format)
"Authentication failed" (exit code 2)
- 1. Check that
CURSOR_API_KEY is set in your environment - Verify the API key is valid in Cursor IDE settings
- Ensure the key hasn't expired
"Rate limited" (exit code 3)
- 1. Wait a few seconds and retry
- Check your usage with INLINECODE53
- Consider stopping unused agents
Agent stuck in "CREATING" status
Agents may take 1-2 minutes to start. If stuck longer:
- 1. Check Cursor status page for outages
- Try stopping and relaunching
- Contact Cursor support if persistent