Skip to main content

Workflow Blocks

A workflow is a directed graph that takes input (an image, a video frame, or a stream) and produces output (annotations, alerts, transformed pixels). Each node in the graph is a block.

Block source: lib/workflow_blocks/

Block categories

FileCategoryExamples
detection.pyDetectionYOLO inference, SAM 3 segmentation
specialized.pySpecializedFace detection, OCR, pose estimation
classical_cv.pyClassical CVEdge detection, contour finding, Hough transforms
crop.pyCropBbox crop, fixed-region crop, padded crop
filter_block.pyFilterThreshold, NMS, class filter, confidence filter
io.pyI/OImage input, video frame source, MinIO read/write
llm.pyLLMGemma agent inference, classification by description
logic.pyLogicIf/else, switch, merge, broadcast
platform.pyPlatformActive model lookup, dataset write, alert dispatch
visualization.pyVisualizationDraw boxes, draw masks, render labels

Block contract

Every block subclasses BaseBlock from lib/workflow_blocks/base.py and declares:

  • inputs — typed input ports
  • outputs — typed output ports
  • params — Pydantic model of configurable parameters
  • run(ctx, inputs) -> outputs — the actual logic

The workflow engine handles type-checking the graph, scheduling block execution in topological order, and shuttling intermediate values between blocks.

Editor

The visual editor at /workflows/editor uses @xyflow/react for the canvas. The block palette is populated from GET /api/v1/workflows/blocks, so any new block class registered server-side appears automatically.