Workflows

Chain dubbing, translation, quality checks, exports and approvals into one workflow, then run it with one call.

A workflow chains steps from different Acclaro API products into one automated run: for example, dub a video, wait for someone to approve it, then export it. You save the workflow once as a graph of steps, then start a run with each new set of inputs. Every run works in the background and reports the status of each step.

Pick the steps

Call List step types. Each entry in nodeTypes is a step you can place: its key, the inputs it takes (inputSchema), the outputs it gives (outputSchema), the permission it needs (requires) and whether it charges credits (flags.charges).

Build and check the graph

Write the graph: the steps (nodes) and the connections between them (edges), from a Start node to an End node. Send it to Validate a workflow to get every problem at once.

Save it

Call Create a workflow. A workflow with at least one real step is published straight away. The response's inputSchema lists what each run will ask for.

Start a run

Call Start a run with a value for each inputSchema entry in input. You get an executionId straight away.

Track it

Poll Get a run until status is completed, failed or cancelled. Every 10 to 30 seconds is enough. When it is awaiting_action, an Approval gate is waiting: approve or reject it. A run started by a project batch can be held by its task's checklist: approving answers 409 until the checklist is done (see Step checklists).

Key ideas

TermWhat it is
WorkflowA saved graph of steps. The API calls it a flow: its routes are under /v1/cosmos/flows.
Step typeOne thing a step can do, such as tv.instant_clone (dub a video) or logic.approval (wait for a person).
NodeA step placed in a workflow: a step type with your own id and settings.
GateA logic.* step that controls the run instead of doing product work: Start, End, Delay, Approval, Switch, Parallel and Merge. Gates are free.
RunOne execution of a workflow with its own inputs. The API calls it an execution.
Run inputsThe values a run asks for: every step input that is neither set when you save nor wired from an earlier step.

The graph

A graph is { "nodes": [...], "edges": [...] }. This one dubs a video into Hindi, waits for a review, then exports the dubbed video with subtitles:

graph
{
  "nodes": [
    { "id": "start", "nodeTypeKey": "logic.start" },
    {
      "id": "dub",
      "nodeTypeKey": "tv.instant_clone",
      "config": { "sourceLanguage": "en-US", "targetLanguage": "hi-IN", "speakerCount": "2" }
    },
    {
      "id": "review",
      "nodeTypeKey": "logic.approval",
      "config": { "label": "Review the Hindi dub", "instructions": "Check names and numbers in the editor." }
    },
    {
      "id": "export",
      "nodeTypeKey": "tv.export",
      "config": { "targetLanguage": "hi-IN", "withSubtitles": true },
      "inputBindings": { "parentProcessId": { "fromNodeId": "dub", "outputKey": "processId" } }
    },
    { "id": "end", "nodeTypeKey": "logic.end" }
  ],
  "edges": [
    { "source": "start", "target": "dub", "sourceHandle": "__ctl_out", "targetHandle": "__ctl_in", "kind": "control" },
    { "source": "dub", "target": "review", "sourceHandle": "__ctl_out", "targetHandle": "__ctl_in", "kind": "control" },
    { "source": "review", "target": "export", "sourceHandle": "__ctl_out", "targetHandle": "__ctl_in", "kind": "control" },
    { "source": "export", "target": "end", "sourceHandle": "__ctl_out", "targetHandle": "__ctl_in", "kind": "control" },
    { "source": "dub", "target": "export", "sourceHandle": "processId", "targetHandle": "parentProcessId", "kind": "binding" }
  ]
}

Nodes

FieldRequiredWhat it holds
idYesYour id for the node, unique in the graph. Run inputs, run steps and the Approve and Reject routes refer to it.
nodeTypeKeyYesA step type key from List step types.
configNoValues fixed when you save, keyed by input field key. A field set here is not asked for at run time. Gates keep their settings here.
inputBindingsNoInputs read from an earlier step: { "<inputKey>": { "fromNodeId": "<node id>", "outputKey": "<output key>" } }.
positionNo{ "x", "y" } on the canvas, used only by the Universe app.

Edges

Every edge has a source and a target node id, and a kind:

kindWhat it meansHandles
controlRun order and branching. Join every step from Start to End with these.sourceHandle: "__ctl_out" (or case:<caseKey> from a Switch), targetHandle: "__ctl_in"
bindingA value passed from an output to an input. Set the same wire in the target's inputBindings: the run reads inputBindings, the edge draws it. The two ports' dataTypes must match.sourceHandle: the output key, targetHandle: the input key
shareTwo inputs of the same type that take one value, so a run asks for it once.sourceHandle and targetHandle: the two input keys

An edge without kind is a binding. A step that has a control edge out of it runs in that order; its binding edges only carry values.

Save rules

Create a workflow and Update a workflow refuse a graph that breaks a rule, with 400 and the first problem. Validate a workflow returns all of them. Once a graph has a real step:

  • It has exactly one logic.start and one logic.end. Nothing goes into Start and nothing comes out of End. Start connects to one step, and one step connects to End.
  • Every node is connected; there are no loops.
  • Each required input is set in config, wired, or left for the run. An input that carries an id from an earlier step, such as the Export's parentProcessId, must be wired from an output of the same dataType.
  • Only a Switch or a Parallel may have more than one next step, and their branches meet again in one Merge before End.

Gates

Step typeWhat it doesSettings in config
logic.start, logic.endWhere the run begins and ends. Exactly one of each.None
logic.delayWaits before the next step.durationSeconds: a number above 0
logic.approvalWaits until someone approves or rejects. The run is awaiting_action meanwhile.label and instructions, shown to the reviewer
logic.switchTakes one branch, chosen by a value from an earlier step.cases and defaultCase; wire the tested value into its value input
logic.parallelRuns two or more branches at the same time.None; each control edge out of it is a branch
logic.mergeWhere the branches of a Switch or Parallel meet again.None

Branch with a Switch

A Switch tests the value wired into its value input, usually a Quality Control verdict or overallScore. Each case is { "key", "label", "operator", "value" }; the first case that matches wins, and defaultCase is taken when none does. operator is eq or ne (text, ignoring case) or gt, lt, gte, lte (numbers). Each case continues along the control edge whose sourceHandle is case:<key>:

Send a flagged video for review
{
  "nodes": [
    { "id": "start", "nodeTypeKey": "logic.start" },
    { "id": "qc", "nodeTypeKey": "qc.evaluate", "config": { "modality": "video", "regionIds": ["0f1e2d3c-4b5a-4968-8776-655443322110"] } },
    {
      "id": "route",
      "nodeTypeKey": "logic.switch",
      "config": {
        "cases": [
          { "key": "pass", "label": "Approved", "operator": "eq", "value": "APPROVED" },
          { "key": "check", "label": "Needs a look", "operator": "ne", "value": "APPROVED" }
        ],
        "defaultCase": "check"
      },
      "inputBindings": { "value": { "fromNodeId": "qc", "outputKey": "verdict" } }
    },
    { "id": "review", "nodeTypeKey": "logic.approval", "config": { "label": "QC flagged this video" } },
    { "id": "join", "nodeTypeKey": "logic.merge" },
    { "id": "end", "nodeTypeKey": "logic.end" }
  ],
  "edges": [
    { "source": "start", "target": "qc", "sourceHandle": "__ctl_out", "targetHandle": "__ctl_in", "kind": "control" },
    { "source": "qc", "target": "route", "sourceHandle": "verdict", "targetHandle": "value", "kind": "binding" },
    { "source": "route", "target": "join", "sourceHandle": "case:pass", "targetHandle": "__ctl_in", "kind": "control" },
    { "source": "route", "target": "review", "sourceHandle": "case:check", "targetHandle": "__ctl_in", "kind": "control" },
    { "source": "review", "target": "join", "sourceHandle": "__ctl_out", "targetHandle": "__ctl_in", "kind": "control" },
    { "source": "join", "target": "end", "sourceHandle": "__ctl_out", "targetHandle": "__ctl_in", "kind": "control" }
  ]
}

The Switch runs straight after the step it tests: its binding from that step is also its way in.

Run branches in parallel

Give a Parallel two or more control edges out, one per branch, and bring the branches back together in a Merge. A share edge between the two translations' source inputs means the run asks for the document once:

Translate one document into French and German at the same time
{
  "nodes": [
    { "id": "start", "nodeTypeKey": "logic.start" },
    { "id": "fanout", "nodeTypeKey": "logic.parallel" },
    { "id": "translate-fr", "nodeTypeKey": "playground.translate_docx", "config": { "sourceLanguage": "en-US", "targetLanguage": "fr-FR" } },
    { "id": "translate-de", "nodeTypeKey": "playground.translate_docx", "config": { "sourceLanguage": "en-US", "targetLanguage": "de-DE" } },
    { "id": "join", "nodeTypeKey": "logic.merge" },
    { "id": "end", "nodeTypeKey": "logic.end" }
  ],
  "edges": [
    { "source": "start", "target": "fanout", "sourceHandle": "__ctl_out", "targetHandle": "__ctl_in", "kind": "control" },
    { "source": "fanout", "target": "translate-fr", "sourceHandle": "__ctl_out", "targetHandle": "__ctl_in", "kind": "control" },
    { "source": "fanout", "target": "translate-de", "sourceHandle": "__ctl_out", "targetHandle": "__ctl_in", "kind": "control" },
    { "source": "translate-fr", "target": "join", "sourceHandle": "__ctl_out", "targetHandle": "__ctl_in", "kind": "control" },
    { "source": "translate-de", "target": "join", "sourceHandle": "__ctl_out", "targetHandle": "__ctl_in", "kind": "control" },
    { "source": "join", "target": "end", "sourceHandle": "__ctl_out", "targetHandle": "__ctl_in", "kind": "control" },
    { "source": "translate-fr", "target": "translate-de", "sourceHandle": "source", "targetHandle": "source", "kind": "share" }
  ]
}

Its runs ask for share__translate_de__source (the document, once) and a translation memory for each language, translate_fr__tmId and translate_de__tmId.

Video Dubbing steps

Step typeWhat it doesOutputs
tv.instant_cloneDubs a video into one language, re-voicing each speaker. voicePolicy decides the voices: ask (default) waits for someone to approve them, clone_all clones every speaker's own voice without asking (it still asks when it finds more than 4 speakers), catalog_auto uses stock voices. Clone only voices you have consent to use.processId
tv.subtitleSubtitles a video in the language it is spoken in (sourceLanguage); no translation, no target language.processId, subtitles (.srt text)
tv.translate_subtitlesTranslates a subtitle file (.srt, .vtt, .ass or .ssa) into one targetLanguage, keeping each cue's timing. Upload the file as subtitleFile, or wire .srt text into subtitleText, for example from tv.subtitle's subtitles.processId, subtitles (.srt text)
tv.autofixFix Dub Issues: fixes the lines of one dubbed language that are too fast, too slow or out of time, and saves them back into the dub. Wire parentProcessId from a dub. Free.processId (the dub)
tv.exportRenders a dub or a subtitled video as a file. exportMode: video (default) for the dubbed video, optionally with withSubtitles; original_subtitled for the original video with the targetLanguage subtitles burned in (the only mode for a tv.subtitle run); audio for the dubbed audio alone.deliverable (video), audio (.wav, when one was rendered), processId

Every step but Export and Fix Dub Issues needs a translation memory (tmId). Run steps that work on the same dub one after another: a Fix Dub Issues step refuses to start while another step of the same dub, such as an export, is still running.

Run inputs

After a save, the workflow's inputSchema lists what a run asks for, in the order the steps run. Pass each value in input under the entry's key: <nodeId>__<fieldKey> (characters other than letters, digits and _ in the node id become _), or the share__… key of a shared input. For the dubbing graph above:

POST /v1/cosmos/flows/{id}/run
{
  "name": "Product launch — Hindi",
  "input": {
    "dub__source": { "uploadIds": ["5e6f7a8b-9c0d-4e1f-a2b3-c4d5e6f7a8b9"] },
    "dub__tmId": "8c7b6a5d-4e3f-4a2b-9c1d-0e9f8a7b6c5d"
  },
  "stepOwners": { "review": ["2b4d6f8a-1c3e-4a5b-8c7d-9e0f1a2b3c4d"] }
}
  • Files. The Video Dubbing steps take { "uploadIds": ["<id>"] }: the id of a file sent with Upload files — a video for the dubbing and subtitling steps (optionally followed by the id of a script, a transcript or subtitle file used instead of transcribing it), a subtitle file for Translate Subtitle File. Other file inputs take a public https:// link to the file.
  • Languages. Language fields take a language code such as en-US or hi-IN. The Video Dubbing steps also take language keys such as hindi_india.
  • Translation memories. A tm field takes the ID of one of your translation memories.
  • Text. A text input, such as the text of Text Translation or Text to Speech, takes a string.

Steps check their inputs when they start, so a missing or wrong value fails that step, not the start call.

Runs

Run statusMeaning
runningSteps are running.
awaiting_actionAn Approval gate is waiting. Call Approve a step or Reject a step with its node id.
completedEvery step on the path taken has finished. Read each step's output in Get a run.
failedA step failed. error and the step's own error say why. Retry a run continues from that step.
cancelledCancelled in the Universe app, or stopped by a rejected Approval.

In Get a run, each entry of nodes has its own status: pending, running, awaiting_action, succeeded, failed, skipped (a branch the run did not take) or cancelled. output holds its results once it has succeeded, and navigation points to the work it created; for a dubbing step, navigation.processId is the Video Dubbing job ID.

A dubbing step whose voicePolicy is ask (the default) waits for its speakers' voices to be approved: the step is awaiting_action while the run stays running. Approve them with Approve speaker voices, using the step's navigation.processId as the job ID.

  • Retry. Retry a run keeps the steps that succeeded and runs the failed step and the rest again, under the same executionId.
  • Cancel. Cancel a run in the Universe app; it stops the run and the job its current step is running.
  • Edit safely. A run keeps the graph and version it started with, so you can update a workflow while it runs.
  • Owners. stepOwners names the members responsible for a product step or an Approval gate. They get a notification in the Universe app when their step finishes or is waiting for them. Change them later with Set step owners.

Credits

Saving a workflow is free, and so are gates. Each product step is charged when it starts, at the rate of the product that does the work, on its real input; the rates are listed on Start a run, and your organization may have its own. To start, your balance must cover at least 1 credit for each charging step, or the call returns 402 and nothing starts.

If a run fails on our side, the steps that did not finish are refunded. If you cancel it or reject an Approval, what was charged so far is kept, and the steps that never started cost nothing. A retry charges only the steps that run again. See Credits.

Permissions

PermissionLets the API key
cosmos:readList step types, workflows and runs, and validate a graph.
cosmos:createCreate workflows.
cosmos:updateUpdate workflows.
cosmos:deleteDelete workflows.
cosmos:executeStart, retry, cancel, rename and file runs, set step owners, and approve or reject steps.

Each product step also needs its product's permission, listed in its requires: for example translate_video.process_log:create for a dubbing step. It is checked when you save a workflow that adds the step, when a run starts or is retried, and again just before the step runs. The key acts with the role of the member who created it.

On this page