# The AGENT reports that it carried out an instruction `PATCH /agent/instructions/{id}` **Required scope:** `documents:write` {status: "applied"|"cancelled", runId?}. Deliberately separate from creating one, because a human clicking a button is not evidence the file was handled. Returns 404 for an instruction in another organisation. ## Parameters | Name | In | Required | Description | |---|---|---|---| | `id` | path | yes | id of the target record | ## Request body Content type: `application/json` (required) | Field | Type | Required | Description | |---|---|---|---| | `status` | string | **yes** | applied \| cancelled (required) | | `runId` | string | no | the runId of the sweep that applied it (optional, recommended) | ## Responses | Status | Meaning | |---|---| | `200` | Success | | `400` | BadRequest | | `401` | Unauthorized | | `403` | Forbidden | | `429` | RateLimited | ## Example ```bash curl -X PATCH "https://backend.immut.io/api/v1/agent/instructions/" \ -H "Authorization: Bearer $IMMUT_API_KEY" \ -H "Content-Type: application/json" \ -d '{"status":"","runId":""}' ``` ## OpenAPI fragment ```json { "/agent/instructions/{id}": { "patch": { "operationId": "patchagentinstructionsid", "summary": "The AGENT reports that it carried out an instruction: {status: \"applied\"|\"cancelled\", runId?}. Deliberately separate from creating one, because a human clicking a button is not evidence the file was handled. Returns 404 for an instruction in another organisation.", "description": "The AGENT reports that it carried out an instruction: {status: \"applied\"|\"cancelled\", runId?}. Deliberately separate from creating one, because a human clicking a button is not evidence the file was handled. Returns 404 for an instruction in another organisation.", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" }, "description": "id of the target record" } ], "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "properties": { "status": { "type": "string", "description": "applied | cancelled (required)" }, "runId": { "type": "string", "description": "the runId of the sweep that applied it (optional, recommended)" } }, "required": [ "status" ] } } } }, "responses": { "200": { "description": "Success" }, "400": { "$ref": "#/components/responses/BadRequest" }, "401": { "$ref": "#/components/responses/Unauthorized" }, "403": { "$ref": "#/components/responses/Forbidden" }, "429": { "$ref": "#/components/responses/RateLimited" } }, "tags": [ "Agent" ], "x-required-scope": "documents:write" } } } ```