Skip to main content

Admin Cursor SDK Dispatch

The admin automations page can launch Cursor cloud agents for focused repo work without calling OpenClaw or changing Kai workflows.

Admin flow

  1. A verified admin opens /admin/internal/automations.
  2. The admin chooses a task kind and enters a bounded repo prompt.
  3. The browser posts to /api/admin/automations/cursor-agent using the existing FM session.
  4. The server validates admin access, calls Agent.prompt(...), and returns the terminal SDK result.
  5. Cursor-created PRs appear in the existing automations PR table when they match one of these conventions:
    • branch starts with cursor-sdk/
    • PR title starts with [Cursor SDK]
    • PR has a cursor-sdk label

Request contract

POST /api/admin/automations/cursor-agent Headers:
  • Content-Type: application/json
  • existing fm_session cookie or Authorization: Bearer <fm_session_jwt>
Body:
{
  "kind": "ci-fix",
  "prompt": "Fix the failing type check and run bunx tsc --noEmit before finishing.",
  "branch": "cursor-sdk/ci-fix-example"
}
kind must be one of:
  • smoke-test-fix
  • ci-fix
  • tech-debt
branch is optional. When omitted, the server generates cursor-sdk/<kind>-<timestamp>.

Environment

Required:
  • CURSOR_API_KEY
Optional:
  • CURSOR_AGENT_REPO_URL overrides the default Funding Machine GitHub repo URL.
  • CURSOR_AGENT_MODEL overrides the default composer-2 model.

Guardrails

  • The SDK runs only on the server. Never expose CURSOR_API_KEY to the browser.
  • This feature does not call OpenClaw, does not emit OpenClaw system events, and does not require an OpenClaw token.
  • Agent.prompt(...) is used because it is a one-shot API that disposes SDK resources automatically.