dag run
Execute an AI pipeline. Pipelines can be defined inline with --pipeline or loaded from a .dag.json workflow file.
Synopsis
bash
dag run --pipeline "<node> | <node> | ..." [--input key=value] [--watch] [--stdin]
dag run <workflow.dag.json> [--input key=value] [--watch] [--stdin]Inline Pipeline
Use the --pipeline flag to define a pipeline as a pipe-separated string. Each segment is a node type. The special input node injects your --input values and text-output prints the result to stdout.
bash
dag run \
--pipeline "input | llm-text-anthropic | text-output" \
--input text="Hello, what is 2 + 2?"Example output:
text
2 + 2 equals 4.File Mode
Pass a .dag.json file as the first positional argument to run a saved workflow. The file must follow the DAG workflow file format.
bash
dag run workflow.dag.json \
--input text="Summarise the following article: ..."Workflow files can be created with dag build, dag describe, or dag from-mermaid.
Watch Mode
Add --watch to keep the pipeline alive. Each line you type is treated as a new text input and the pipeline runs again.
bash
dag run \
--pipeline "input | llm-text-anthropic | text-output" \
--watchtext
> Translate "hello" to Spanish.
hola
> Translate "goodbye" to Spanish.
adiós
> ^CReading from stdin
Use --stdin to pipe text directly into the pipeline. This is equivalent to --input text=<stdin>.
bash
echo "What is the capital of France?" | dag run \
--pipeline "input | llm-text-anthropic | text-output" \
--stdinFlags
| Flag | Description |
|---|---|
| --pipeline <string> | Inline pipeline definition. Nodes separated by |, data flows left to right. |
| --input <key=value> | Pass input values to the pipeline. Repeat the flag for multiple keys: --input text="..." --input lang="en". |
| --watch | Re-run the pipeline on each line read from stdin. Useful for interactive sessions. |
| --stdin | Read input text from stdin instead of --input text=. Equivalent to piping text into the pipeline. |