Command Line Interface
Overview
The Dagu CLI provides all the necessary commands to manage and execute DAGs (workflows) directly from the terminal. It allows you to start, stop, retry, and monitor workflows, as well as manage the underlying scheduler and web server.
Complete Reference
For the full CLI command reference, see CLI Commands Reference.
Basic Usage
dagu [global options] command [command options] [arguments...]Getting Help
# General help
dagu --help
# Command-specific help
dagu start --help
# Show version
dagu versionRemote Contexts
The CLI can route context-aware commands to a remote Dagu server through named CLI contexts.
# Register a remote server
dagu context add staging \
--server https://staging.example.com \
--api-key dagu_xxxxxxxxxxxxxxxxxxxx
# Use it for later commands
dagu context use staging
# Or target it explicitly for one command
dagu --context staging status nightly-backupOnly these commands are context-aware: start, enqueue, status, history, stop, retry, restart, and dequeue.
Remote contexts only work with DAGs that already exist on the remote server. Local YAML paths are rejected.
Essential Commands
Running Workflows
Start a Workflow
# Basic execution
dagu start my-workflow.yaml
# With named parameters (use -- separator)
dagu start etl.yaml -- DATE=2024-01-01 ENV=prod
# With positional parameters
dagu start my-workflow.yaml -- value1 value2 value3
# Override DAG name
dagu start --name my_custom_name my-workflow.yaml
# Queue for later
dagu enqueue my-workflow.yaml
# Remove a queued run (by queue name)
dagu dequeue defaultdagu start requires a DAG name or file path.
Stop a Running Workflow
# Stop currently running workflow
dagu stop my-workflow
# Stop specific run
dagu stop --run-id=20240101_120000 my-workflow
# Can also use file path
dagu stop my-workflow.yamlRestart a Workflow
# Restart the currently running DAG-run for this workflow
dagu restart my-workflow
# Restart a specific running DAG-run
dagu restart --run-id=20240101_120000 my-workflowRetry Failed Workflow
# Retry specific run (run-id is required)
dagu retry --run-id=20240101_120000 my-workflow
# Can also use file path
dagu retry --run-id=20240101_120000 my-workflow.yamlMonitoring Workflows
Check Status
# Check latest run status
dagu status my-workflow
# Check specific run status
dagu status --run-id=20240101_120000 my-workflow
# Can also use file path
dagu status my-workflow.yamlView Status of a DAG run
# Check detailed status and output
dagu status my-workflow.yaml
# Note: For detailed logs, use the web UI at http://localhost:8080
# or check log files in the configured log directoryView Execution History
The history command displays past DAG executions with filtering and export capabilities:
# View recent runs
dagu history my-workflow
# Debug recent failures
dagu history my-workflow --status failed --last 7d
# Export to JSON for analysis
dagu history --format json --limit 500 > history.json
# Export to CSV for spreadsheets
dagu history --format csv > history.csv
# Filter by tags (AND logic)
dagu history --tags "prod,critical"Key features:
- Default: last 30 days, 100 results
- Date filters: absolute (
--from/--to) or relative (--last 7d) - Status filters:
succeeded,failed,running, etc. (with aliases) - Output: table (default), JSON, or CSV
- Run IDs never truncated
See history reference for all options.
Testing and Validation
Validate DAG Specification
# Validate DAG structure and references
dagu validate my-workflow.yaml
# Returns human-readable validation errors if anyDry Run
# Test DAG execution without running it
dagu dry my-workflow.yaml
# With parameters
dagu dry my-workflow.yaml -- DATE=2024-01-01
# Override DAG name
dagu dry --name my_custom_name my-workflow.yamlServer Commands
Start Everything
# Start scheduler, web UI, and coordinator service (default: localhost:8080)
dagu start-all
# Custom host and port
dagu start-all --host=0.0.0.0 --port=9000
# Custom DAGs directory
dagu start-all --dags=/path/to/directoryStart Scheduler Only
# Run just the scheduler (no UI)
dagu scheduler
# Custom DAGs directory
dagu scheduler --dags=/opt/workflowsStart Web UI Only
# Run just the web server (no scheduler)
dagu server
# Custom host and port
dagu server --host=0.0.0.0 --port=9000
# Custom DAGs directory
dagu server --dags=/path/to/directoryDistributed Execution Commands
Start Coordinator
# Start the coordinator gRPC server
dagu coordinator
# Custom host and port
dagu coordinator --coordinator.host=0.0.0.0 --coordinator.port=50055
# With TLS
dagu coordinator \
--peer.cert-file=server.pem \
--peer.key-file=server-key.pemThe coordinator service manages task distribution to workers for distributed execution with automatic service registry and health monitoring.
Start Worker
# Start a worker that polls for tasks
dagu worker
# With labels for capability matching
dagu worker --worker.labels gpu=true,memory=64G,region=us-east-1
# With custom worker ID and concurrency
dagu worker \
--worker.id=gpu-worker-01 \
--worker.max-active-runs=50Workers automatically register in the service registry system and poll the coordinator for matching tasks based on their labels.
AI Coding Tool Integration
Install Dagu Skill
Use Dagu's built-in installer:
dagu ai install --skills-dir ~/.agents/skillsOr use the shared skills CLI:
npx skills add https://github.com/dagucloud/dagu --skill daguSee CLI Commands for more details.
Advanced Usage
Queue Management
# Add to queue
dagu enqueue my-workflow.yaml
# Add to queue with custom ID
dagu enqueue --run-id=custom-001 my-workflow.yaml
# Add to queue with parameters
dagu enqueue my-workflow.yaml -- KEY=value
# Add to queue using a specific queue (override)
dagu enqueue --queue=high-priority my-workflow.yaml
# Override DAG name
dagu enqueue --name my_custom_name my-workflow.yaml
# Remove next item from queue
dagu dequeue default
# Remove specific run from queue
dagu dequeue default --dag-run=my-workflow:custom-001Working with Parameters
Parameters can be passed in multiple ways:
# Positional parameters (use -- separator)
dagu start my-workflow.yaml -- param1 param2 param3
# Named parameters (use -- separator)
dagu start my-workflow.yaml -- KEY1=value1 KEY2=value2
# Mixed (use -- separator)
dagu start my-workflow.yaml -- param1 KEY=value param2CLI Configuration
Global Options
| Option | Description | Default |
|---|---|---|
--config | Config file path | ~/.config/dagu/config.yaml |
--log-level | Log verbosity | info |
--log-format | Output format | text |
--quiet | Suppress output | false |
See Also
- Explore the REST API for programmatic access
- Set up the Web UI for visual monitoring
- Learn workflow syntax to build complex DAGs
- Configure distributed execution for scaling workflows
