Configuration

Flowgen reads a single YAML file (passed via --config). Top-level sections:

flows:             # Flow discovery (required).
cache:             # Distributed cache backend (optional).
resources:         # External resource loading (optional).
http_server:       # Webhook / metrics HTTP server (optional).
mcp_server:        # MCP server for tools/resources/prompts (optional).
ai_gateway:        # OpenAI-compatible LLM gateway (optional).
web:               # Admin web UI (optional).
retry:             # Default retry policy for every task (optional).
event_buffer_size: # Per-edge channel capacity (optional).
telemetry:         # OpenTelemetry export (optional).

Only flows is required. Every other section has working defaults.

Minimal config

flows:
  path: /etc/flowgen/flows/

Discovers every .yaml/.yml/.json file under the path and runs them with an in-memory cache, no resources directory, no HTTP server, and no telemetry.

Full reference

flows:
  path: /etc/flowgen/flows/
  cache:
    enabled: true
    prefix: flowgen.flows
    db_name: flowgen_system

cache:
  enabled: true
  type: nats
  credentials_path: /etc/nats/credentials.json
  url: "{{env.NATS_URL}}"
  db_name: flowgen_cache
  history: 10
  tombstone_ttl: "1h"

resources:
  path: /etc/flowgen/resources/

http_server:
  enabled: true
  port: 3000
  path: /api/flowgen/workers/v1
  credentials_path: /etc/flowgen/credentials/http.json
  auth:
    type: jwt
    secret: "shared-secret"

mcp_server:
  enabled: true
  port: 3001
  path: /mcp/v1
  credentials_path: /etc/flowgen/credentials/mcp.json

ai_gateway:
  enabled: true
  port: 3002
  path: /v1
  credentials_path: /etc/flowgen/credentials/ai.json

web:
  enabled: true
  port: 8080
  path: /flowgen

retry:
  max_attempts: 10
  initial_backoff: "1s"

event_buffer_size: 10000

telemetry:
  enabled: true
  otlp_endpoint: http://localhost:4317
  service_name: flowgen
  metrics_export_interval: "60s"

flows

Flow discovery. Filesystem and distributed cache can be used independently or together; flowgen merges flows from both sources at startup.

FieldTypeDefaultDescription
pathstringDirectory or glob pattern. Filesystem-mode loads every .yaml/.yml/.json file recursively. Omit to skip filesystem loading.
cacheobjectCache-mode flow loading. Loads flows from the metadata cache in addition to the filesystem.
cache.enabledboolrequiredEnable cache-mode flow loading.
cache.prefixstringflowgen.flowsCache key prefix for flow entries.
cache.db_namestringflowgen_systemCache bucket holding the flow definitions.

Both sources can be active at the same time. Use this for gradual migration: a small set of bootstrap flows mounted from disk (typically a sync flow that pulls user flows from Git into the cache), with the bulk of user flows loaded from the cache. On a name collision the filesystem entry wins, so a locally mounted bootstrap flow cannot be silently overridden by a stale cache entry.

Cache-mode flow loading is useful when flows are provisioned dynamically — for example, a control plane writes flow YAML into NATS KV and every flowgen replica picks them up.

cache

Distributed cache backend. When omitted, flowgen uses an in-memory cache (single-node only).

FieldTypeDefaultDescription
enabledboolrequiredSet false to fall back to in-memory cache.
typestringrequiredBackend type. Currently nats.
credentials_pathstringrequiredPath to NATS credentials file.
urlstringlocalhost:4222NATS server URL.
db_namestringflowgen_cacheKV bucket name.
historyint10Historical entries retained per key. Only applies when the bucket is created.
tombstone_ttlduration1hTTL for delete/purge tombstones. Required for per-key TTLs on cache entries to work.

If NATS is configured but unreachable, flowgen falls back to in-memory automatically and logs a warning. See Caching.

resources

External resource loading for SQL queries, prompts, scripts, schemas. See Resources.

FieldTypeDefaultDescription
pathstringFilesystem base directory for resources. Resource keys resolve relative to this path.
cacheobjectCache-backed resources. When cache.enabled is true, resources load from the cache.
cache.enabledboolrequiredEnable cache-backed resources.
cache.prefixstringflowgen.resourcesCache key prefix for resource entries.
cache.db_namestringflowgen_systemCache bucket holding resource entries.

When resources is omitted, only inline content is supported — any task that uses { resource: ... } will fail at startup with a clear error.

http_server

HTTP server that hosts every http_endpoint route plus health/metrics endpoints.

FieldTypeDefaultDescription
enabledboolrequiredRequired for http_endpoint tasks to start.
portint3000Listening port.
pathstringOptional path prefix applied to every registered route.
credentials_pathstringShared bearer/basic credentials. Tasks override per-route. See Credentials.
authobjectUser-level authentication provider (JWT, OIDC, session). See Authentication.

mcp_server

MCP server for exposing mcp_tool, mcp_resource, and mcp_prompt tasks to LLM clients.

FieldTypeDefaultDescription
enabledboolrequiredRequired for any MCP task to register.
portint3001Listening port.
pathstring/mcp/v1MCP endpoint path.
credentials_pathstringShared API key credentials. Individual tools can override.
authobjectUser-level authentication provider (JWT, OIDC, session). See Authentication.
resource_uri_schemestringflowgenScheme used when auto-generating mcp_resource URIs of the form <scheme>://<flow_name>/<name>. White-label deployments override this.

ai_gateway

OpenAI-compatible LLM gateway that serves every registered llm_proxy flow.

FieldTypeDefaultDescription
enabledboolrequiredRequired for llm_proxy tasks to be registered.
portint3002Listening port, independent of the webhook HTTP server.
pathstring/v1Path prefix for AI gateway routes. The chat completions endpoint is served at <path>/chat/completions.
credentials_pathstringPath to global credentials file. Individual llm_proxy tasks can override.
authobjectUser-level authentication provider (JWT, OIDC, session). See Authentication.

web

Embedded admin dashboard for inspecting loaded flows and resources at runtime.

FieldTypeDefaultDescription
enabledboolrequiredSet true to start the admin server.
portint8080Listening port.
pathstring/Path prefix. Use a subpath (e.g. /flowgen) when co-hosting under a tenant subdomain like tenant.example.com/flowgen.

The UI lists loaded flows with description, tags, status, and last-run timestamp; click a row to preview the raw source YAML with syntax highlighting. A Resources tab browses everything under the configured resources.path and renders .md files as HTML plus code files (SQL, YAML, JSON, Rhai, JS/TS, Bash, Python) with Prism.

retry

Sets the default retry policy for every task. Individual tasks can override via their own retry field.

FieldTypeDefaultDescription
max_attemptsint / null10Maximum attempts before giving up. null for infinite retries.
initial_backoffduration1sDelay before first retry. Each subsequent retry doubles, with jitter.

See Retry for the two retry patterns (circuit breaker for processors, infinite reconnect for subscribers).

event_buffer_size

Each pair of connected tasks shares a bounded mpsc channel. event_buffer_size sets the channel capacity (in events). When the channel fills, the upstream task blocks until the downstream task drains a slot — this is how backpressure propagates through the flow. No events are dropped.

The default (10,000) is sufficient for most workloads. The buffer only needs to absorb the gap between producer and consumer processing rates; downstream throughput is determined by task processing speed, not channel depth. Increase it if you observe producer stalls in flows with very bursty fan-out patterns and fast consumers.

telemetry

OpenTelemetry export over OTLP/gRPC. See Telemetry.

FieldTypeDefaultDescription
enabledboolrequiredSet true to start the OTLP exporter.
otlp_endpointstringhttp://localhost:4317OTLP/gRPC endpoint.
service_namestringflowgenservice.name resource attribute.
metrics_export_intervalduration60sHow often metric snapshots are pushed.

When telemetry is omitted entirely, no OTLP exporter starts but tracing logs still go to stderr.

Running

flowgen --config /etc/flowgen/config.yaml

Flowgen validates the config at startup. Any field with a typo, missing required value, or invalid type produces an error before any flow runs.