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
| Term | What it is |
|---|---|
| Workflow | A saved graph of steps. The API calls it a flow: its routes are under /v1/cosmos/flows. |
| Step type | One thing a step can do, such as tv.instant_clone (dub a video) or logic.approval (wait for a person). |
| Node | A step placed in a workflow: a step type with your own id and settings. |
| Gate | A logic.* step that controls the run instead of doing product work: Start, End, Delay, Approval, Switch, Parallel and Merge. Gates are free. |
| Run | One execution of a workflow with its own inputs. The API calls it an execution. |
| Run inputs | The 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:
{
"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
| Field | Required | What it holds |
|---|---|---|
id | Yes | Your id for the node, unique in the graph. Run inputs, run steps and the Approve and Reject routes refer to it. |
nodeTypeKey | Yes | A step type key from List step types. |
config | No | Values 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. |
inputBindings | No | Inputs read from an earlier step: { "<inputKey>": { "fromNodeId": "<node id>", "outputKey": "<output key>" } }. |
position | No | { "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:
kind | What it means | Handles |
|---|---|---|
control | Run order and branching. Join every step from Start to End with these. | sourceHandle: "__ctl_out" (or case:<caseKey> from a Switch), targetHandle: "__ctl_in" |
binding | A 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 |
share | Two 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.startand onelogic.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'sparentProcessId, must be wired from an output of the samedataType. - 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 type | What it does | Settings in config |
|---|---|---|
logic.start, logic.end | Where the run begins and ends. Exactly one of each. | None |
logic.delay | Waits before the next step. | durationSeconds: a number above 0 |
logic.approval | Waits until someone approves or rejects. The run is awaiting_action meanwhile. | label and instructions, shown to the reviewer |
logic.switch | Takes one branch, chosen by a value from an earlier step. | cases and defaultCase; wire the tested value into its value input |
logic.parallel | Runs two or more branches at the same time. | None; each control edge out of it is a branch |
logic.merge | Where 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>:
{
"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:
{
"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 type | What it does | Outputs |
|---|---|---|
tv.instant_clone | Dubs 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.subtitle | Subtitles a video in the language it is spoken in (sourceLanguage); no translation, no target language. | processId, subtitles (.srt text) |
tv.translate_subtitles | Translates 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.autofix | Fix 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.export | Renders 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:
{
"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>"] }: theidof a file sent with Upload files — a video for the dubbing and subtitling steps (optionally followed by theidof a script, a transcript or subtitle file used instead of transcribing it), a subtitle file for Translate Subtitle File. Other file inputs take a publichttps://link to the file. - Languages. Language fields take a language code such as
en-USorhi-IN. The Video Dubbing steps also take language keys such ashindi_india. - Translation memories. A
tmfield takes the ID of one of your translation memories. - Text. A
textinput, 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 status | Meaning |
|---|---|
running | Steps are running. |
awaiting_action | An Approval gate is waiting. Call Approve a step or Reject a step with its node id. |
completed | Every step on the path taken has finished. Read each step's output in Get a run. |
failed | A step failed. error and the step's own error say why. Retry a run continues from that step. |
cancelled | Cancelled 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.
stepOwnersnames 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
| Permission | Lets the API key |
|---|---|
cosmos:read | List step types, workflows and runs, and validate a graph. |
cosmos:create | Create workflows. |
cosmos:update | Update workflows. |
cosmos:delete | Delete workflows. |
cosmos:execute | Start, 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.