Build your first workflow
You can also describe your goal on the start page, review a plan, and generate an editable workflow. See Build workflows through conversation. Plan approval and execution confirmation are separate steps.
This tutorial extends the Agent from the quickstart with deterministic data preparation, structured output, conditional routing, and human review. You will build an explainable customer-feedback routing flow: low-priority feedback ends automatically; high-priority feedback waits for a person to decide.
Start → Normalize feedback (Process) → Classify and recommend (Agent) → Priority is high? ├─ Yes → Human Review ─┬─ Approved → End │ └─ Rejected → End └─ No ─────────────────→ EndBefore you begin, configure an API key for at least one Provider under Settings → Models. If you have not created a workflow or a feedback input yet, complete the quickstart first.
1. Write the state contract first
Section titled “1. Write the state contract first”Do not make downstream nodes infer an answer from free text. First agree on what every step reads and produces. These keys appear in the App schema, Agent output, branch conditions, and review UI.
| Producer | Reads | Writes and publishes to global state | Consumers |
|---|---|---|---|
| Run input | — | feedback (Label: Customer feedback) |
Process |
| Normalize feedback (Process) | feedback |
normalized_feedback (Label: Normalized feedback) |
Agent, Human Review |
| Classify and recommend (Agent) | normalized_feedback |
category (Feedback category), priority (Priority), recommendation (Recommended action) |
If/Else, Human Review |
| Human Review | recommendation and context |
Review decision | Approved or rejected output |
Run inputs are already global state. Output from a node stays in that node’s private namespace unless you list it under Publish to global state → Published output keys. Published keys can be used by branches, later nodes, and workflow output. This example uses global keys, so it does not need Allowed readers; use that setting only when intentionally sharing a node’s private namespace.
2. Create the normalization Process App
Section titled “2. Create the normalization Process App”Go to Apps → New and create an App / Process Node named, for example, “Normalize feedback.” Declare this data contract:
| Direction | Label | Key | Type | Required |
|---|---|---|---|---|
| Input | Customer feedback | feedback |
string | Yes |
| Output | Normalized feedback | normalized_feedback |
string | Yes |
Replace the entry-point code with this minimal implementation. It collapses excess whitespace so later nodes always receive the same clean text:
import jsonimport sys
from workrun_sdk import process
def main() -> None: state = json.loads(sys.stdin.read() or "{}") feedback = " ".join(str(state.get("feedback", "")).split()) process.result({"normalized_feedback": feedback})
if __name__ == "__main__": main()Save the App and install its dependencies. This example reads feedback from workflow stdin; test it through the workflow in step 5 so it receives a non-empty input. An independent App run does not supply workflow input. For project setup, dependencies, and debugging, see Use Python Apps.
3. Build and configure the canvas
Section titled “3. Build and configure the canvas”Continue with the Task workflow from the quickstart, keeping its feedback run input, Start, Agent, and End. Add Process, If/Else, and Human Review, then reconnect the nodes as shown above. If you create a new workflow instead, it starts with only Start: add the other nodes and define a required multiline-text feedback field under More settings → Run inputs. Select Process and choose “Normalize feedback” under App connection.
Under Publish to global state → Published output keys on Process, enter:
normalized_feedbackSelect the Agent, choose a model from a configured Provider, and paste this schema into Structured output schema (Advanced). It turns the classification into stable fields rather than a prose-only reply:
{ "type": "object", "properties": { "category": { "type": "string", "description": "Feedback category" }, "priority": { "type": "string", "description": "Priority", "enum": ["low", "medium", "high"] }, "recommendation": { "type": "string", "description": "Recommended action" } }, "required": ["category", "priority", "recommendation"]}Use clear, testable instructions such as:
You are a customer-feedback routing assistant. Read normalized_feedback and return category, priority, and recommendation.
Set priority to high for account security, fraud, data exposure, payment anomalies, or when a customer cannot use a core function.When information is insufficient, say what is missing. Do not invent facts.On that Agent, enter the following Published output keys:
category, priority, recommendation4. Route on a stable field and configure review
Section titled “4. Route on a stable field and configure review”Select If/Else and set a condition for each output:
| Output | Condition |
|---|---|
| Yes | priority == "high" |
| No | priority != "high" |
A condition compares one state field at a time. Do not use || or &&, and do not match words in the natural-language recommendation. The schema limits priority to known values, so these two conditions cover every valid result.
Connect “yes” to Human Review and “no” to End. In Human Review’s Review request:
- Enter a direct title and explanation, such as “Confirm the high-priority feedback recommendation.”
- Set the content key to
recommendation. - Set context keys to
category, priority, normalized_feedback. - Turn on Allow editing when the reviewer should be able to revise the recommendation.
- For this tutorial, connect both approved and rejected outputs to End.
This means that human review is complete and the run ends regardless of the decision; the decision remains in run history. Only route rejection to another node when it needs follow-up, such as requesting more information, rewriting the recommendation, or notifying someone. Route approval to the node that performs the real side effect. For pause, editing, and checkpoint recovery details, see Human approval and recovery.
5. Run three examples and inspect every layer
Section titled “5. Run three examples and inspect every layer”Save the workflow, select Run, and inspect node status and global state in the run panel for each example.
| Input | What you should see |
|---|---|
There is a typo in the page copy. |
Process publishes normalized_feedback; the Agent returns low or medium; the flow takes “no” to End. |
There is an unfamiliar payment on my account. Freeze it immediately. |
The Agent returns high; the flow pauses at Human Review; approve or reject to resume from the checkpoint without rerunning earlier nodes. |
It does not work. Please fix it. |
The Agent identifies missing information while still returning complete category, priority, and recommendation fields. |

High-priority feedback displays a review card in the node output. Inspect the completed Process and Agent outputs before approving or rejecting, or return to this run later from the Run Center.


If a run differs, inspect in this order: the App’s stdout/stderr and normalized_feedback; the Agent’s model and schema; whether both producing nodes published their required keys; then the If/Else conditions and outgoing edges. Keep these three inputs as your first evaluation cases.
You can also revise a saved workflow through conversation. After saving an update, select View changes in the conversation to compare fields and the graph. See Revise the workflow and review its changes.
Share or delete a saved Workflow
Section titled “Share or delete a saved Workflow”In personal mode, save your changes, then open the More (⋯) menu in the Workflow detail page and choose Export. Select ZIP or TAR and review the package. It bundles the main definition, referenced Process Apps, Agent and CodeAct Tool Apps, and recursively referenced child Workflows. Repeated dependencies are included once. Missing dependencies and child-Workflow cycles prevent export.

To share just one App, choose Export App on its detail page to package its saved settings and source separately. The export dialog lists source files so you can deselect files you do not need to share. Files marked Required remain included.

Choose Import from the Workflow list to open a package. Review the dependencies, choose a name, and bind the external configuration available on your device. Import creates fresh IDs for the Workflow, child Workflows, and Apps, and updates their references; it does not overwrite existing objects.
Models, MCP tools, Skills, remote credentials, mounted host paths, environment values, and private URLs may require local configuration. Skill source and MCP server configuration are not bundled. Credentials, host paths, and environment values are removed from the exported definition. Review prompts and App source yourself for embedded private data.
You can leave configuration pending and reopen Configure imported dependencies in the editor later. Pending items survive closing the editor and block execution until resolved. Use the separate dependency-installation action for bundled Apps before running. Run history, chat sessions, and schedules are not imported.
To delete a Workflow, use More (⋯) → Delete in its detail page and confirm. Personal mode removes the local definition. In Team mode, only the author sees this action, and deletion removes the Workflow from the team catalog, including its published version. Associated Apps, child Workflows, and historical run records are retained. Deletion is not offered on list cards.