Cancel a running job
cancel_jobStop a crawl, run, batch or agent run that is still going. Use it when the work should not finish: a crawl started too wide, a run blocking the next start_run (which answers 409 meanwhile), a batch of the wrong URLs, an agent run on the wrong question. To check a job without stopping it use get_job. Inputs: kind and id come from the 'job' object, or a crawl_site crawl_id with kind='crawl'. A run also needs project_id; list_runs shows which run is still going. Effect: queued work is dropped and the page in hand finishes; an agent run stops before its next step, and the pages and model tokens it used stay charged. Pages already read stay. A stop cannot be undone; run the work again to resume. A finished job is left alone, so asking twice is harmless. Needs write access; a read-only connection is refused with code 'read_only'.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"kind": "<kind>",
"id": "<id>"
},
"name": "cancel_job"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The job's id. | |
| kind | Yes | 'crawl' (crawl_site), 'run' (start_run), 'batch' (scrape_urls), 'extract' (scrape_urls with full=true) or 'agent' (run_agent or continue_agent). | |
| project_id | No | A run's project id; required for a run, ignored otherwise. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | The job's id. | |
| code | No | Only on a failure: a machine-readable reason, e.g. read_only, validation, plan_limit or not_found. | |
| kind | No | crawl, run, batch or agent. | |
| note | No | What a stop keeps and drops. | |
| error | No | Only when the call failed: what went wrong, in words an assistant can act on. | |
| detail | No | Only on a failure: the API's own wording, when the error was rephrased. | |
| status | No | Only on a failure: the HTTP status code. | |
| outcome | No | 'cancelled' (it had not started), 'cancelling' (it stops after the page in hand, or an agent run after the step under way), or the status of a job that had already ended. | |
| project_id | No | A run: its project. |