> For the complete documentation index, see [llms.txt](https://v2.dataos.info/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://v2.dataos.info/references/dataos-resources/workflow.md).

# Workflow

A Workflow is a batch workload that runs steps in a directed acyclic graph, or DAG. Use it to orchestrate scheduled jobs, validations, backfills, and repeatable batch tasks.

Each DAG node is a step. Each dependency edge defines execution order. The Workflow defines orchestration. The stack defines what each step runs.

## Access requirements

Before creating or managing a Workflow, ensure you have the required permissions. See [Workflow: Access control](https://v2.dataos.info/operate/access-model/resource-level-permissions/workflow-access-control).

## When to use

Use a Workflow when you need to:

* Run batch logic to completion.
* Trigger execution on a schedule or on demand.
* Coordinate one or more dependent steps.

## Manifest structure

Use the following structure to define a Workflow resource.

{% code title="workflow\.yaml" expandable="true" collapsedlinecount="12" %}

```yaml
version: v2alpha
name: ${{workflow-name}}
type: workflow
tags:
  - ${{tag1}}
  - ${{tag2}}
description: ${{workflow-description}}
spec:
  schedule:
    crons:
      - ${{cron-expression}}
    timezone: UTC
    concurrencyPolicy: Forbid
  dag:
    - name: ${{step-name}}
      title: ${{step-title}}
      depends:
        - ${{upstream-step-name}}
      spec:
        compute: ${{compute-resource}}
        resources:
          requests:
            cpu: ${{cpu-request}}
            memory: ${{memory-request}}
          limits:
            cpu: ${{cpu-limit}}
            memory: ${{memory-limit}}
        stack: ${{stack-name}}
        stackSpec:
          ${{stack-specific-configuration}}
```

{% endcode %}

## Create a Workflow

Create a Workflow in four steps:

1. Design the DAG.
2. Add runtime settings for each step.
3. Apply the manifest.
4. Verify the run.

### 1. Design the DAG

Start by defining the steps in `spec.dag`.

Use a single step for simple jobs. Add more steps when work must happen in stages. Use `depends` to define execution order.

### 2. Add runtime settings for each step

For each step, define the runtime that executes it.

Start with:

* `spec.dag[].spec.compute`
* `spec.dag[].spec.stack`
* `spec.dag[].spec.stackSpec`

Then add, when needed:

* `resources` for CPU and memory controls
* `use.projection` for secrets and runtime configuration
* `use.volumes` for shared files across steps
* `schedule` for automatic runs

### 3. Apply the manifest

Apply the Workflow:

```bash
dataos-ctl resource apply -f workflow.yaml
```

### 4. Verify the run

Check the Workflow details:

```bash
dataos-ctl resource get -t workflow -n ${{workflow-name}} -d
```

Check the runtime details:

```bash
dataos-ctl resource runtime get -t workflow -n ${{workflow-name}}
```

Inspect logs when a step fails or needs validation:

```bash
dataos-ctl resource log -t workflow -n ${{workflow-name}}
```

## Learn the building blocks

Use [Core concepts](/references/dataos-resources/workflow/core-concepts.md) for DAG design, scheduling, steps, stacks, projections, and storage.

Use [Example](/references/dataos-resources/workflow/example.md) for end-to-end Workflow manifests.

## Workflow lifecycle

Workflows are runnable resources. They support runtime details and logs from creation through completion.

### Create or update a Workflow

```bash
dataos-ctl resource apply -f /home/workflow.yaml
```

### Get the specific Workflow details

```bash
dataos-ctl resource get -t workflow -n echo-workflow -d
```

### View runtime details

```bash
dataos-ctl resource runtime get -t workflow -n echo-workflow
```

### List Workflows

```bash
dataos-ctl resource get -t workflow
```

### View across all Workspaces

```bash
dataos-ctl resource get -t workflow -a
```

### View execution logs

```bash
dataos-ctl resource log -t workflow -n echo-workflow
```

### View logs for a specific container

```bash
dataos-ctl resource log -t workflow -n echo-workflow --container extract
```

### Delete a Workflow

```bash
dataos-ctl resource delete -t workflow -n echo-workflow
```

## Workflow states

Workflows move through these common states:

* `creating`
* `active`
* `running`
* `succeeded`
* `failed`
* `deleted`

## Field reference

See [Field reference](/references/dataos-resources/workflow/field-reference.md) for the complete Workflow manifest field reference, including DAG and step-level runtime fields.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://v2.dataos.info/references/dataos-resources/workflow.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
