Cursor icon

Cursor

Interact with the Cursor REST API to spawn and manage AI coding agents

Actions13

Agent → Send Message

AI-generated

Summary

Send a message prompt to an existing agent identified by its Agent ID, and receive the agent's run status and result after processing the message.

Inputs

  • agentId (required) — The ID of the existing agent to send the message to.
  • message (required) — The prompt message text to send to the agent.
  • model — The model ID to use, defaulting to 'composer-2'. (Although declared in properties, not referenced in sendMessage operation source code.)

Output shape

a single JSON object containing the run status, result text, run ID, and agent ID

The operation sends a POST request to create a new run for the specified agent with the message as prompt, then polls the run until it reaches a terminal status (FINISHED, ERROR, CANCELLED) or times out after 10 minutes, finally returning the run result and metadata.

Examples

Example 1: Send a message prompt to an existing agent

Set Agent ID to the existing agent's ID, provide a non-empty Message prompt, optionally specify Model ID if supported; invoke the operation to send the message and receive the agent's response.

Links

Discussion