# cursor

> Cursor as a login-backed, text-only LLM Router provider and coding-agent worker through official CLI ACP, with optional sdk.v1 Bridge sessions.

| field | value |
|-------|-------|
| version | 0.1.10 |
| type | bundle |
| license | Apache-2.0 |
| repo | https://github.com/iii-hq/workers |
| author | iii |

## installation

```sh
iii trigger compose::add worker=cursor@0.1.10
```

## dependencies

- `configuration` @ `latest`
- `iii-stream` @ `latest`
- `llm-router` @ `latest`
- `state` @ `latest`

## readme

# cursor

Use a normal Cursor login in two iii surfaces: a text-only LLM Router provider whose account models appear in the Console picker, and a coding-agent worker with durable local or cloud sessions. Local execution uses the official Cursor Agent CLI ACP. Cloud agent runs, or local agent runs explicitly configured for `sdk-bridge`, use Cursor's separately distributed `sdk.v1` Bridge.

No Cursor API key is required for the provider or local agent path. Both reuse the login created by `cursor-agent login`.

## Install

```bash
iii trigger compose::add worker=cursor
```

Install the official Cursor Agent CLI and authenticate it once outside the worker:

```bash
cursor-agent login
cursor-agent status --format json
```

Some installations expose the official CLI only as `~/.local/bin/agent`; use that absolute path for login when needed. The worker checks its configured `agent_binary`, `~/.local/bin/cursor-agent`, `~/.local/bin/agent`, and `cursor-agent` on `PATH`. It validates that the executable is Cursor before launching ACP, so an unrelated `agent` command is never selected from `PATH`. Set `CURSOR_AGENT_BIN` to an absolute path for any other installation.

Use the worker's redacted status function to confirm that the login is available without returning account details or credentials:

```bash
iii trigger cursor::auth::status --json '{}'
```

## LLM Router provider

On startup, the worker declares provider `cursor` and reconciles the ACP-selectable account catalog as `cursor/*` model IDs. The models then appear under **Cursor** in the Console model picker. Refresh explicitly with:

```bash
iii trigger provider::cursor::refresh_models --json '{}'
```

The provider runs each request in Cursor `ask` mode inside a fresh empty temporary workspace and denies permission requests. Cursor exposes a coding-agent ACP rather than a raw chat-completions API, so this compatibility provider streams text and thinking but does not claim router tool calling, images, structured output, exact token limits, token usage, or per-token cost. Those catalog capabilities are marked unsupported instead of invented. Use `cursor::run` when Cursor should work directly on a repository.

## Quickstart

Read the account-scoped model catalog, then run a direct coding-agent turn without `CURSOR_API_KEY`:

```bash
iii trigger cursor::models::list --json '{}'

iii trigger cursor::run --json '{
  "runtime": "local",
  "cwd": "/absolute/path/to/repository",
  "model": "auto",
  "prompt": "Summarize this repository and do not modify it."
}'
```

The response includes the durable `session_id`, Cursor session ID, worker run ID, terminal result, status, and stop reason. Login-backed ACP does not report usage or cost, so those fields remain `null`. Reuse `session_id` for a follow-up. `cursor::start` returns immediately, while `cursor::stop` requests ACP cancellation.

The login-backed catalog comes from a fresh ACP session and includes only model IDs ACP accepts. The public `auto` ID maps to ACP's `default` model. Do not copy parameterized IDs from `cursor-agent --list-models`; that command exposes additional CLI-only IDs that ACP rejects. Use `cursor::models::list` for worker requests.

`run::start_and_wait` is the standard alias for `cursor::run`:

```bash
iii-acp --brain-fn cursor::run --brain-stop-fn cursor::stop --model auto --provider cursor
```

ACP forwards the editor `cwd`, maps cancellation to `cursor::stop`, and reports Cursor's top-level stop reason.

## Configuration

The built-in `cursor` configuration defaults local execution to login-backed ACP. The API key and Bridge binary are optional unless cloud mode or the explicit Bridge backend is used:

```yaml
local_backend: cli-acp
agent_binary: ${CURSOR_AGENT_BIN:}
api_key: ${CURSOR_API_KEY:}
bridge_binary: ${CURSOR_SDK_BRIDGE_BIN:}
workspace: .
startup_timeout_ms: 30000
shutdown_timeout_ms: 5000
rpc_timeout_ms: 60000
max_frame_bytes: 16777216
events_stream: agent::events
raw_events_stream: cursor::events
```

Login-backed local sessions run in Cursor's `ask` mode, and the worker cancels every permission request. Cursor ACP does not provide an enforceable per-request tool-list control, so explicit `tools` values, including `tools: []`, are rejected. Omit `tools` for CLI ACP. Start a new session when changing backend; legacy Bridge session IDs are never loaded as CLI ACP sessions.

Per-turn `timeout_ms` is supported only by login-backed `cli-acp` sessions. Local `sdk-bridge` sessions reject that field because the Bridge cannot safely cancel a timed-out Send until it has reported a run ID. Omit it and use `cursor::stop` while the owning Bridge process is still live. If a local Bridge Send becomes `recovery-required` before reporting a run ID, the worker reports that cancellation cannot be confirmed and never claims the upstream run was stopped.

Session creation and prompt ownership are claimed with `state::compare-and-set`, so overlapping worker processes cannot both dispatch one prompt. If a worker loses the CLI process after prompt dispatch has started, the durable session becomes `recovery-required`; the worker does not replay that prompt automatically.

## SDK Bridge and cloud mode

Download the standalone `cursor-sdk-bridge` archive for release `v1.0.28` from the [official Cursor SDK Bridge releases](https://github.com/cursor/sdk-bridge/releases/tag/v1.0.28), verify it against the release's `SHA256SUMS.txt`, and either put `bin/cursor-sdk-bridge` on `PATH` or set `CURSOR_SDK_BRIDGE_BIN` to its absolute path. The iii worker does not bundle or redistribute the Bridge binary or `@cursor/sdk`.

Set `CURSOR_API_KEY` for cloud runs or configure `local_backend: sdk-bridge` to retain the earlier local Bridge behavior. The worker reads the Bridge bearer token from its ready-line token file, accepts only a loopback HTTP endpoint, and never logs that token or the API key.

Select the Bridge catalog when choosing a model for a cloud run:

```bash
iii trigger cursor::models::list --json '{"backend":"sdk-bridge"}'
```

Cloud sessions require at least one repository and default both `work_on_current_branch` and `auto_create_pr` to `false`. Creating or sending a cloud agent may incur Cursor charges. Usage and cost fields remain `null` when the Bridge does not report them.

The Bridge protocol is versioned independently. This worker targets the `sdk.v1` contract shipped with Cursor SDK Bridge `v1.0.28` and validates required capabilities during lazy startup. Model IDs are not hard-coded; `cursor::models::list` reads the catalog for the selected backend.

Read-only `cursor::status`, `cursor::sessions::list`, `cursor::auth::status`, and `cursor::models::list` are allowed by the default worker policy. `cursor::run`, `cursor::start`, `cursor::stop`, and `cursor::usage` remain approval-gated because they can spend money or mutate repositories. The internal configuration reload hook is denied outright.

## api reference

```json
{
  "functions": [
    {
      "description": "Check whether the official Cursor Agent CLI can reuse an existing cursor-agent login. Account details and credentials are never returned.",
      "metadata": {},
      "name": "cursor::auth::status",
      "request_schema": {
        "additionalProperties": false,
        "properties": {},
        "type": "object"
      },
      "response_schema": {
        "additionalProperties": false,
        "properties": {
          "authenticated": {
            "type": "boolean"
          },
          "available": {
            "type": "boolean"
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "login_command": {
            "const": "cursor-agent login",
            "type": "string"
          },
          "status": {
            "enum": [
              "authenticated",
              "partial",
              "unauthenticated",
              "unavailable"
            ],
            "type": "string"
          },
          "version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "available",
          "authenticated",
          "status",
          "version",
          "login_command",
          "error"
        ],
        "type": "object"
      }
    },
    {
      "description": "List the current account-scoped Cursor model catalog. Select sdk-bridge for the cloud/API-key catalog.",
      "metadata": {},
      "name": "cursor::models::list",
      "request_schema": {
        "additionalProperties": false,
        "properties": {
          "backend": {
            "enum": [
              "cli-acp",
              "sdk-bridge"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "response_schema": {
        "additionalProperties": false,
        "properties": {
          "models": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "description": {
                  "type": "string"
                },
                "display_name": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                },
                "parameters": {
                  "items": {
                    "additionalProperties": false,
                    "properties": {
                      "display_name": {
                        "type": "string"
                      },
                      "id": {
                        "type": "string"
                      },
                      "values": {
                        "items": {
                          "additionalProperties": false,
                          "properties": {
                            "display_name": {
                              "type": "string"
                            },
                            "value": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "value",
                            "display_name"
                          ],
                          "type": "object"
                        },
                        "type": "array"
                      }
                    },
                    "required": [
                      "id",
                      "display_name",
                      "values"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "variants": {
                  "items": {
                    "additionalProperties": false,
                    "properties": {
                      "description": {
                        "type": "string"
                      },
                      "display_name": {
                        "type": "string"
                      },
                      "is_default": {
                        "type": "boolean"
                      },
                      "params": {
                        "items": {
                          "additionalProperties": false,
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "value": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "value"
                          ],
                          "type": "object"
                        },
                        "type": "array"
                      }
                    },
                    "required": [
                      "params",
                      "display_name",
                      "description",
                      "is_default"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                }
              },
              "required": [
                "id",
                "display_name",
                "description",
                "parameters",
                "variants"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "models"
        ],
        "type": "object"
      }
    },
    {
      "description": "Internal Cursor configuration reload hook.",
      "metadata": {
        "internal": true
      },
      "name": "cursor::on-config-change",
      "request_schema": {
        "additionalProperties": {},
        "properties": {
          "id": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "response_schema": {
        "additionalProperties": false,
        "properties": {
          "ok": {
            "type": "boolean"
          }
        },
        "required": [
          "ok"
        ],
        "type": "object"
      }
    },
    {
      "description": "Run one Cursor coding-agent turn and wait for its terminal result. Local runs default to the login-backed Cursor CLI ACP; cloud runs use the separately installed sdk.v1 Bridge. The ACP-compatible shape requires cwd and model.",
      "metadata": {},
      "name": "cursor::run",
      "request_schema": {
        "anyOf": [
          {
            "oneOf": [
              {
                "additionalProperties": false,
                "properties": {
                  "cwd": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "messages": {
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "content": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "items": {
                                "additionalProperties": {},
                                "properties": {
                                  "type": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "type"
                                ],
                                "type": "object"
                              },
                              "type": "array"
                            }
                          ]
                        },
                        "role": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "role",
                        "content"
                      ],
                      "type": "object"
                    },
                    "type": "array"
                  },
                  "model": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "name": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "runtime": {
                    "const": "local",
                    "type": "string"
                  },
                  "session_id": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "timeout_ms": {
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991,
                    "type": "integer"
                  },
                  "tools": {
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  }
                },
                "required": [
                  "runtime",
                  "cwd",
                  "model"
                ],
                "type": "object"
              },
              {
                "additionalProperties": false,
                "properties": {
                  "auto_create_pr": {
                    "type": "boolean"
                  },
                  "messages": {
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "content": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "items": {
                                "additionalProperties": {},
                                "properties": {
                                  "type": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "type"
                                ],
                                "type": "object"
                              },
                              "type": "array"
                            }
                          ]
                        },
                        "role": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "role",
                        "content"
                      ],
                      "type": "object"
                    },
                    "type": "array"
                  },
                  "model": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "name": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "repositories": {
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "pr_url": {
                          "format": "uri",
                          "type": "string"
                        },
                        "starting_ref": {
                          "type": "string"
                        },
                        "url": {
                          "minLength": 1,
                          "type": "string"
                        }
                      },
                      "required": [
                        "url"
                      ],
                      "type": "object"
                    },
                    "type": "array"
                  },
                  "runtime": {
                    "const": "cloud",
                    "type": "string"
                  },
                  "session_id": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "work_on_current_branch": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "runtime"
                ],
                "type": "object"
              }
            ]
          },
          {
            "additionalProperties": false,
            "properties": {
              "cwd": {
                "minLength": 1,
                "type": "string"
              },
              "messages": {
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "content": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "items": {
                            "additionalProperties": {},
                            "properties": {
                              "type": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "type"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        }
                      ]
                    },
                    "role": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "model": {
                "minLength": 1,
                "type": "string"
              },
              "prompt": {
                "type": "string"
              },
              "provider": {
                "const": "cursor",
                "type": "string"
              },
              "runtime": {
                "not": {}
              },
              "session_id": {
                "minLength": 1,
                "type": "string"
              },
              "system_prompt": {
                "type": "string"
              },
              "timeout_ms": {
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991,
                "type": "integer"
              }
            },
            "required": [
              "cwd",
              "model"
            ],
            "type": "object"
          }
        ]
      },
      "response_schema": {
        "additionalProperties": false,
        "properties": {
          "agent_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "busy": {
            "type": "boolean"
          },
          "cost": {
            "anyOf": [
              {
                "additionalProperties": false,
                "properties": {
                  "charged_cents": {
                    "minimum": 0,
                    "type": "number"
                  },
                  "raw_cost_cents": {
                    "minimum": 0,
                    "type": "number"
                  }
                },
                "required": [
                  "raw_cost_cents",
                  "charged_cents"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "error_details": {
            "anyOf": [
              {
                "additionalProperties": false,
                "properties": {
                  "rate_limit": {
                    "anyOf": [
                      {
                        "additionalProperties": false,
                        "properties": {
                          "limit": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "remaining": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "reset_epoch_seconds": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "limit",
                          "remaining",
                          "reset_epoch_seconds"
                        ],
                        "type": "object"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "request_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "retry_after_seconds": {
                    "anyOf": [
                      {
                        "minimum": 0,
                        "type": "number"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "sdk_error_code": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "number"
                          }
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "transport_code": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "transport_code",
                  "sdk_error_code",
                  "request_id",
                  "retry_after_seconds",
                  "rate_limit"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "is_error": {
            "type": "boolean"
          },
          "recovery_required": {
            "type": "boolean"
          },
          "result": {
            "type": "string"
          },
          "run_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "session_id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "stop_reason": {
            "anyOf": [
              {
                "enum": [
                  "end",
                  "length",
                  "aborted",
                  "error"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "usage": {
            "anyOf": [
              {
                "additionalProperties": false,
                "properties": {
                  "cache_read_tokens": {
                    "maximum": 9007199254740991,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "cache_write_tokens": {
                    "maximum": 9007199254740991,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "input_tokens": {
                    "maximum": 9007199254740991,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "output_tokens": {
                    "maximum": 9007199254740991,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "reasoning_tokens": {
                    "maximum": 9007199254740991,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "total_tokens": {
                    "maximum": 9007199254740991,
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "input_tokens",
                  "output_tokens",
                  "cache_read_tokens",
                  "cache_write_tokens",
                  "total_tokens"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "session_id",
          "agent_id",
          "run_id",
          "result",
          "status",
          "stop_reason",
          "is_error",
          "usage",
          "cost",
          "busy",
          "recovery_required",
          "error",
          "error_details"
        ],
        "type": "object"
      }
    },
    {
      "description": "List durable iii-to-Cursor session mappings owned by this worker.",
      "metadata": {},
      "name": "cursor::sessions::list",
      "request_schema": {
        "additionalProperties": false,
        "properties": {},
        "type": "object"
      },
      "response_schema": {
        "additionalProperties": false,
        "properties": {
          "sessions": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "active_run_id": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "active_turn": {
                  "anyOf": [
                    {
                      "exclusiveMinimum": 0,
                      "maximum": 9007199254740991,
                      "type": "integer"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "agent_created": {
                  "type": "boolean"
                },
                "agent_id": {
                  "type": "string"
                },
                "auto_create_pr": {
                  "type": "boolean"
                },
                "backend": {
                  "enum": [
                    "cli-acp",
                    "sdk-bridge"
                  ],
                  "type": "string"
                },
                "cancel_requested": {
                  "type": "boolean"
                },
                "claim_id": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "claim_started_at_ms": {
                  "anyOf": [
                    {
                      "maximum": 9007199254740991,
                      "minimum": 0,
                      "type": "integer"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "cost": {
                  "anyOf": [
                    {
                      "additionalProperties": false,
                      "properties": {
                        "charged_cents": {
                          "minimum": 0,
                          "type": "number"
                        },
                        "raw_cost_cents": {
                          "minimum": 0,
                          "type": "number"
                        }
                      },
                      "required": [
                        "raw_cost_cents",
                        "charged_cents"
                      ],
                      "type": "object"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "create_idempotency_key": {
                  "type": "string"
                },
                "last_run_id": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "model": {
                  "type": "string"
                },
                "name": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "pending_prompt_sha256": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "repositories": {
                  "items": {
                    "additionalProperties": false,
                    "properties": {
                      "pr_url": {
                        "format": "uri",
                        "type": "string"
                      },
                      "starting_ref": {
                        "type": "string"
                      },
                      "url": {
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "required": [
                      "url"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "runtime": {
                  "enum": [
                    "local",
                    "cloud"
                  ],
                  "type": "string"
                },
                "send_idempotency_key": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "send_started": {
                  "type": "boolean"
                },
                "session_id": {
                  "type": "string"
                },
                "status": {
                  "enum": [
                    "working",
                    "done",
                    "error",
                    "cancelled",
                    "recovery-required"
                  ],
                  "type": "string"
                },
                "tools": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "turns": {
                  "maximum": 9007199254740991,
                  "minimum": 0,
                  "type": "integer"
                },
                "updated_at_ms": {
                  "maximum": 9007199254740991,
                  "minimum": 0,
                  "type": "integer"
                },
                "usage": {
                  "anyOf": [
                    {
                      "additionalProperties": false,
                      "properties": {
                        "cache_read_tokens": {
                          "maximum": 9007199254740991,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "cache_write_tokens": {
                          "maximum": 9007199254740991,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "input_tokens": {
                          "maximum": 9007199254740991,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "output_tokens": {
                          "maximum": 9007199254740991,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "reasoning_tokens": {
                          "maximum": 9007199254740991,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "total_tokens": {
                          "maximum": 9007199254740991,
                          "minimum": 0,
                          "type": "integer"
                        }
                      },
                      "required": [
                        "input_tokens",
                        "output_tokens",
                        "cache_read_tokens",
                        "cache_write_tokens",
                        "total_tokens"
                      ],
                      "type": "object"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "work_on_current_branch": {
                  "type": "boolean"
                },
                "workspace": {
                  "type": "string"
                }
              },
              "required": [
                "session_id",
                "agent_id",
                "runtime",
                "workspace",
                "name",
                "model",
                "tools",
                "repositories",
                "work_on_current_branch",
                "auto_create_pr",
                "status",
                "agent_created",
                "turns",
                "active_turn",
                "active_run_id",
                "last_run_id",
                "create_idempotency_key",
                "send_idempotency_key",
                "send_started",
                "cancel_requested",
                "claim_id",
                "claim_started_at_ms",
                "pending_prompt_sha256",
                "usage",
                "cost",
                "updated_at_ms"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "sessions"
        ],
        "type": "object"
      }
    },
    {
      "description": "Start a Cursor agent turn and return immediately. Watch agent::events with group_id equal to session_id.",
      "metadata": {},
      "name": "cursor::start",
      "request_schema": {
        "oneOf": [
          {
            "additionalProperties": false,
            "properties": {
              "cwd": {
                "minLength": 1,
                "type": "string"
              },
              "messages": {
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "content": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "items": {
                            "additionalProperties": {},
                            "properties": {
                              "type": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "type"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        }
                      ]
                    },
                    "role": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "model": {
                "minLength": 1,
                "type": "string"
              },
              "name": {
                "minLength": 1,
                "type": "string"
              },
              "prompt": {
                "type": "string"
              },
              "runtime": {
                "const": "local",
                "type": "string"
              },
              "session_id": {
                "minLength": 1,
                "type": "string"
              },
              "timeout_ms": {
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991,
                "type": "integer"
              },
              "tools": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            },
            "required": [
              "runtime",
              "cwd",
              "model"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "auto_create_pr": {
                "type": "boolean"
              },
              "messages": {
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "content": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "items": {
                            "additionalProperties": {},
                            "properties": {
                              "type": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "type"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        }
                      ]
                    },
                    "role": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "model": {
                "minLength": 1,
                "type": "string"
              },
              "name": {
                "minLength": 1,
                "type": "string"
              },
              "prompt": {
                "type": "string"
              },
              "repositories": {
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "pr_url": {
                      "format": "uri",
                      "type": "string"
                    },
                    "starting_ref": {
                      "type": "string"
                    },
                    "url": {
                      "minLength": 1,
                      "type": "string"
                    }
                  },
                  "required": [
                    "url"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "runtime": {
                "const": "cloud",
                "type": "string"
              },
              "session_id": {
                "minLength": 1,
                "type": "string"
              },
              "work_on_current_branch": {
                "type": "boolean"
              }
            },
            "required": [
              "runtime"
            ],
            "type": "object"
          }
        ]
      },
      "response_schema": {
        "additionalProperties": false,
        "properties": {
          "session_id": {
            "type": "string"
          },
          "started": {
            "type": "boolean"
          }
        },
        "required": [
          "session_id",
          "started"
        ],
        "type": "object"
      }
    },
    {
      "description": "Check the status of a Cursor session (local ACP or Bridge).",
      "metadata": {},
      "name": "cursor::status",
      "request_schema": {
        "additionalProperties": false,
        "properties": {
          "session_id": {
            "minLength": 1,
            "type": "string"
          }
        },
        "required": [
          "session_id"
        ],
        "type": "object"
      },
      "response_schema": {
        "additionalProperties": false,
        "properties": {
          "agent": {
            "anyOf": [
              {
                "additionalProperties": false,
                "properties": {
                  "agent_id": {
                    "type": "string"
                  },
                  "archived": {
                    "type": "boolean"
                  },
                  "created_at": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "cwd": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "last_modified": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "metadata": {
                    "additionalProperties": {
                      "type": "string"
                    },
                    "propertyNames": {
                      "type": "string"
                    },
                    "type": "object"
                  },
                  "name": {
                    "type": "string"
                  },
                  "repositories": {
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "runtime": {
                    "anyOf": [
                      {
                        "enum": [
                          "local",
                          "cloud"
                        ],
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "status": {
                    "type": "string"
                  },
                  "summary": {
                    "type": "string"
                  }
                },
                "required": [
                  "agent_id",
                  "name",
                  "summary",
                  "status",
                  "archived",
                  "created_at",
                  "last_modified",
                  "runtime",
                  "cwd",
                  "repositories",
                  "metadata"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "live": {
            "type": "boolean"
          },
          "record": {
            "anyOf": [
              {
                "additionalProperties": false,
                "properties": {
                  "active_run_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "active_turn": {
                    "anyOf": [
                      {
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991,
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "agent_created": {
                    "type": "boolean"
                  },
                  "agent_id": {
                    "type": "string"
                  },
                  "auto_create_pr": {
                    "type": "boolean"
                  },
                  "backend": {
                    "enum": [
                      "cli-acp",
                      "sdk-bridge"
                    ],
                    "type": "string"
                  },
                  "cancel_requested": {
                    "type": "boolean"
                  },
                  "claim_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "claim_started_at_ms": {
                    "anyOf": [
                      {
                        "maximum": 9007199254740991,
                        "minimum": 0,
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "cost": {
                    "anyOf": [
                      {
                        "additionalProperties": false,
                        "properties": {
                          "charged_cents": {
                            "minimum": 0,
                            "type": "number"
                          },
                          "raw_cost_cents": {
                            "minimum": 0,
                            "type": "number"
                          }
                        },
                        "required": [
                          "raw_cost_cents",
                          "charged_cents"
                        ],
                        "type": "object"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "create_idempotency_key": {
                    "type": "string"
                  },
                  "last_run_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "model": {
                    "type": "string"
                  },
                  "name": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "pending_prompt_sha256": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "repositories": {
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "pr_url": {
                          "format": "uri",
                          "type": "string"
                        },
                        "starting_ref": {
                          "type": "string"
                        },
                        "url": {
                          "minLength": 1,
                          "type": "string"
                        }
                      },
                      "required": [
                        "url"
                      ],
                      "type": "object"
                    },
                    "type": "array"
                  },
                  "runtime": {
                    "enum": [
                      "local",
                      "cloud"
                    ],
                    "type": "string"
                  },
                  "send_idempotency_key": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "send_started": {
                    "type": "boolean"
                  },
                  "session_id": {
                    "type": "string"
                  },
                  "status": {
                    "enum": [
                      "working",
                      "done",
                      "error",
                      "cancelled",
                      "recovery-required"
                    ],
                    "type": "string"
                  },
                  "tools": {
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "turns": {
                    "maximum": 9007199254740991,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "updated_at_ms": {
                    "maximum": 9007199254740991,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "usage": {
                    "anyOf": [
                      {
                        "additionalProperties": false,
                        "properties": {
                          "cache_read_tokens": {
                            "maximum": 9007199254740991,
                            "minimum": 0,
                            "type": "integer"
                          },
                          "cache_write_tokens": {
                            "maximum": 9007199254740991,
                            "minimum": 0,
                            "type": "integer"
                          },
                          "input_tokens": {
                            "maximum": 9007199254740991,
                            "minimum": 0,
                            "type": "integer"
                          },
                          "output_tokens": {
                            "maximum": 9007199254740991,
                            "minimum": 0,
                            "type": "integer"
                          },
                          "reasoning_tokens": {
                            "maximum": 9007199254740991,
                            "minimum": 0,
                            "type": "integer"
                          },
                          "total_tokens": {
                            "maximum": 9007199254740991,
                            "minimum": 0,
                            "type": "integer"
                          }
                        },
                        "required": [
                          "input_tokens",
                          "output_tokens",
                          "cache_read_tokens",
                          "cache_write_tokens",
                          "total_tokens"
                        ],
                        "type": "object"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "work_on_current_branch": {
                    "type": "boolean"
                  },
                  "workspace": {
                    "type": "string"
                  }
                },
                "required": [
                  "session_id",
                  "agent_id",
                  "runtime",
                  "workspace",
                  "name",
                  "model",
                  "tools",
                  "repositories",
                  "work_on_current_branch",
                  "auto_create_pr",
                  "status",
                  "agent_created",
                  "turns",
                  "active_turn",
                  "active_run_id",
                  "last_run_id",
                  "create_idempotency_key",
                  "send_idempotency_key",
                  "send_started",
                  "cancel_requested",
                  "claim_id",
                  "claim_started_at_ms",
                  "pending_prompt_sha256",
                  "usage",
                  "cost",
                  "updated_at_ms"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "remote_error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "run": {
            "anyOf": [
              {
                "additionalProperties": false,
                "properties": {
                  "agent_id": {
                    "type": "string"
                  },
                  "created_at": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "duration_ms": {
                    "anyOf": [
                      {
                        "maximum": 9007199254740991,
                        "minimum": 0,
                        "type": "integer"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "model": {
                    "type": "string"
                  },
                  "result": {
                    "type": "string"
                  },
                  "run_id": {
                    "type": "string"
                  },
                  "status": {
                    "type": "string"
                  },
                  "usage": {
                    "anyOf": [
                      {
                        "additionalProperties": false,
                        "properties": {
                          "cache_read_tokens": {
                            "maximum": 9007199254740991,
                            "minimum": 0,
                            "type": "integer"
                          },
                          "cache_write_tokens": {
                            "maximum": 9007199254740991,
                            "minimum": 0,
                            "type": "integer"
                          },
                          "input_tokens": {
                            "maximum": 9007199254740991,
                            "minimum": 0,
                            "type": "integer"
                          },
                          "output_tokens": {
                            "maximum": 9007199254740991,
                            "minimum": 0,
                            "type": "integer"
                          },
                          "reasoning_tokens": {
                            "maximum": 9007199254740991,
                            "minimum": 0,
                            "type": "integer"
                          },
                          "total_tokens": {
                            "maximum": 9007199254740991,
                            "minimum": 0,
                            "type": "integer"
                          }
                        },
                        "required": [
                          "input_tokens",
                          "output_tokens",
                          "cache_read_tokens",
                          "cache_write_tokens",
                          "total_tokens"
                        ],
                        "type": "object"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "run_id",
                  "agent_id",
                  "status",
                  "result",
                  "model",
                  "duration_ms",
                  "created_at",
                  "usage"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "session_id": {
            "type": "string"
          }
        },
        "required": [
          "session_id",
          "live",
          "record",
          "agent",
          "run",
          "remote_error"
        ],
        "type": "object"
      }
    },
    {
      "description": "Stop the active Cursor run for a session.",
      "metadata": {},
      "name": "cursor::stop",
      "request_schema": {
        "additionalProperties": false,
        "properties": {
          "session_id": {
            "minLength": 1,
            "type": "string"
          }
        },
        "required": [
          "session_id"
        ],
        "type": "object"
      },
      "response_schema": {
        "additionalProperties": false,
        "properties": {
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "session_id": {
            "type": "string"
          },
          "stopped": {
            "type": "boolean"
          }
        },
        "required": [
          "session_id",
          "stopped",
          "reason"
        ],
        "type": "object"
      }
    },
    {
      "description": "Read token usage and billed cost for a cloud Cursor session.",
      "metadata": {},
      "name": "cursor::usage",
      "request_schema": {
        "additionalProperties": false,
        "properties": {
          "run_id": {
            "minLength": 1,
            "type": "string"
          },
          "session_id": {
            "minLength": 1,
            "type": "string"
          }
        },
        "required": [
          "session_id"
        ],
        "type": "object"
      },
      "response_schema": {
        "additionalProperties": false,
        "properties": {
          "agent_id": {
            "type": "string"
          },
          "session_id": {
            "type": "string"
          },
          "usage": {
            "additionalProperties": false,
            "properties": {
              "cost": {
                "anyOf": [
                  {
                    "additionalProperties": false,
                    "properties": {
                      "charged_cents": {
                        "minimum": 0,
                        "type": "number"
                      },
                      "raw_cost_cents": {
                        "minimum": 0,
                        "type": "number"
                      }
                    },
                    "required": [
                      "raw_cost_cents",
                      "charged_cents"
                    ],
                    "type": "object"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "runs": {
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "cost": {
                      "anyOf": [
                        {
                          "additionalProperties": false,
                          "properties": {
                            "charged_cents": {
                              "minimum": 0,
                              "type": "number"
                            },
                            "raw_cost_cents": {
                              "minimum": 0,
                              "type": "number"
                            }
                          },
                          "required": [
                            "raw_cost_cents",
                            "charged_cents"
                          ],
                          "type": "object"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "run_id": {
                      "type": "string"
                    },
                    "usage": {
                      "additionalProperties": false,
                      "properties": {
                        "cache_read_tokens": {
                          "maximum": 9007199254740991,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "cache_write_tokens": {
                          "maximum": 9007199254740991,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "input_tokens": {
                          "maximum": 9007199254740991,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "output_tokens": {
                          "maximum": 9007199254740991,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "reasoning_tokens": {
                          "maximum": 9007199254740991,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "total_tokens": {
                          "maximum": 9007199254740991,
                          "minimum": 0,
                          "type": "integer"
                        }
                      },
                      "required": [
                        "input_tokens",
                        "output_tokens",
                        "cache_read_tokens",
                        "cache_write_tokens",
                        "total_tokens"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "run_id",
                    "usage",
                    "cost"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "usage": {
                "anyOf": [
                  {
                    "additionalProperties": false,
                    "properties": {
                      "cache_read_tokens": {
                        "maximum": 9007199254740991,
                        "minimum": 0,
                        "type": "integer"
                      },
                      "cache_write_tokens": {
                        "maximum": 9007199254740991,
                        "minimum": 0,
                        "type": "integer"
                      },
                      "input_tokens": {
                        "maximum": 9007199254740991,
                        "minimum": 0,
                        "type": "integer"
                      },
                      "output_tokens": {
                        "maximum": 9007199254740991,
                        "minimum": 0,
                        "type": "integer"
                      },
                      "reasoning_tokens": {
                        "maximum": 9007199254740991,
                        "minimum": 0,
                        "type": "integer"
                      },
                      "total_tokens": {
                        "maximum": 9007199254740991,
                        "minimum": 0,
                        "type": "integer"
                      }
                    },
                    "required": [
                      "input_tokens",
                      "output_tokens",
                      "cache_read_tokens",
                      "cache_write_tokens",
                      "total_tokens"
                    ],
                    "type": "object"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "usage",
              "cost",
              "runs"
            ],
            "type": "object"
          }
        },
        "required": [
          "session_id",
          "agent_id",
          "usage"
        ],
        "type": "object"
      }
    },
    {
      "description": "Cancel an in-flight Cursor ACP provider request.",
      "metadata": {
        "internal": true
      },
      "name": "provider::cursor::abort",
      "request_schema": {
        "additionalProperties": {},
        "properties": {
          "request_id": {
            "type": "string"
          }
        },
        "required": [
          "request_id"
        ],
        "type": "object"
      },
      "response_schema": {
        "additionalProperties": false,
        "properties": {
          "aborted": {
            "type": "boolean"
          }
        },
        "required": [
          "aborted"
        ],
        "type": "object"
      }
    },
    {
      "description": "Re-register the Cursor provider after an LLM Router restart.",
      "metadata": {
        "internal": true
      },
      "name": "provider::cursor::on_router_ready",
      "request_schema": {
        "additionalProperties": true,
        "properties": {},
        "type": "object"
      },
      "response_schema": {
        "additionalProperties": false,
        "properties": {
          "ok": {
            "type": "boolean"
          }
        },
        "required": [
          "ok"
        ],
        "type": "object"
      }
    },
    {
      "description": "Refresh the login-backed Cursor model catalog and replace its LLM Router slice.",
      "metadata": {
        "internal": true
      },
      "name": "provider::cursor::refresh_models",
      "request_schema": {
        "additionalProperties": true,
        "properties": {},
        "type": "object"
      },
      "response_schema": {
        "additionalProperties": false,
        "properties": {
          "count": {
            "maximum": 9007199254740991,
            "minimum": 0,
            "type": "integer"
          },
          "ok": {
            "type": "boolean"
          }
        },
        "required": [
          "ok",
          "count"
        ],
        "type": "object"
      }
    },
    {
      "description": "Stream a text-only Cursor completion through the official login-backed Cursor Agent ACP.",
      "metadata": {
        "internal": true
      },
      "name": "provider::cursor::stream",
      "request_schema": {
        "additionalProperties": {},
        "properties": {
          "max_output_tokens": {
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991,
            "type": "integer"
          },
          "messages": {
            "items": {
              "additionalProperties": {},
              "propertyNames": {
                "type": "string"
              },
              "type": "object"
            },
            "type": "array"
          },
          "model": {
            "minLength": 1,
            "type": "string"
          },
          "model_meta": {},
          "provider_options": {},
          "resolution_key": {
            "type": "string"
          },
          "response_format": {
            "additionalProperties": {},
            "propertyNames": {
              "type": "string"
            },
            "type": "object"
          },
          "session_id": {
            "type": "string"
          },
          "system_prompt": {
            "type": "string"
          },
          "thinking_level": {
            "type": "string"
          },
          "tools": {
            "items": {},
            "type": "array"
          },
          "writer_ref": {
            "additionalProperties": false,
            "properties": {
              "access_key": {
                "type": "string"
              },
              "channel_id": {
                "type": "string"
              },
              "direction": {
                "const": "write",
                "type": "string"
              }
            },
            "required": [
              "channel_id",
              "access_key",
              "direction"
            ],
            "type": "object"
          }
        },
        "required": [
          "writer_ref",
          "model",
          "messages"
        ],
        "type": "object"
      },
      "response_schema": {
        "additionalProperties": false,
        "properties": {
          "ok": {
            "type": "boolean"
          }
        },
        "required": [
          "ok"
        ],
        "type": "object"
      }
    },
    {
      "description": "Standard agent alias for cursor::run. Configure ACP with --brain-fn cursor::run when more than one agent worker is installed.",
      "metadata": {},
      "name": "run::start_and_wait",
      "request_schema": {
        "anyOf": [
          {
            "oneOf": [
              {
                "additionalProperties": false,
                "properties": {
                  "cwd": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "messages": {
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "content": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "items": {
                                "additionalProperties": {},
                                "properties": {
                                  "type": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "type"
                                ],
                                "type": "object"
                              },
                              "type": "array"
                            }
                          ]
                        },
                        "role": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "role",
                        "content"
                      ],
                      "type": "object"
                    },
                    "type": "array"
                  },
                  "model": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "name": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "runtime": {
                    "const": "local",
                    "type": "string"
                  },
                  "session_id": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "timeout_ms": {
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991,
                    "type": "integer"
                  },
                  "tools": {
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  }
                },
                "required": [
                  "runtime",
                  "cwd",
                  "model"
                ],
                "type": "object"
              },
              {
                "additionalProperties": false,
                "properties": {
                  "auto_create_pr": {
                    "type": "boolean"
                  },
                  "messages": {
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "content": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "items": {
                                "additionalProperties": {},
                                "properties": {
                                  "type": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "type"
                                ],
                                "type": "object"
                              },
                              "type": "array"
                            }
                          ]
                        },
                        "role": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "role",
                        "content"
                      ],
                      "type": "object"
                    },
                    "type": "array"
                  },
                  "model": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "name": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "repositories": {
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "pr_url": {
                          "format": "uri",
                          "type": "string"
                        },
                        "starting_ref": {
                          "type": "string"
                        },
                        "url": {
                          "minLength": 1,
                          "type": "string"
                        }
                      },
                      "required": [
                        "url"
                      ],
                      "type": "object"
                    },
                    "type": "array"
                  },
                  "runtime": {
                    "const": "cloud",
                    "type": "string"
                  },
                  "session_id": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "work_on_current_branch": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "runtime"
                ],
                "type": "object"
              }
            ]
          },
          {
            "additionalProperties": false,
            "properties": {
              "cwd": {
                "minLength": 1,
                "type": "string"
              },
              "messages": {
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "content": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "items": {
                            "additionalProperties": {},
                            "properties": {
                              "type": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "type"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        }
                      ]
                    },
                    "role": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "role",
                    "content"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "model": {
                "minLength": 1,
                "type": "string"
              },
              "prompt": {
                "type": "string"
              },
              "provider": {
                "const": "cursor",
                "type": "string"
              },
              "runtime": {
                "not": {}
              },
              "session_id": {
                "minLength": 1,
                "type": "string"
              },
              "system_prompt": {
                "type": "string"
              },
              "timeout_ms": {
                "exclusiveMinimum": 0,
                "maximum": 9007199254740991,
                "type": "integer"
              }
            },
            "required": [
              "cwd",
              "model"
            ],
            "type": "object"
          }
        ]
      },
      "response_schema": {
        "additionalProperties": false,
        "properties": {
          "agent_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "busy": {
            "type": "boolean"
          },
          "cost": {
            "anyOf": [
              {
                "additionalProperties": false,
                "properties": {
                  "charged_cents": {
                    "minimum": 0,
                    "type": "number"
                  },
                  "raw_cost_cents": {
                    "minimum": 0,
                    "type": "number"
                  }
                },
                "required": [
                  "raw_cost_cents",
                  "charged_cents"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "error_details": {
            "anyOf": [
              {
                "additionalProperties": false,
                "properties": {
                  "rate_limit": {
                    "anyOf": [
                      {
                        "additionalProperties": false,
                        "properties": {
                          "limit": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "remaining": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "reset_epoch_seconds": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "limit",
                          "remaining",
                          "reset_epoch_seconds"
                        ],
                        "type": "object"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "request_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "retry_after_seconds": {
                    "anyOf": [
                      {
                        "minimum": 0,
                        "type": "number"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "sdk_error_code": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "number"
                          }
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "transport_code": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "transport_code",
                  "sdk_error_code",
                  "request_id",
                  "retry_after_seconds",
                  "rate_limit"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "is_error": {
            "type": "boolean"
          },
          "recovery_required": {
            "type": "boolean"
          },
          "result": {
            "type": "string"
          },
          "run_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "session_id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "stop_reason": {
            "anyOf": [
              {
                "enum": [
                  "end",
                  "length",
                  "aborted",
                  "error"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "usage": {
            "anyOf": [
              {
                "additionalProperties": false,
                "properties": {
                  "cache_read_tokens": {
                    "maximum": 9007199254740991,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "cache_write_tokens": {
                    "maximum": 9007199254740991,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "input_tokens": {
                    "maximum": 9007199254740991,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "output_tokens": {
                    "maximum": 9007199254740991,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "reasoning_tokens": {
                    "maximum": 9007199254740991,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "total_tokens": {
                    "maximum": 9007199254740991,
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "input_tokens",
                  "output_tokens",
                  "cache_read_tokens",
                  "cache_write_tokens",
                  "total_tokens"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "session_id",
          "agent_id",
          "run_id",
          "result",
          "status",
          "stop_reason",
          "is_error",
          "usage",
          "cost",
          "busy",
          "recovery_required",
          "error",
          "error_details"
        ],
        "type": "object"
      }
    }
  ],
  "triggers": []
}
```
