Skip to main content

Admin Cursor SDK Dispatch

The admin automations page can launch Cursor cloud agents for focused repo work. The dispatch flow is standalone: it talks only to the Cursor SDK and has no dependency on any cron or legacy automation integration.

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 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.
  • Dispatch is self-contained: it requires only the Cursor SDK environment above and does not depend on, call, or emit events to any other automation system.
  • Agent.prompt(...) is used because it is a one-shot API that disposes SDK resources automatically.