Skip to main content

Function

The Function component is designed to reduce BFF (Backend-for-Frontend) needs by handling cross-domain or external integration processes. Functions can run independently or within a workflow context.

Schema: vnext-schema/function-definition.schema.json

Function Invocation Types

Functions support three invocation styles:

  1. Domain-level: /api/v1/{domain}/functions/{function} — workflow-independent.
  2. Instance-level: /api/v1/{domain}/workflows/{workflow}/instances/{instance}/functions/{function} — runs in instance context.
  3. Built-in: State, Data, View — three system-provided functions (see Built-in Functions).

Required Fields

FieldTypeDescription
keystringUnique function identifier
versionstringFunction version (SemVer)
domainstringOwning domain
flowstringAssociated flow (if any)
flowVersionstringFlow version
tagsstring[]Tags
attributesobjectFunction behavior (input mapping, task list, output mapping)

Structure

A function typically contains:

  • Input mapping — request → task input
  • Task list — sequential tasks (HTTP, Script, Dapr Service, etc.)
  • Output mapping — task results → response

The IOutputHandler interface is implemented for output mapping; see Interfaces.

Typical Use Cases

  • Cross-domain data: pulling data from domain A to domain B
  • External API gateway: wrapping 3rd-party APIs
  • Aggregation: collecting data from multiple sources
  • BFF replacement: frontend talking to domain without a BFF