Skip to content

feat(chats): paired cursorAgentStart / cursorAgentList Cursor Cloud tools#1075

Open
ryokun6 wants to merge 3 commits intomainfrom
cursor/list-cursor-agents-tool-fd68
Open

feat(chats): paired cursorAgentStart / cursorAgentList Cursor Cloud tools#1075
ryokun6 wants to merge 3 commits intomainfrom
cursor/list-cursor-agents-tool-fd68

Conversation

@ryokun6
Copy link
Copy Markdown
Owner

@ryokun6 ryokun6 commented Apr 29, 2026

What

Adds a read-only Cursor Cloud inspection tool, and reshapes the existing one so the two read like a paired set.

  • cursorAgentStart — kicks off a new Cursor Cloud coding-agent run against ryokun6/ryos (renamed from the old cursorRyOsRepoAgent).
  • cursorAgentList — lists Cursor Cloud agents and their runs on the workspace, including status, PR/branch info, and a result preview.

Together the model can answer "start a refactor for X", "which Cursor agents are still running?", "what did the run we kicked off finish with?" through one consistent tool family.

Naming

The original cursorRyOsRepoAgent had three problems: verb-less, awkwardly cased, and pinned the name to the repo. The new pair is verb-first and parallel:

before after role
cursorRyOsRepoAgent cursorAgentStart starts a new Cursor Cloud run
(new) → cursorAgentsList cursorAgentList lists Cursor Cloud agents/runs

Both descriptions cross-reference each other and the system-prompt addon now describes them under one "## CURSOR CLOUD AGENTS" section.

How

cursorAgentList (api/chat/tools/cursor-agent-list.ts)

  • Zod schema with two actions: listAgents (default) and listRuns (requires agentId).
  • Optional status filter (any | running | finished | error | cancelled), limit (1-50), includeArchived, prUrl, cursor for pagination.
  • Executor calls Agent.list({ runtime: "cloud", apiKey }) / Agent.listRuns(agentId, { runtime: "cloud", apiKey }), maps responses to compact summaries, derives a Cursor.com web URL for each agent (bc-… ids → cursor.com/agents?id=…), and truncates run.result previews to 280 chars.
  • Owner-gated against CURSOR_AGENT_OWNER (shared with cursorAgentStart).

Renames in this PR (so the codebase reads consistently end-to-end):

  • api/chat/tools/cursor-{repo-agent,agents-list}.tscursor-agent-{start,list}.ts
  • Symbols: CURSOR_REPO_AGENT_OWNERCURSOR_AGENT_OWNER, CURSOR_RYOS_REPO_AGENT_DESCRIPTIONCURSOR_AGENT_START_DESCRIPTION, cursorRyOsRepoAgentSchemacursorAgentStartSchema, executeCursorRyOsRepoAgentexecuteCursorAgentStart, CursorRepoAgentTelegramNotifyCursorAgentTelegramNotify, etc.
  • Telegram webhook field cursorRepoAgentNotifyTelegramcursorAgentNotifyTelegram.
  • Renderer component CursorRepoAgentChatCardCursorAgentRunCard.
  • i18n keys apps.chats.toolCalls.cursorRyOsRepoAgent.*cursorAgentStart.* (en); new cursorAgentList.* keys for the listing tool.
  • ToolInvocationMessage, telegram-status.ts, useAiChat server-side recovery list + onToolCall switch all updated to the new names.

DEFAULT_RYOS_GITHUB_REPO_URL and formatCursorRunCompletionTelegramMessage keep their names — they really are about the ryOS repo / telegram run-completion, not the tool.

Tests

  • New tests/test-cursor-agent-list-tool.test.ts mocks @cursor/sdk and covers schema validation, owner gate, listAgents filter + URL derivation + pagination, and listRuns result-preview mapping.
  • tests/test-cursor-agent-start-tool.test.ts (renamed from the old name) keeps the owner gate + formatCursorRunCompletionTelegramMessage coverage and now imports the renamed symbols.

Verification on this branch:

  • bun run build → built without errors.
  • bun test tests/test-cursor-agent-list-tool.test.ts tests/test-cursor-agent-start-tool.test.ts → all 12 tests pass.
  • bun run test:unit → 130 tests pass (no regressions).
  • bun run lint → 7 pre-existing warnings only (unrelated).

Notes

  • Both tools are gated behind both the username (CURSOR_AGENT_OWNER) and the presence of CURSOR_API_KEY. No new env vars or migrations.
  • The status filter on cursorAgentList is applied client-side (the Cursor REST API doesn't expose status filtering yet); the description tells the model to bump limit when filtering.
  • Default limit is 10; max is 50 per page. Pagination via nextCursor.
Open in Web Open in Cursor 

…/runs

Adds a new owner-gated server-side tool exposed via Cursor SDK's Agent.list
and Agent.listRuns so users can ask which agents are done, running, or
errored, and follow up on background work spawned by cursorRyOsRepoAgent.

Wires:
- Schema + executor in api/chat/tools/cursor-agents-list.ts (owner gate,
  status filter, agent web URL, run.result preview)
- Tool registration alongside cursorRyOsRepoAgent in
  api/_utils/ryo-conversation.ts (web + telegram channels)
- Telegram status text + chat client recovery list + UI invocation message
  (call/result lines + i18n)
- Bun test covering schema, owner gate, listAgents filter, and listRuns
  result-preview mapping

Co-authored-by: Ryo Lu <me@ryo.lu>
@ryos-deploy
Copy link
Copy Markdown

ryos-deploy Bot commented Apr 29, 2026

The preview deployment for ryos-dev is ready. 🟢

Open Preview | Open Build Logs | Open Application Logs

Last updated at: 2026-04-29 23:26:40 CET

…orAgentList

Tool name unification + tightened descriptions so the model has a clear
mental model of when to use each:

- cursorRyOsRepoAgent -> cursorAgentStart  (verb-first, scoped to start)
- cursorAgentsList    -> cursorAgentList   (consistent singular casing)

Both descriptions now explicitly cross-reference each other ('use
cursorAgentList to inspect agents started by cursorAgentStart'), and the
system prompt addon describes them as a paired set under one section.

Renames span:
- api/chat/tools/cursor-{repo-agent,agents-list}.ts -> cursor-agent-{start,list}.ts
- All exported symbols (CURSOR_AGENT_OWNER, cursorAgentStartSchema,
  executeCursorAgentStart, CursorAgentTelegramNotify, etc.)
- Telegram webhook field cursorRepoAgentNotifyTelegram -> cursorAgentNotifyTelegram
- ryo-conversation.ts addon copy
- ToolInvocationMessage call/result branches
- telegram-status.ts switch
- useAiChat server-side recovery list + onToolCall switch
- i18n keys apps.chats.toolCalls.cursorAgentStart.* / cursorAgentList.*
- Renderer component CursorRepoAgentChatCard -> CursorAgentRunCard
- Renamed bun tests

Co-authored-by: Ryo Lu <me@ryo.lu>
@cursor cursor Bot changed the title feat(chats): add cursorAgentsList tool to surface Cursor Cloud agents/runs feat(chats): paired cursorAgentStart / cursorAgentList Cursor Cloud tools Apr 29, 2026
…ConversationModelInput

Adds end-to-end regression coverage so the gate at the wiring layer (one
level above the per-executor owner check) cannot silently regress:

- registers cursorAgent{Start,List} for username='ryo' (chat + telegram)
- never registers them for non-owner usernames (incl. anonymous)
- never registers them when CURSOR_API_KEY is absent, even for owner
- system-prompt addon ('## CURSOR CLOUD AGENTS') only appears for owner

Pairs with the existing per-executor owner gate in
executeCursorAgentStart / executeCursorAgentList and the request-level
ownership check in api/ai/cursor-run-status.ts.

Co-authored-by: Ryo Lu <me@ryo.lu>
@ryokun6 ryokun6 marked this pull request as ready for review April 29, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants