---
title: "Workflow concepts"
description: "How a workflow becomes a pipeline run, with stages, handlers, and recorded results."
category: "Get started"
---

## Workflow, pipeline, and stage

A **workflow** describes work as one or more steps and the order in which they can run. For example: **save an order → update CRM after the order is saved**. You define these steps and their dependencies through the SDK or API.

When your application submits this workflow for order `order-123`, Pipelogiq creates a **pipeline**: one run with its own ID, status, and results. The same workflow can run for many orders, each with a separate execution history.

Each step in that run is a **stage**. Here, `save-order` and `sync-crm` are two stages. Each names a registered **handler** in your application worker. The handler calls your existing save or CRM function and reports the outcome.

In the dashboard, you inspect this pipeline to see which stages completed, any errors, and values the handlers wrote to shared **context**, such as the saved order ID.

**Next: [Run your first workflow](https://pipelogiq.com/docs-next/quickstart/).** Execute a .NET or Java example and inspect its result. The sections below explain the detailed execution rules.

## Applications and pipeline runs

A registered **application in Pipelogiq** owns its pipelines, API keys, schedules, and worker registrations. Dashboard users are assigned to applications. A **pipeline** is one execution with a numeric ID, name, stages, timestamps, and current status. Creating another run with the same name normally creates another pipeline; the name is not an idempotency key.

A **schedule** stores a reusable pipeline definition and trigger. Each firing creates an ordinary pipeline with its own history. An API-created pipeline is already a run, not a reusable template.

Use names that a person can recognize, such as `dispatch-invoice`. Attach non-sensitive business references in keywords and context to identify the operation rather than putting every identifier into the name. Provide useful handler results and logs for operators inspecting the run.

## Stages and handlers

A **stage name** identifies the step within the pipeline. A **handler name** identifies the application code that can execute it. Several stages may use the same handler with different inputs. Workers must register the same handler name that the pipeline specifies.

Stages run in declaration order by default. A stage with an explicit `dependsOn` list waits for those named stages within its pipeline. Treat stage names as stable identifiers: use unique names without commas, tabs, or line breaks. Use the exact names and check that every dependency exists; do not use database stage IDs as dependencies.

Use unique stage names with letters, digits and hyphens, and validate dependency references and cycles in your producer. See [current implementation limits](#current-implementation-limits) for the reasons behind these rules.

```json
{
  "name": "dispatch-invoice",
  "stages": [
    { "stageName": "load", "stageHandlerName": "LoadInvoiceHandler" },
    { "stageName": "email", "stageHandlerName": "EmailInvoiceHandler", "options": { "dependsOn": ["load"] } },
    { "stageName": "archive", "stageHandlerName": "ArchiveInvoiceHandler", "options": { "dependsOn": ["load"] } }
  ]
}
```

After `load` completes, `email` and `archive` can become eligible independently. Actual concurrency depends on workers and delivery capacity. There is no drag-and-drop workflow authoring surface; define workflows in the SDK or API.

## Two kinds of worker

| Component | Responsibility |
| --- | --- |
| Pipelogiq orchestration worker | Finds eligible stages, publishes jobs, processes results, schedules retries, recovers dispatches/leases, and fires schedules. |
| Your application worker | Registers handlers, receives jobs, acquires execution ownership, runs business code, and reports results. |

Starting the Docker stack does not provide your payment, email, or document handlers. The [installation test](https://pipelogiq.com/docs-next/installation/) supplies a temporary HTTP application worker so you can verify the complete path before adding your own.

An execution attempt has an `executionId` and `attempt`. These are distinct from the pipeline ID and stage ID. Workers echo them in results so a delayed response from an older attempt cannot overwrite a newer execution.

Your application remains responsible for provider/database calls, idempotency, and reconciliation of unknown outcomes. See [reliability](https://pipelogiq.com/docs-next/reliability/) for handling repeated attempts and uncertain external effects.

## Input, output, context, and keywords

Stage `input` and result output are strings. JSON input must therefore be serialized as a string in raw HTTP requests:

```json
{
  "stageName": "email",
  "stageHandlerName": "EmailInvoiceHandler",
  "input": "{\"invoiceId\":\"invoice-42\"}"
}
```

**Context** is the pipeline's shared set of key/value items. Values are strings with optional type metadata. Workers can add/update context and send deletion markers. **Keywords** are key/value labels useful for grouping and finding runs. They are not a secret store.

```json
{
  "pipelineKeywords": [{ "key": "workflow", "value": "invoicing" }],
  "pipelineContextItems": [
    { "key": "invoiceId", "value": "invoice-42" },
    { "key": "accessToken", "value": "provided-at-runtime", "isSensitive": true }
  ]
}
```

The token value above illustrates the shape; provide a real runtime value through your application. Sensitive context is redacted in public run views, while execution workers receive the actual value. Mark values sensitive before they enter the workflow. Redaction is not automatic identification of all personal or confidential data.

## Events, approvals, and dynamically added stages

`isEvent` marks an event stage; it still follows durable stage scheduling and result processing. It is not a subscription that waits for an arbitrary external event to arrive.

A handler can return `isWaitingForApproval:true`. The stage then stays at `WaitingForApproval` until an application calls the approval-resume API. Approval decisions are implemented through the SDK/API, not a dashboard approve/reject button. Your application must authenticate and authorize the reviewer for that pipeline and stage. See [reliability](https://pipelogiq.com/docs-next/reliability/) and [AI-agent approvals](https://pipelogiq.com/docs-next/agents/#require-approval-before-a-change).

An application can append stages to a nonterminal run, or return appended stages in a worker result. This supports work discovered during execution. Appending after the pipeline is terminal is rejected; it is not a way to reopen a finished run.

There is no general stage timer option. Use [Once schedules](https://pipelogiq.com/docs-next/schedules/) for a future pipeline start and retry options for retry delays.

## Current implementation limits

For this server revision, prefer stage names containing letters, digits and hyphens. The [dispatcher uses an unescaped SQL `LIKE` pattern](https://github.com/pipelogiq/pipelogiq/blob/ab47a81098bdb956f4b0a46bed020a3d50a1597c/apps/go/internal/store/store.go#L780), so `%` and `_` in a stage name can match other dependency names. The request validator checks dependency-string format, not a complete acyclic graph. Validate references and cycles in your producer: a missing name is not a reliable wait condition, and a cycle can prevent progress. These are implementation limits, not intended workflow features.

The schema includes `runInParallelWith`, `failIfOutputEmpty`, `notifyOnFailure`, and `runAsUser`, but these are not general execution guarantees in the current server. Use named dependencies for ordering and implement output validation and business authorization in your handlers.
