Attachments

Examples

Practical patterns for attaching media at different scopes and routing by kind

Scope Patterns

# Inside a task (basic)
type: basic
action: analyze_image
attachments:
  - type: image
    path: "./assets/photo.jpg"

Router by Kind (Image/Audio/Video)

id: media-router
version: 1.0.0

tasks:
  - id: route-by-kind
    type: router
    condition: "{{ .workflow.input.kind }}"
    routes:
      image: analyze-image
      audio: analyze-audio
      video: analyze-video

  - id: analyze-image
    type: basic
    action: analyze
    attachments:
      - type: image
        path: "{{ .workflow.input.ref }}"
    final: true

  - id: analyze-audio
    type: basic
    action: analyze
    attachments:
      - type: audio
        path: "{{ .workflow.input.ref }}"
    final: true

  - id: analyze-video
    type: basic
    action: analyze
    attachments:
      - type: video
        path: "{{ .workflow.input.ref }}"
    final: true

Templating & Deferral

attachments:
  - type: image
    # Resolved in Phase 1
    url: "https://cdn.example.com/{{ .workflow.input.image_id }}.png"

  - type: pdf
    # May defer to Phase 2 if .tasks.extract.id not yet available
    path: "outputs/{{ .tasks.extract.id }}/report.pdf"

Next Steps