Skip to content

Function Block Definition

A function block is a versioned, reusable unit of automation logic. Developers write them in Python using the Worker SDK. The workflow engine stores their metadata, validates their schemas, and orchestrates their execution as part of workflows.

Identity

Every function block is identified by three components:

Field Example Purpose
package fb.neops.io Namespace (reverse domain notation)
name ping Operation name
version 1.0.0 Semantic version (major.minor.patch)

Combined into a SemVer identifier: fb.neops.io/ping:1.0.0

Metadata

When a function block is registered, the engine stores:

Property Type Description
parameterJsonSchema JSON Schema Validates input parameters
resultDataJsonSchema JSON Schema Validates output data
runOn device | group | interface Entity type this FB operates on
fbType facts | configure | check | execute | none Category
isPure boolean No side effects (read-only)
isIdempotent boolean Safe to re-run with same inputs
description string Human-readable description
markdownHelpText string Extended documentation (markdown)
deprecated boolean Soft-deleted, still available for existing workflows

Usage in Workflows

Workflows reference function blocks in step definitions:

steps:
  - type: functionBlock
    label: ping
    functionBlock: "fb.neops.io/ping:1.0.0"
    runOn: device
    parameters:
      host: "{{ context.device.ip }}"
      timeout: 5

The engine validates that:

  • The referenced function block exists and is not deprecated
  • The parameters match the function block's parameterJsonSchema
  • The runOn value is compatible with the function block's runOn declaration

Types

The fbType categorizes function blocks for organization and filtering:

Type Description Typical use
facts Collect data from devices show version, interface counters, SNMP
configure Push configuration to devices Interface config, ACLs, routing
check Validate compliance or state Policy checks, config drift detection
execute General-purpose operations Discovery, report generation
none Utility (no direct device interaction) Data transformation, aggregation

The type is informational -- it does not affect execution behavior. It is primarily used for UI grouping and search.