Update a procedure

PATCH/v2/agents/{agentId}/procedures/{procedureId}

Rename a procedure, rewrite its steps, change when it applies or switch it on or off by sending only the fields that change.

Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.

Changes one or more fields of a procedure. Call it to adjust a rule after a policy change, to disable a procedure while you investigate wrong answers, or to publish edits you keep in your own repository.

Request

PATCH /v2/agents/{agentId}/procedures/{procedureId}

Path parameters:

Name Type Required Description
agentId string Yes The ID of the agent, starting with agt_.
procedureId string Yes The ID of the procedure, starting with prc_.

Body fields. Send only the ones you want to change, and at least one:

Name Type Required Description
name string No A new name. Names are unique within an agent.
description string No Tells the agent when the procedure applies.
steps array of strings No The full list of steps. It replaces the current steps, so send every step you want to keep.
enabled boolean No false stops the agent from following the procedure. true turns it back on.

To add one step, read the procedure with Get a procedure, add the step to the array and send the whole array back.

Example request

curl -X PATCH https://api.askocto.co/v2/agents/agt_8f3k2m/procedures/prc_3v8k5d \
  -H "Authorization: Bearer $OCTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "steps": [
      "Look up the order.",
      "If the order is under 30 days old, offer a refund.",
      "Otherwise offer store credit and escalate if the customer objects.",
      "Tell the customer how long the refund takes to arrive."
    ]
  }'
const response = await fetch(
  "https://api.askocto.co/v2/agents/agt_8f3k2m/procedures/prc_3v8k5d",
  {
    method: "PATCH",
    headers: {
      Authorization: `Bearer ${process.env.OCTO_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      steps: [
        "Look up the order.",
        "If the order is under 30 days old, offer a refund.",
        "Otherwise offer store credit and escalate if the customer objects.",
        "Tell the customer how long the refund takes to arrive.",
      ],
    }),
  },
)

const procedure = await response.json()
console.log(procedure.steps.length, procedure.updatedAt)

Example response

A successful call returns 200 OK with the updated procedure.

{
  "id": "prc_3v8k5d",
  "agentId": "agt_8f3k2m",
  "name": "Refund request",
  "description": "Use when a customer asks for their money back.",
  "steps": [
    "Look up the order.",
    "If the order is under 30 days old, offer a refund.",
    "Otherwise offer store credit and escalate if the customer objects.",
    "Tell the customer how long the refund takes to arrive."
  ],
  "enabled": true,
  "createdAt": "2026-02-12T10:00:00Z",
  "updatedAt": "2026-03-21T09:10:00Z"
}

Response fields

The response is the procedure as Get a procedure returns it, with updatedAt set to the time of the change. The agent uses the new steps from its next message. Replay a few real conversations under Test > Tests after a larger rewrite.

Errors

Status Code When
400 invalid_request The body is empty, a field has the wrong type, or steps is empty or holds a blank step.
401 unauthorized The API key is missing, malformed or deleted.
404 not_found The agent or the procedure does not exist in your workspace.
409 conflict Another procedure of the agent already has this name.
429 rate_limited Too many requests. Wait for the number of seconds in the Retry-After header.

Something unclear or missing? Tell us and we will fix the page.