Build Your First Workflow
A workflow is the directed acyclic graph (DAG) of typed nodes that defines what an AI Employee (AIE) does. This guide walks through building one end to end in the AI Employee builder — defining the inputs it accepts, adding an agent that does the work, wiring the nodes together, passing data between them, testing, and publishing.
By the end you'll have a working single-agent workflow you can run, plus the patterns you need to grow it into something larger.
Prerequisites. You need a builder role (builder, builder admin, system admin, or env admin) to create and edit workflows. If you can't see the workflows or AI Employees area, ask your administrator for access.
What you're building
A workflow always starts from a Start node and is made of:
- Start — declares the workflow's input fields and (optionally) a schedule.
- Agent nodes — the reasoning steps. Each is one of the configurable agent types.
- Transform nodes — optional deterministic reshapes that don't call an LLM.
- Publish nodes — declare the output fields the workflow exposes.
- End — terminates a branch.
Nodes are joined by edges. Data flows along edges, and each agent declares an input mapping that pulls specific fields from the Start node or from upstream agents using {{...}} references.
For this guide, build a "Ticket triage" workflow: it accepts a support message, classifies its urgency, and writes a short summary.
Step 1 — create the workflow
- Open the AI Employees area and create a new AI Employee (or open the workflows list and create a new workflow). A new workflow opens in the AI Employee builder with a Start node and an End node already placed.
- Give it a name. The name is editable later and is snapshotted onto every run.
The AI Employee builder has an editing surface in the center, an agent library on the left, and a configuration panel that slides in from the right when you select a node.
Step 2 — define the inputs on the Start node
The Start node defines the input schema — the typed fields your workflow accepts at run time.
- Select the Start node to open the Configure Start Node panel.
- Under Input Schema, choose Add Field.
- For each field, set:
- Key — the machine name you'll reference later (for example,
message). Keys must be unique; a duplicate key is flagged inline and blocks saving. - Type — one of Text (
string), Number, Integer, Boolean, or File. - Display Title — the human-readable label shown on run forms (for example, "Customer message").
- Required — whether a run must supply the field.
- Key — the machine name you'll reference later (for example,
- Choose Save Schema.
For the triage workflow, add one required Text field with key message and title "Customer message".
The Start node is also where you set a schedule so the workflow runs automatically on a recurring cron expression. Scheduling requires a published version, because scheduled runs always execute the latest published version. See Core concepts for how versioning works.
Step 3 — add an agent
Agents are the reasoning nodes. Ema ships a library of agents built on a small set of base types — including intent classification, search and respond, extraction, rule validation, and a general-purpose custom agent.
- In the agent library on the left, find the agent you want. For triage, start with Intent classifier (base type
intent_classification) to label urgency. - Add it to the workflow. A new agent node appears with a generated id such as
agent_1. - Select the node to open its configuration panel on the right.
The panel's exact fields depend on the agent type. Common fields include:
- Instructions — what you want the agent to do, in plain language. See Writing effective Instructions.
- Input mapping — which upstream values the agent receives (next step).
- Type-specific configuration — for an intent classifier, the intents (labels) it can return; for an extraction agent, the output schema; for a rule validator, the rules.
- Advanced settings — system prompt, model configuration, execution limits, Knowledge base, Tools, and human-in-the-loop.
Step 4 — connect the nodes
Edges define the order of execution and the conditions under which a branch runs.
- Drag from the Start node's output handle to the agent's input handle.
- Drag from the agent to the End node (or to a Publish node — see step 6).
The builder blocks invalid connections as you drag: self-loops, duplicate edges, cycles, edges into the Start node, and edges out of the End or Publish nodes are all rejected, and invalid targets are dimmed.
Conditional edges
To branch on a value, give an edge a condition. Select an edge to open its condition editor. A condition compares a resolved field with an operator and a value — for example, route to an "escalate" branch when output.urgency equals high. Edge conditions reference the source node's output under the output.* namespace.
Conditions come in three shapes:
- Field — compare one resolved field value against an operator (equals, greater than, contains, exists, and more).
- Fixed — a constant boolean; this is the default unconditional edge.
- Group — combine several conditions with
all(AND) orany(OR).
When an agent's branching is driven by an intent classifier, dragging from a per-intent handle automatically stamps the matching output.intent condition onto the new edge.
Step 5 — map the agent's inputs
An agent only sees the data you map into it. The input mapping editor (in the agent panel) builds {{...}} references for you.
- In the agent panel, find Input mapping and choose Add.
- Set the Input name — the key the agent reads (for example,
instructions). - Pick the Source node:
- Workflow inputs — a field from the Start node.
- An upstream agent — a field from that agent's output.
- Pick the Source field. For an upstream agent you can also choose All to pass its whole output.
Each completed row is serialized to a template reference:
- A Start-node field becomes
{{workflow_input.<field>}}. - An upstream agent's field becomes
{{<node_id>.output.<field>}}. - An upstream agent's whole output becomes
{{<node_id>.output}}.
For triage, map the classifier's instructions input to the workflow input message → the editor writes {{workflow_input.message}}.
Some keys are reserved because the agent panel sources them from a dedicated control. For example, an agent that has an Instructions textarea reserves the instructions mapping key — a mapping row using a reserved key is flagged and is not saved, because it would silently shadow the panel's value at run time. If you set the Instructions field, you don't also need an instructions mapping row.
Mark a row Optional if the agent should still run when the source value is missing. By default a mapped input is required.
Step 6 — declare outputs with a Publish node (optional)
A Publish node declares the fields your workflow exposes as its public output. Dashboard columns and CSV export are derived from publish-node output fields, so add one if you're building a dashboard AI Employee or want a stable output contract.
- Add a Publish node from the agent library.
- Connect your agent to it.
- In the publish-node panel, define the output fields and connect each upstream value to the field it should populate.
A workflow with zero publish nodes simply exposes no output columns — that's a valid choice for chat-style workflows where the response goes straight back to the user.
Step 7 — save, test, and publish
The builder distinguishes three states:
- Save writes the current DAG as a draft version. Every save with a changed DAG creates an immutable draft version (not yet live). The structure is validated on every save — size limits, required fields, unique node ids, valid edge references, and cycle detection — so errors surface immediately.
- Test runs the workflow against your draft so you can confirm behavior before publishing. Use it to iterate quickly.
- Publish validates the workflow again, captures its configuration, and promotes the version to live. Real runs (API, schedule, and channels) execute the active published version.
To test:
- Choose Save to persist your draft (the Publish button is disabled while you have unsaved changes).
- Choose Test and provide values for the input fields you defined. The run streams its progress back to you step by step.
To publish, choose Publish and confirm. Publishing is blocked if validation fails — for example, a missing LLM provider, an invalid human-in-the-loop assignee, or a structurally invalid graph.
Draft vs. live. Saving never changes what's live. Only publishing promotes a version. The builder shows whether your current draft is live (the active version equals the latest) or whether you have unpublished changes (active version is behind the latest).
How a run executes
When the workflow runs, the engine:
- Topologically sorts the DAG and runs nodes in dependency order, executing independent branches in parallel.
- Resolves each agent's input mapping by substituting
{{...}}references with concrete values from the Start input and upstream outputs. - Calls each agent, evaluating outgoing edge conditions to decide which branches continue.
- Records a per-step trace — inputs, outputs, status, and token usage — that you can inspect in the run history.
A failed step fails the run (there are no automatic step retries). If an agent pauses for human input, the run pauses and resumes once the person responds — see Designing human-in-the-loop forms.
Reference
| Node type | id prefix | Purpose |
|---|---|---|
start | — | Defines the input schema and optional schedule. One per workflow. |
agent | agent_ | A reasoning step configured from an agent type. |
transform | transform_ | Deterministic, non-LLM field reshaping (no LLM billing, no HITL). |
publish | publish_ | Declares exposed output fields for dashboards and CSV export. |
end | — | Terminates a branch. |
| Mapping form | Wire reference | Meaning |
|---|---|---|
| Workflow input field | {{workflow_input.message}} | A field from the Start node. |
| Upstream field | {{agent_1.output.urgency}} | A top-level field from an upstream agent's output. |
| Upstream "All" | {{agent_1.output}} | The whole output of an upstream agent. |
Workflows have built-in limits to bound execution: a maximum of 50 nodes and 200 edges, enforced at both save and publish. If you hit them, split the work across multiple AI Employees.
What's next
- Writing effective Instructions — make each agent reliable.
- Setting up a knowledge base — give agents searched context.
- Designing human-in-the-loop forms — pause for human input mid-run.
- Autopilot — build and edit workflows by describing what you want.