# The .lassi-workflow.json file format

> What's inside a Ladoo workflow file: the steps, branches, fields and layout, what's left out on export, and how to export, edit and import one through the API.

Source: https://tryladoo.com/docs/developers/workflow-file-format · Updated 2026-11-21

A `.lassi-workflow.json` file holds one agent's [workflow](https://tryladoo.com/docs/workflows/overview): its steps, how they connect, the details it collects and where each step sits on the canvas. Use it to copy a workflow to another agent or workspace, keep workflows in version control, or build one in your own code.

In Ladoo, click **⋯** at the top of the workflow editor for **Export to file** and **Import from file**. Through the API:

- `GET /v1/agents/{id}/workflow/export` returns the file for the agent's live workflow, or its draft with `?from=draft` (`agents:read`).
- `POST /v1/agents/{id}/workflow/import` with the file as the body replaces the agent's draft (`agents:write`). It doesn't publish. Calls keep following the live workflow until you publish the draft with `POST /v1/agents/{id}/workflow/draft/publish`.
- `POST /v1/agents/{id}/workflow/validate` checks a graph without saving it.

## A whole file

A short workflow for Rivera Plumbing: find out why someone's calling, book a visit or take a message, and send emergencies straight to a message marked urgent.

```json
{
  "format": "lassi.workflow",
  "format_version": 1,
  "name": "Rivera Plumbing front desk",
  "description": "Books visits and takes messages. Emergencies are flagged urgent.",
  "graph": {
    "start": "greet",
    "nodes": [
      {
        "id": "greet",
        "type": "conversation",
        "name": "Find out why they're calling",
        "prompt": "Find out what the caller needs.",
        "edges": [
          { "to": "details", "when": { "intent": "wants a plumber to come out" } },
          { "to": "message", "when": { "else": true } }
        ]
      },
      {
        "id": "details",
        "type": "collect",
        "name": "Get the job details",
        "prompt": "Get the details for the visit.",
        "fields": ["service_address", "problem"],
        "then": "book"
      },
      {
        "id": "book",
        "type": "action",
        "name": "Book the visit",
        "action": "book_appointment",
        "prompt": "Offer two open times and book the one the caller picks.",
        "then": "goodbye",
        "on_error": "message"
      },
      {
        "id": "urgent",
        "type": "action",
        "name": "Flag the emergency",
        "action": "flag_urgent",
        "then": "message"
      },
      {
        "id": "message",
        "type": "action",
        "name": "Take a message",
        "action": "take_message",
        "prompt": "Take the caller's name and what they need.",
        "then": "goodbye"
      },
      { "id": "goodbye", "type": "end", "name": "Say goodbye", "message": "" }
    ],
    "global_edges": [
      { "to": "urgent", "when": { "intent": "describes a burst pipe, flooding or a gas smell" } }
    ]
  },
  "layout": {
    "nodes": {
      "greet": { "x": 0, "y": 0 },
      "details": { "x": -180, "y": 180 },
      "book": { "x": -180, "y": 360 },
      "urgent": { "x": 360, "y": 180 },
      "message": { "x": 180, "y": 360 },
      "goodbye": { "x": 0, "y": 540 }
    }
  },
  "fields": [
    {
      "key": "service_address",
      "label": "Service address",
      "type": "string",
      "description": "Street address where the work is needed.",
      "collect": "required",
      "options": [],
      "crm_field": null
    },
    {
      "key": "problem",
      "label": "Problem",
      "type": "string",
      "description": "What's wrong, in the caller's words.",
      "collect": "required",
      "options": [],
      "crm_field": null
    }
  ],
  "needs_setup": [],
  "exported_at": "2026-11-21T15:00:00.000Z"
}
```

## Top level

| Key              | Required | What it is                                                                                                                     |
| ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `format`         | Yes      | Always `"lassi.workflow"`.                                                                                                     |
| `format_version` | Yes      | Always `1` for now. A change that older files can't follow gets a new number.                                                  |
| `graph`          | Yes      | The steps and how they connect. See below.                                                                                     |
| `name`           | No       | A name for the workflow.                                                                                                       |
| `description`    | No       | A sentence about what it does.                                                                                                 |
| `layout`         | No       | Where each step sits on the canvas: `nodes` maps a step's `id` to `{ "x", "y" }`. Steps without a position are placed for you. |
| `fields`         | No       | The details the workflow collects. See [Fields](#fields).                                                                      |
| `needs_setup`    | No       | What an export left out and someone must fill in. See [What export leaves out](#what-export-leaves-out).                       |
| `exported_at`    | No       | When the file was exported.                                                                                                    |

## The graph

`graph` has three keys:

- `start`: the `id` of the step every call starts with.
- `nodes`: the steps.
- `global_edges`: branches that apply on every step, like "the caller describes an emergency". The caller can take one from wherever they are in the call.

Every step has an `id` (letters, numbers, dashes and underscores, unique in the file), a `type` and an optional `name` shown on the canvas.

### Where a step goes next

A step moves on in one of three ways:

- `then`: the step to go to when this one is done.
- `edges`: branches, each `{ "to": "<step id>", "when": { … } }`, with an optional `label`. The agent takes the first that matches.
- `on_error` or `fallback`: where to go when the step fails, like a booking that couldn't be made or a transfer nobody answered.

A branch's `when` is one of:

| `when`                                                                            | Matches when                                                                      |
| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| `{ "intent": "wants a plumber to come out" }`                                     | The caller's words fit the description. The agent decides.                        |
| `{ "else": true }`                                                                | No other branch matched. One per step, and not with `then`.                       |
| `{ "field": "is_homeowner", "equals": true }`                                     | A collected detail has this value.                                                |
| `{ "variable": "plan", "in": ["gold", "silver"] }`                                | A variable (a business setting or a value an earlier step saved) is one of these. |
| `{ "field": "email", "exists": true }`                                            | A detail was given (or, with `false`, wasn't).                                    |
| `{ "time_window": { "days": ["mon", "tue"], "start": "08:00", "end": "17:00" } }` | The call is in this window, in the business's time zone.                          |
| `{ "booking_hours": true }`                                                       | The call is during the booking hours in your calendar settings.                   |

`field` and `variable` checks take exactly one of `equals`, `in` or `exists`. Add `"not": true` to any of them except `intent` and `else` to flip it.

### Step types

| `type`         | What it does                                                                                                                                                          | Its own keys                                                                                        |
| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| `conversation` | A Talk step: the agent follows `prompt` until a branch or `then` applies.                                                                                             | `prompt`, `edges`, `then`                                                                           |
| `collect`      | Asks for the listed details.                                                                                                                                          | `prompt`, `fields` (field keys), `optional_fields`, `then`, `edges`                                 |
| `action`       | Runs a built-in action.                                                                                                                                               | `action`, `prompt`, `then`, `on_error`                                                              |
| `condition`    | Branches on details, variables or time, without saying anything.                                                                                                      | `edges`                                                                                             |
| `knowledge`    | Answers questions from knowledge bases.                                                                                                                               | `prompt`, `kb_ids`, `edges`, `then`                                                                 |
| `transfer`     | Puts the caller through to a team's on-call list or a number.                                                                                                         | `team_id` or `to` (E.164 or `{{variables.name}}`), `mode` (`cold` or `warm`), `message`, `fallback` |
| `code`         | Runs a [Custom Code step](https://tryladoo.com/docs/developers/webhook-and-code-steps#custom-code-steps).                                                                                    | `code`, `outputs`, `say`, `then`, `on_error`                                                        |
| `webhook`      | Calls your own system during the call. See [Webhook steps](https://tryladoo.com/docs/developers/webhook-and-code-steps#webhook-steps).                                                       | `method`, `url`, `headers`, `body`, `save`, `say`, `then`, `on_error`                               |
| CRM step       | Updates the caller's contact in the LeadConnector CRM connection: tags, a note, contact fields and a pipeline stage. Its `type` is a short code; keep it as exported. | `add_tags`, `note`, `contact_fields`, `pipeline_id`, `stage_id`, `stage_name`, `then`, `on_error`   |
| `end`          | Ends the call, saying `message` first if it has one.                                                                                                                  | `message`                                                                                           |

`action` is one of `book_appointment`, `take_message`, `flag_urgent` or `check_availability`. The action must be turned on for the agent.

## Fields

`fields` lists the details the workflow collects. A `collect` step names them by `key`, and later steps use them as `{{fields.<key>}}`.

| Key           | What it is                                                                                    |
| ------------- | --------------------------------------------------------------------------------------------- |
| `key`         | Lowercase letters, numbers and underscores, starting with a letter. Up to 64 characters.      |
| `label`       | The name people see, like "Service address".                                                  |
| `type`        | `string`, `number`, `boolean`, `date`, `phone`, `email` or `enum`.                            |
| `options`     | For `enum`: the allowed values.                                                               |
| `description` | A hint for the agent about what to ask for.                                                   |
| `collect`     | `required`, `optional`, or `extract_only` (picked up from the conversation, never asked for). |
| `crm_field`   | Where the detail is saved in your CRM, or `null`.                                             |

On import, a field the agent already has keeps the agent's own definition. New fields are added.

## What export leaves out

Some settings belong to one workspace, and some are secrets. Export blanks them and lists each one in `needs_setup`, so a file is safe to share:

| `kind`           | What was left out                                         |
| ---------------- | --------------------------------------------------------- |
| `phone_number`   | A transfer step's number or team.                         |
| `webhook_header` | A webhook step's header value, which is often an API key. |
| `knowledge_base` | Which knowledge bases a knowledge step answers from.      |
| `pipeline_stage` | A CRM step's pipeline and stage.                          |
| `crm_field`      | Where a field is saved in your CRM.                       |

A header that only refers to [workspace secrets](https://tryladoo.com/docs/developers/secrets), like `Bearer {{secrets.DISPATCH_API_KEY}}`, is kept as written, since the reference holds no secret. It's still listed under `webhook_header`, naming the secret the importing workspace needs.

Each entry has the step's `node_id` (or the field's `field_key`) and a `message` saying what to fill in, like "Choose who to transfer to." After an import, the workflow editor marks those steps, and the draft can't be published until they're filled in.

## Check a file before you import it

`POST /v1/agents/{id}/workflow/validate` with `{ "graph": { … }, "fields": [ … ] }` returns `valid` and `errors`, the problems Ladoo found, each with the step's `node_id`, a `code` and a `message`, like `missing_then` ("Choose what happens after this step.") or `unreachable` ("Nothing leads here."). An import of a file with problems still saves the draft, so you can fix them in the editor; publishing waits until there are none.

> **Tip:** Ladoo's own templates are workflow files too. Export one from a new agent to see a complete, working example.
