Browse documentation

Pipelines

What this is for

A pipeline is a multi-step workflow run by the pipeline runner. It can be triggered manually, on a schedule (via a timer), by a webhook, or by an event (via a trigger). This page controls pipeline metadata, trigger type, and the JSON stages the runner executes.

Why it exists

You need repeatable workflows such as "validate schema, notify Slack, transition stage" without hardcoding them in every custom function.

Why it exists (5-whys):

  1. "Validate → notify → transition" sequences get re-coded per app if there's no declared flow — same logic, N handlers.
  2. stages is a real column (reconciled in migration 020 — dev lineage had it, 001 dropped it) interpreted by pipeline-runner.ts, so every app's workflow shares one executor instead of bespoke code.
  3. UNIQUE(app_id, slug) + type_id make pipelines domain vocabulary — apps declare flows (triage, escalation) scoped to their app, typed like everything else.
  4. pipeline_executions records status, input/output data, and errors per run — async workflows are unauditable without a durable run log.
  5. Root: automation is domain behavior, so it must be declarable like the rest of the domain — pipelines turns multi-step business logic into seeded data the platform executes and audits. (confirmed 2026-11-13)

Fields and settings

  • Name — string. Display name; missing name prevents saving.
  • Trigger Type — select: manual (run by button), scheduled (invoked by a timer), webhook (HTTP call), event (Spine trigger event). Determines what causes a run.
  • Active — checkbox. Inactive pipelines never run, regardless of trigger.
  • App ID — select, optional. Owning app; blank = account-scoped.
  • Description — string, optional.
  • Config (JSON) — free-form runtime configuration passed to the runner.
  • Stages (JSON) — required array of step definitions executed in order by the runner. Each stage is { "stage_type": "<action slug>", "config": {...}, "continue_on_error": false } — stage_type is looked up in public.actions (is_active) at run time; an unknown slug fails the run with "Action not found for stage type".
  • Metadata (JSON) — optional metadata.

Downstream effects

  • The runner executes stages in array order; the JSON is the source of truth — there is no visual step editor. Stage config can embed {{trigger.*}} and {{record.*}} placeholders, resolved recursively at run time (record = the entity row that fired the event).
  • A failed stage aborts the run unless the stage sets continue_on_error: true.
  • Triggers and timers reference pipelines by ID. Changing trigger_type does not rewire existing triggers/timers — relink them separately.
  • scheduled without a linked timer, or event without a matching trigger, means the pipeline never fires.

Minimal configuration

{
  "name": "Notify on create",
  "trigger_type": "event",
  "is_active": true,
  "stages": [
    {
      "stage_type": "send_notification",
      "config": {
        "recipients": ["role:admin"],
        "message": "Record {{record.id}} created"
      }
    }
  ]
}

Full configuration

Multi-stage pipelines compose the seeded built-in action slugs — update_item, create_record, http_request, send_notification, run_pipeline, search_knowledge, query_items, agent_inference, generate_embeddings, revoke_embeddings, create_interaction — with config carrying shared settings (batch sizes, model names, endpoints) and metadata carrying ownership/version notes. Each stage's own config is merged over the action row's defaults.

Example

A support app ships an auto_embed_on_publish pipeline (trigger_type: "event"): stage 1 fetches the published record via admin-data, stage 2 calls an AI agent to generate the embedding, stage 3 writes it back. Two apps can each own a same-named pipeline — the App column disambiguates them in the list.

Core files

  • .framework/functions/pipelines.ts — API
  • .framework/functions/pipeline-runner-background.ts — background executor
  • .framework/functions/pipeline-executions.ts — run history (observability/executions)
  • .framework/src/pages/admin/PipelinesPage.tsx / PipelineDetailPage.tsx — admin UI
  • Tables: public.pipelines, public.pipeline_executions

Agent notes

  • "Runs today" and "last run" come from pipeline_executions — a pipeline with no executions shows Never.
  • Stages must be a JSON array; a pasted object or string is the most common save-time mistake.
  • The runner also implements send_email, kb_ingest, and kb_revoke handlers, but no actions rows are seeded for them — a stage using those slugs throws "Action not found" until you insert a matching public.actions row yourself.
  • Activating/pausing is is_active — a paused pipeline keeps its triggers but they no-op.

Framework documentation — Verified November 16, 2026 · source revision 9f90999.

Was this page helpful? Ask a question · Report a documentation problem