MINARA

Refine a workflow via chat

POST /v1/workflows/:id/refine — Open an SSE stream that streams cluster events as the LLM edits the workflow definition in response to the user's plain-

POST /v1/workflows/:id/refine

Open an SSE stream that streams cluster events as the LLM edits the workflow definition in response to the user's plain-language message. The workflow-authoring subagent retries up to 3 times when validation fails; the chat panel renders each attempt as a collapsible section and the canvas only updates on the validated attempt's terminal workflow.commit. Persists user + assistant chat turns; the assistant row stays status='in_progress' while live and finalizes on completion. Returns 409 if another refine session is already active for this workflow — clients should attach to the existing session via GET /v1/workflows/:id/refine/stream instead of opening a parallel run. On validation failure after MAX_ATTEMPTS the definition is NOT persisted; the existing definition stays as-is.

MethodPOST
Path/v1/workflows/:id/refine
AuthAuthorization: Bearer <token> required when GATEWAY_AUTH_TOKEN is set
Categoryworkflows

Request body

{ "message": "Send me an alert when BTC drops 5%." }

Response body

text/event-stream. Events fire in attempt-bounded groups:
  cluster.attempt_start { attempt, total_budget }
  cluster.node_code_delta { step_name, delta }
  cluster.node_add { step_name, kind, definition }
  workflow.patch  (preview only — does NOT mutate the canvas)
  cluster.attempt_discard { attempt, errors } OR cluster.validate { ok }
  workflow.commit { definition, attempt }  (only on the validated attempt)
  cluster.rollback { reason: 'messaging_gate' | 'persist_failed' | 'validation_failed' | 'stream_error' }
  assistant.message { text }  (delta-streamed)
  error { message, code }

On this page