Skip to content

Artifact

Write, read, and list DAG-run artifacts without referencing DAG_RUN_ARTIFACTS_DIR directly. Use artifact.write for explicit artifact content, and use stdout.artifact / stderr.artifact on command steps when the command stream itself should become the artifact.

Using an artifact.* action or artifact stream output automatically enables artifact storage for the DAG. If artifacts.enabled: false is set explicitly, artifact actions and artifact stream outputs are invalid. References to DAG_RUN_ARTIFACTS_DIR also auto-enable artifact storage, but command streams are usually clearer with stdout.artifact or stderr.artifact.

Command Stream Output

When a command produces large report, JSON, Markdown, or log content, attach stdout or stderr directly to an artifact instead of capturing it with output: or redirecting through shell:

yaml
steps:
  - id: report
    run: ./generate-report --format markdown
    stdout:
      artifact: reports/report.md

  - id: diagnostics
    run: ./collect-diagnostics
    stderr:
      artifact: logs/diagnostics.err

Artifact stream paths are relative to the DAG-run artifact directory. Parent directories are created automatically. Absolute paths, Windows drive paths, and paths containing .. are rejected.

Actions

ActionDescription
artifact.writeWrite text content to a run artifact.
artifact.readRead a run artifact to stdout.
artifact.listList run artifacts as JSON.

Write

yaml
steps:
  - id: save_report
    action: artifact.write
    with:
      path: reports/summary.md
      content: |
        # Summary
        status: ok
      overwrite: true

path is relative to the DAG-run artifact directory. Parent directories are created automatically. Absolute paths, Windows drive paths, and paths containing .. are rejected.

Read

yaml
steps:
  - id: read_report
    action: artifact.read
    with:
      path: reports/summary.md
    output: REPORT

By default, artifact.read writes the file content to stdout. Use format: json to emit metadata and content as JSON:

yaml
steps:
  - action: artifact.read
    with:
      path: reports/summary.md
      format: json

List

yaml
steps:
  - id: list_reports
    action: artifact.list
    with:
      path: reports
      recursive: true
      pattern: "**/*.md"

artifact.list writes JSON to stdout with artifact-relative paths.

Fields

FieldActionsTypeDefaultDescription
pathallstring. for listArtifact-relative path. Required for write and read.
contentwritestring-Text content to write.
overwritewritebooleanfalseReplace an existing artifact.
atomicwritebooleantrueWrite by atomic replacement when overwriting.
modewritestring0600File mode such as 0600 or 0644.
formatreadstringrawraw or json.
max_bytesreadinteger0Maximum bytes to read. Zero means no limit.
recursivelistbooleanfalseInclude nested files.
include_dirslistbooleanfalseInclude directories in the JSON entries.
patternliststring-Glob pattern matched against artifact-relative paths.

Use file.* when you need to operate on arbitrary local paths. Use artifact.* when the file is part of the DAG-run output that users should inspect or download from Dagu.

Released under the MIT License.