Skip to content

Workflow DSL Reference

Triggerfish च्या workflow engine मध्ये implement केलेल्या CNCF Serverless Workflow DSL 1.0 साठी Complete reference. Usage guide आणि examples साठी Workflows पहा.

Document Structure

प्रत्येक workflow YAML ला top-level document field आणि do block असणे आवश्यक आहे.

yaml
document:
  dsl: "1.0"
  namespace: my-namespace
  name: my-workflow
  version: "1.0.0"            # optional
  description: "What it does"  # optional
classification_ceiling: INTERNAL  # optional
input:                            # optional
  from: "${ . }"
output:                           # optional
  from:
    result: "${ .final_step }"
timeout:                          # optional
  after: PT5M
do:
  - task_name:
      # task definition

Document Metadata

FieldTypeRequiredवर्णन
dslstringहोDSL version. "1.0" असणे आवश्यक आहे
namespacestringहोLogical grouping (उदा. ops, reports)
namestringहोNamespace मध्ये Unique workflow name
versionstringनाहीSemantic version string
descriptionstringनाहीHuman-readable description

Top-Level Fields

FieldTypeRequiredवर्णन
documentobjectहोDocument metadata (वर पहा)
doarrayहोTask entries ची Ordered list
classification_ceilingstringनाहीExecution दरम्यान Maximum allowed session taint
inputtransformनाहीWorkflow input ला applied Transform
outputtransformनाहीWorkflow output ला applied Transform
timeoutobjectनाहीWorkflow-level timeout (after: <ISO 8601>)
metadataobjectनाहीArbitrary key-value metadata

Task Entry Format

do block मधील प्रत्येक entry single-key object आहे. Key task name आहे, value task definition आहे.

yaml
do:
  - my_task_name:
      call: http
      with:
        endpoint: "https://example.com"

Task names same do block मध्ये unique असणे आवश्यक आहे. Task result task name खाली data context मध्ये stored होतो.


Common Task Fields

सर्व task types हे optional fields share करतात:

FieldTypeवर्णन
ifstringExpression condition. Falsy असल्यास Task skipped होतो.
inputtransformTask execution पूर्वी applied Transform
outputtransformTask execution नंतर applied Transform
timeoutobjectTask timeout: after: <ISO 8601 duration>
thenstringFlow directive: continue, end, किंवा task name
metadataobjectArbitrary key-value metadata. Self-healing enabled असल्यास, description, expects, produces आवश्यक आहेत.

Self-Healing Configuration

metadata.triggerfish.self_healing block workflow साठी autonomous healing agent enable करतो. Full guide साठी Self-Healing पहा.

yaml
metadata:
  triggerfish:
    self_healing:
      enabled: true
      retry_budget: 3
      approval_required: true
      pause_on_intervention: blocking_only
      pause_timeout_seconds: 300
      pause_timeout_policy: escalate_and_halt
      notify_on: [intervention, escalation, approval_required]
FieldTypeRequiredDefaultवर्णन
enabledbooleanहोHealing agent enable करा
retry_budgetnumberनाही3Max intervention attempts
approval_requiredbooleanनाहीtrueFixes साठी human approval आवश्यक
pause_on_interventionstringनाही"blocking_only"always | never | blocking_only
pause_timeout_secondsnumberनाही300Timeout policy fire होण्यापूर्वी seconds
pause_timeout_policystringनाही"escalate_and_halt"escalate_and_halt | escalate_and_skip | escalate_and_fail
notify_onarrayनाही[]intervention | escalation | approval_required

Step Metadata (Self-Healing Enabled असल्यावर आवश्यक)

self_healing.enabled true असल्यावर, प्रत्येक task ला हे metadata fields include करणे आवश्यक आहे. Parser त्यापैकी कोणतेही missing असलेले workflows reject करतो.

FieldTypeवर्णन
descriptionstringStep काय करतो आणि का
expectsstringInput shape किंवा आवश्यक preconditions
producesstringGenerated output shape
yaml
- fetch-invoices:
    call: http
    with:
      endpoint: "https://api.example.com/invoices"
    metadata:
      description: "Fetch open invoices from billing API"
      expects: "API available, returns JSON array"
      produces: "Array of {id, amount, status} objects"

Task Types

call

HTTP endpoint किंवा Triggerfish service ला Dispatch करा.

FieldTypeRequiredवर्णन
callstringहोCall type (खालील dispatch table पहा)
withobjectनाहीTarget tool ला passed Arguments
yaml
- fetch:
    call: http
    with:
      endpoint: "https://api.example.com/data"
      method: GET

run

Shell command, inline script, किंवा sub-workflow execute करा. run field मध्ये shell, script, किंवा workflow पैकी exactly एक असणे आवश्यक आहे.

Shell:

FieldTypeRequiredवर्णन
run.shell.commandstringहोExecute करायचा Shell command
run.shell.argumentsobjectनाहीNamed arguments
run.shell.environmentobjectनाहीEnvironment variables

Script:

FieldTypeRequiredवर्णन
run.script.languagestringहोScript language
run.script.codestringहोInline script code
run.script.argumentsobjectनाहीNamed arguments

Sub-workflow:

FieldTypeRequiredवर्णन
run.workflow.namestringहोSaved workflow चे Name
run.workflow.versionstringनाहीVersion constraint
run.workflow.inputobjectनाहीSub-workflow साठी Input data

set

Data context ला values assign करा.

FieldTypeRequiredवर्णन
setobjectहोAssign करायचे Key-value pairs. Values expressions असू शकतात.
yaml
- prepare:
    set:
      full_name: "${ .first_name } ${ .last_name }"
      count: 0

switch

Conditional branching. switch field case entries चा array आहे. प्रत्येक case single-key object आहे जेथे key case name आहे.

Case fieldTypeRequiredवर्णन
whenstringनाहीExpression condition. Default case साठी omit करा.
thenstringहोFlow directive: continue, end, किंवा task name

Cases order मध्ये evaluated होतात. Truthy when (किंवा कोणतेही when नाही) असलेला पहिला case घेतला जातो.

yaml
- route:
    switch:
      - high:
          when: "${ .priority > 7 }"
          then: alert_team
      - low:
          then: log_only

for

Collection वर iterate करा.

FieldTypeRequiredवर्णन
for.eachstringहोCurrent item साठी Variable name
for.instringहोCollection reference करणारे Expression
for.atstringनाहीCurrent index साठी Variable name
doarrayहोप्रत्येक iteration साठी executed Nested task list
yaml
- process_all:
    for:
      each: item
      in: "${ .items }"
      at: idx
    do:
      - handle:
          call: triggerfish:llm
          with:
            task: "Process item ${ .idx }: ${ .item.name }"

raise

Structured error सह workflow halt करा.

FieldTypeRequiredवर्णन
raise.error.statusnumberहोHTTP-style status code
raise.error.typestringहोError type URI/string
raise.error.titlestringहोHuman-readable title
raise.error.detailstringनाहीDetailed error message
yaml
- abort:
    raise:
      error:
        status: 422
        type: "validation-error"
        title: "Invalid input"
        detail: "Field 'email' is required"

emit

Workflow event record करा. Events run result मध्ये stored आहेत.

FieldTypeRequiredवर्णन
emit.event.typestringहोEvent type identifier
emit.event.sourcestringनाहीEvent source URI
emit.event.dataobjectनाहीEvent payload
yaml
- record:
    emit:
      event:
        type: "step.completed"
        source: "workflow/pipeline"
        data:
          step: "transform"
          duration_ms: 1200

wait

Duration साठी execution pause करा.

FieldTypeRequiredवर्णन
waitstringहोISO 8601 duration (उदा. PT5S)

Common durations: PT1S (1 second), PT30S (30 seconds), PT1M (1 minute), PT5M (5 minutes).


Call Dispatch Table

call field value ला actually invoke केलेल्या Triggerfish tool शी maps करतो.

call valueTool invokedRequired with: fields
httpweb_fetchendpoint किंवा url; optional method, headers, body
triggerfish:llmllm_taskprompt किंवा task; optional tools, max_iterations
triggerfish:agentsubagentprompt किंवा task; optional tools, agent
triggerfish:memorymemory_*operation (save/search/get/list/delete) + operation fields
triggerfish:web_searchweb_searchquery; optional max_results
triggerfish:web_fetchweb_fetchurl; optional method, headers, body
triggerfish:mcpmcp__<server>__<tool>server, tool; optional arguments
triggerfish:messagesend_messagechannel, text; optional recipient

Unsupported CNCF call types (grpc, openapi, asyncapi) error return करतात.


Expression Syntax

Expressions ${ } द्वारे delimited आहेत आणि workflow data context विरुद्ध resolve होतात.

Dot-Path Resolution

Syntaxवर्णनExample result
${ . }संपूर्ण data context{...}
${ .key }Top-level key"value"
${ .a.b.c }Nested key"deep value"
${ .items[0] }Array index{...first item...}
${ .items[0].name }Array index नंतर key"first"

Leading dot (किंवा $.) context root वर path anchor करतो. undefined ला resolve होणारे Paths interpolated असल्यावर empty string, किंवा standalone value म्हणून वापरल्यावर undefined produce करतात.

Operators

TypeOperatorsExample
Comparison==, !=, >, <, >=, <=${ .count > 0 }
Arithmetic+, -, *, /, %${ .price * .quantity }

Comparison expressions true किंवा false return करतात. Arithmetic expressions number return करतात (कोणतेही operand numeric नसल्यास किंवा division by zero असल्यास undefined).

Literals

TypeExamples
String"hello", 'hello'
Number42, 3.14, -1
Booleantrue, false
Nullnull

Interpolation Modes

Single expression (raw value): जेव्हा संपूर्ण string एकच ${ } expression आहे, raw typed value return होतो (number, boolean, object, array).

yaml
count: "${ .items.length }"  # number return करतो, string नाही

Mixed / multiple expressions (string): जेव्हा ${ } expressions text सह mixed आहेत किंवा multiple expressions आहेत, result नेहमी string आहे.

yaml
message: "Found ${ .count } items in ${ .category }"  # string return करतो

Truthiness

if: conditions आणि switch when: expressions साठी, values JavaScript-style truthiness वापरून evaluated आहेत:

ValueTruthy?
trueहो
Non-zero numberहो
Non-empty stringहो
Non-empty arrayहो
Objectहो
false, 0, "", null, undefined, empty arrayनाही

Input/Output Transforms

Transforms tasks मध्ये आणि बाहेर flowing data reshape करतात.

input

Task execution पूर्वी applied. Task च्या data context च्या view ला replace करतो.

yaml
- step:
    call: http
    input:
      from: "${ .config }"       # task फक्त config object पाहतो
    with:
      endpoint: "${ .api_url }"  # config object विरुद्ध resolved

from as string: संपूर्ण input context replace करणारे Expression.

from as object: नवीन keys ला expressions map करतो:

yaml
input:
  from:
    url: "${ .config.api_url }"
    token: "${ .secrets.api_token }"

output

Task execution नंतर applied. Task name खाली context मध्ये store होण्यापूर्वी result reshape करतो.

yaml
- fetch:
    call: http
    output:
      from:
        items: "${ .fetch.data.results }"
        count: "${ .fetch.data.total }"

Flow Directives

कोणत्याही task वरील then field task complete झाल्यावर execution flow control करतो.

ValueBehavior
continueSequence मधील पुढील task ला proceed करा (default)
endWorkflow stop करा. Status: completed.
<task name>Named task ला jump करा. Task same do block मध्ये exist असणे आवश्यक आहे.

Switch cases देखील त्यांच्या then field मध्ये flow directives वापरतात.


Classification Ceiling

Execution दरम्यान maximum session taint restrict करणारे Optional field.

yaml
classification_ceiling: INTERNAL
Valueअर्थ
PUBLICकोणताही classified data access झाल्यास Workflow halts
INTERNALPUBLIC आणि INTERNAL data allow करतो
CONFIDENTIALCONFIDENTIAL data पर्यंत allow करतो
RESTRICTEDसर्व classification levels allow करतो
(omitted)कोणतेही ceiling enforced नाही

Ceiling प्रत्येक task पूर्वी checked आहे. Session taint ceiling पेक्षा escalate झाल्यास (उदा. prior task ने classified data access केल्यामुळे), workflow status failed सह आणि error Workflow classification ceiling breached सह halts होतो.


Storage

Workflow Definitions

Key prefix workflows:{name} सह Stored. प्रत्येक stored record contain करतो:

FieldTypeवर्णन
namestringWorkflow name
yamlstringRaw YAML definition
classificationstringSave वेळी Classification level
savedAtstringISO 8601 timestamp
descriptionstringOptional description

Run History

Key prefix workflow-runs:{runId} सह Stored. प्रत्येक run record contain करतो:

FieldTypeवर्णन
runIdstringया execution साठी UUID
workflowNamestringExecute केलेल्या workflow चे Name
statusstringcompleted, failed, किंवा cancelled
outputobjectFinal data context (internal keys filtered)
eventsarrayExecution दरम्यान emitted events
errorstringError message (status failed असल्यास)
startedAtstringISO 8601 timestamp
completedAtstringISO 8601 timestamp
taskCountnumberWorkflow मधील tasks ची संख्या
classificationstringCompletion वर Session taint

Limits

LimitValueवर्णन
Sub-workflow max depth5run.workflow calls चे Maximum nesting
Run history default limit10workflow_history साठी Default limit

Execution Statuses

Statusवर्णन
pendingWorkflow created पण start नाही झाला
runningWorkflow currently executing आहे
completedसर्व tasks successfully finished (किंवा then: end)
failedTask fail झाला, raise hit झाला, किंवा ceiling breached
cancelledExecution externally cancelled झाले