Skip to main content

Workflow Engine API

Workflow Engine API

Separation of Duties: See Separation of Duties - workflow-engine is responsible for workflow orchestration. It does NOT own agent manifests or execution.

Visual AI workflow orchestration with Langflow-Drupal integration.

Overview

Service: Workflow Engine Specialist Port: 3090 Domain: workflow.local.bluefly.io Protocol: REST + WebSocket Version: 0.1.0 OpenAPI Spec: /technical-guide/openapi/workflow-engine/openapi.yml

What It Does

Drag-and-drop visual workflow builder for AI agent orchestration:

  • Visual workflow composer: Langflow-compatible drag-and-drop interface
  • Real-time execution: Step-by-step workflow tracking
  • Drupal integration: Custom components for CMS workflows
  • MCP tool chains: Integrate MCP tools into workflows
  • Batch processing: Large-scale workflow execution
  • Error recovery: Automatic retry and error handling

Architecture

graph TB A[Visual Builder] --> B[Workflow Engine] B --> C[Langflow Core] B --> D[Drupal Components] B --> E[MCP Integration] C --> F[Execution Runtime] F --> G[Agent Mesh] F --> H[LLM Gateway]

Core Endpoints

1. Workflow Catalog

GET /api/v1/workflows/catalog?category=content_management&complexity=simple

Response:

{ "workflows": [ { "id": "wf-content-generation", "name": "AI Content Generation", "description": "Generate and publish Drupal content using AI", "category": "content_management", "complexity": "simple", "components": 5, "estimatedDuration": 30, "tags": ["drupal", "content", "ai-generation"] }, { "id": "wf-code-review", "name": "Automated Code Review", "description": "Multi-agent code review workflow", "category": "ai_workflows", "complexity": "advanced", "components": 12, "estimatedDuration": 120, "tags": ["code-review", "swarm", "quality"] } ], "total": 47 }

2. Create Workflow

POST /api/v1/workflows

Request:

{ "name": "Content Moderation Workflow", "description": "AI-powered content moderation with human oversight", "category": "content_management", "flow": { "nodes": [ { "id": "input", "type": "TextInput", "position": { "x": 100, "y": 100 }, "data": { "label": "Content Input", "placeholder": "Enter content to moderate" } }, { "id": "ai-analysis", "type": "LLMNode", "position": { "x": 300, "y": 100 }, "data": { "model": "qwen2.5-coder:32b", "prompt": "Analyze this content for policy violations: {{input}}" } }, { "id": "drupal-publish", "type": "DrupalEntityCreate", "position": { "x": 500, "y": 100 }, "data": { "entityType": "node", "bundle": "article", "fields": { "title": "{{input.title}}", "body": "{{ai-analysis.sanitized_content}}", "moderation_state": "draft" } } } ], "edges": [ { "source": "input", "target": "ai-analysis" }, { "source": "ai-analysis", "target": "drupal-publish" } ] } }

Response:

{ "id": "wf-abc123", "name": "Content Moderation Workflow", "status": "active", "version": "0.4.9", "createdAt": "2025-01-15T10:00:00Z", "endpoints": { "execute": "/api/v1/workflows/wf-abc123/execute", "monitor": "/api/v1/workflows/wf-abc123/executions" } }

3. Execute Workflow

POST /api/v1/workflows/{workflowId}/execute

Request:

{ "inputs": { "input": { "title": "AI in Healthcare", "content": "Artificial intelligence is transforming healthcare..." } }, "options": { "async": true, "callbacks": { "onComplete": "https://myapp.com/webhook/workflow-complete", "onError": "https://myapp.com/webhook/workflow-error" } } }

Response:

{ "executionId": "exec-xyz789", "workflowId": "wf-abc123", "status": "running", "startedAt": "2025-01-15T10:05:00Z", "estimatedDuration": 30, "monitorUrl": "ws://workflow.local.bluefly.io/api/v1/executions/exec-xyz789/stream" }

4. Monitor Execution

Real-time Monitoring (WebSocket)

WebSocket: ws://workflow.local.bluefly.io/api/v1/executions/{executionId}/stream

Stream Events:

{ "type": "node-started", "executionId": "exec-xyz789", "nodeId": "input", "timestamp": "2025-01-15T10:05:00Z" }
{ "type": "node-completed", "executionId": "exec-xyz789", "nodeId": "input", "duration": 50, "output": { "title": "AI in Healthcare", "content": "..." }, "timestamp": "2025-01-15T10:05:00.05Z" }
{ "type": "workflow-completed", "executionId": "exec-xyz789", "duration": 2500, "result": { "drupal-publish": { "nid": 123, "url": "https://llm.local.bluefly.io/node/123" } }, "timestamp": "2025-01-15T10:05:02.5Z" }

Get Execution Status

GET /api/v1/executions/{executionId}

Response:

{ "executionId": "exec-xyz789", "workflowId": "wf-abc123", "status": "completed", "startedAt": "2025-01-15T10:05:00Z", "completedAt": "2025-01-15T10:05:02.5Z", "duration": 2500, "nodes": [ { "nodeId": "input", "status": "completed", "duration": 50 }, { "nodeId": "ai-analysis", "status": "completed", "duration": 2300, "modelUsed": "qwen2.5-coder:32b", "tokensUsed": 523 }, { "nodeId": "drupal-publish", "status": "completed", "duration": 150, "entityCreated": 123 } ], "result": { "nid": 123, "url": "https://llm.local.bluefly.io/node/123" } }

Available Components

1. AI Components

ComponentDescriptionInputsOutputs
LLMNodeLLM inferenceprompt, modelcompletion
VectorSearchQdrant vector searchquery, collectionresults
EmbeddingsGenerate embeddingstextvector
ImageGenDALL-E image generationpromptimage_url

2. Drupal Components

ComponentDescriptionInputsOutputs
EntityCreateCreate Drupal entityfields, bundlenid, url
EntityLoadLoad Drupal entitynidentity
EntityUpdateUpdate Drupal entitynid, fieldsupdated
UserLoginAuthenticate userusername, passwordtoken

3. MCP Components

ComponentDescriptionInputsOutputs
MCPToolCallExecute MCP tooltool, paramsresult
MCPServerQueryQuery MCP registrycapabilityservers
FileSystemReadRead file via MCPpathcontent
GitLabAPIGitLab operationsaction, paramsresponse

4. Logic Components

ComponentDescriptionInputsOutputs
ConditionConditional branchingconditiontrue/false
LoopIterate over dataitemsresults
ParallelParallel executiontasksresults
MergeMerge outputsinputsmerged

Batch Processing

Execute workflows at scale:

POST /api/v1/workflows/{workflowId}/batch

Request:

{ "inputs": [ { "input": { "title": "Article 1", "content": "..." } }, { "input": { "title": "Article 2", "content": "..." } }, { "input": { "title": "Article 3", "content": "..." } } ], "options": { "concurrency": 5, "failureMode": "continue", "progressCallback": "https://myapp.com/webhook/batch-progress" } }

Response:

{ "batchId": "batch-123", "totalItems": 3, "status": "processing", "progress": { "completed": 0, "failed": 0, "pending": 3 }, "monitorUrl": "ws://workflow.local.bluefly.io/api/v1/batches/batch-123/stream" }

Error Recovery

Workflows automatically retry failed nodes:

Retry Configuration:

{ "nodes": [ { "id": "ai-analysis", "type": "LLMNode", "data": { "model": "qwen2.5-coder:32b", "prompt": "..." }, "retry": { "enabled": true, "maxAttempts": 3, "backoff": "exponential", "initialDelay": 1000 } } ] }

Error Response:

{ "executionId": "exec-xyz789", "status": "failed", "error": { "nodeId": "ai-analysis", "attempt": 3, "message": "Model timeout after 30000ms", "code": "MODEL_TIMEOUT" }, "retryable": true }

Templates

Pre-built workflow templates:

GET /api/v1/workflows/templates

Response:

{ "templates": [ { "id": "tmpl-content-gen", "name": "AI Content Generation", "description": "Generate blog posts with SEO optimization", "category": "content", "components": 8, "usageCount": 523 }, { "id": "tmpl-code-review", "name": "Multi-Agent Code Review", "description": "Swarm-based code review with consensus", "category": "development", "components": 12, "usageCount": 87 } ] }

Health & Metrics

GET /api/health

Response:

{ "status": "healthy", "version": "0.4.9", "langflow": { "status": "healthy", "version": "0.4.9" }, "executions": { "active": 5, "queued": 12, "totalToday": 523 } }

Next Steps