Skip to content

Workflows API

Document ID: API-004
File Path: docs/09-api/workflows.md
Version: 1.0.0
Status: Draft
Owner: AI Platform Team
Last Updated: 2026-06-27


This document defines the REST/gRPC API for managing workflows — their definitions and durable executions. It is the control-plane interface to the Workflow Engine.

All endpoints inherit the API conventions and require authentication.


ResourceDescription
workflowA versioned workflow definition (compiled from the DSL)
workflow_versionAn immutable published version
executionA durable run of a workflow
taskA human/approval task within an execution

MethodPathScope
POST/api/v1/workflowsworkflows:write
GET/api/v1/workflowsworkflows:read
GET/api/v1/workflows/{id}workflows:read
PATCH/api/v1/workflows/{id}workflows:write
POST/api/v1/workflows/{id}:validateworkflows:write
POST/api/v1/workflows/{id}:publishworkflows:write
POST/api/v1/workflows/{id}:runworkflows:run
GET/api/v1/executionsworkflows:read
GET/api/v1/executions/{id}workflows:read
GET/api/v1/executions/{id}/streamworkflows:read
POST/api/v1/executions/{id}:cancelworkflows:cancel
POST/api/v1/executions/{id}:signalworkflows:run
POST/api/v1/tasks/{id}:completeworkflows:run

A workflow is authored in the Workflow DSL and submitted as YAML or JSON:

{
"id": "wf_01H...",
"object": "workflow",
"name": "invoice-approval",
"definition_format": "yaml",
"definition": "apiVersion: workflow.wovyr.io/v1\nkind: Workflow\n...",
"version": "2.1.0",
"status": "published"
}

:validate compiles the definition to the WIR and returns schema/graph errors without publishing.


POST /api/v1/workflows/wf_01H...:run
Idempotency-Key: invoice-2026-06-27
{
"input": { "customerId": "c_42", "invoiceAmount": 12000, "currency": "USD" },
"version": "2.1.0"
}

Response — an async operation referencing the execution:

{ "execution_id": "exe_01H...", "status": "running", "workflow": "wf_01H..." }

Executions are durable: they survive restarts via checkpointing and resume deterministically.


running → (completed | failed | cancelled | compensating | suspended)

Aligned with the State Machine. suspended covers waits on timers, events, or human tasks.

GET /api/v1/executions/{id}/stream emits step transitions, activity results, retries, and compensation events.


POST /api/v1/executions/exe_01H...:signal
{ "event": "PaymentReceived", "payload": { "amount": 12000 } }

Signals resume executions waiting on event activities, routed via the Event Bus.


Executions paused on a human task expose a task resource:

POST /api/v1/tasks/tsk_01H...:complete
{ "decision": "approved", "comment": "Within budget" }

Completing the task resumes the execution.


:cancel requests graceful cancellation; if the workflow defines compensation, the engine runs the configured compensating activities (saga rollback) before terminating.


  • :publish creates an immutable workflow_version.
  • Running executions continue on their start version (DSL §23).
  • New runs use the version requested, or the active published version.

Emits workflow.published, execution.started, execution.completed, execution.failed, task.created, task.completed to the Event Bus; webhooks mirror these.


Uses the standard error envelope. Notable codes: validation_failed (DSL/compile errors with details), conflict (version), forbidden (policy/permission).




VersionDateDescription
1.0.02026-06-27Initial Workflows API specification