---
title: "Update the agent's workflow draft"
method: PATCH
path: "/v1/agents/{agent_id}/workflow"
---

# Update the agent's workflow draft

`PATCH /v1/agents/{agent_id}/workflow`

## Request

- Base URL: `https://api.skysay.ai`
- URL: `https://api.skysay.ai/v1/agents/{agent_id}/workflow`
- Auth: none declared

Autosave endpoint for the canvas. Accepts a partial or full conversation_workflow.v1 draft plus optional layout (node positions/viewport/collapsed groups, never part of the compiled contract). An invalid intermediate state is allowed to save; the response's validation field reports errors/warnings without blocking the save. Send base_revision -- the revision field from the draft you edited -- to have a write refused when someone else has changed the draft since; the 409 body carries the current draft under 'current' so the caller can reconcile without another request. Omitting base_revision keeps last-write-wins.

## Path parameters

- `agent_id` string, required

## Request body

- object
  - `base_revision` integer: The revision this edit was based on. Omit for last-write-wins.
  - `layout` object
  - `workflow` object
    - `variables` VariablesConfigVariables
      - `fields` object, required
      - `version` unknown, required

## Response `200`

Updated workflow draft

## Other responses

- `404`: Agent has no workflow yet
- `409`: The draft was changed by someone else; body carries the current draft under 'current'

---

[API](https://skmtc.dev/skysay/apis/skysay-api.md) · [All operations](https://skmtc.dev/skysay/apis/skysay-api/llms.txt) · [OpenAPI document](https://skmtc.dev/skysay/apis/skysay-api/revisions/95b8c66f99aa?raw)
