> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lokutor.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Workflows

> Draw how a call goes: sub-agents with their own instructions, model, voice and tools, conditions, API calls, transfers to a person and endings, connected by lines that say when to move on

An agent can answer a whole call with one set of instructions. When a conversation has clearly different parts (bookings and billing, a check that decides what happens next, a hand-over to a person), draw it as a **workflow**: steps connected by lines.

Open the agent in the dashboard → **Workflow**. Start from a template, or describe the call to the **Assistant** and let it draw one. Drag steps in from the bar, drag from the dot under a step to connect it, and click a step or a line to set it up. **Publish** makes it live; **Settings → Versions → History** has the published ones.

## Steps

| Step | What it does |
| :- | :- |
| **Sub-agent** | Talks. Its own instructions (on top of the agent's, or alone), language model, voice, tools, and the details it must find out. It can also be another of your agents. |
| **Say** | One fixed line. |
| **Call a tool** | Calls one of the agent's tools without asking the model, and keeps the answer. |
| **Condition** | Splits by what is known: the first rule that holds is followed, "otherwise" takes the rest. |
| **Transfer to a person** | Rings the people you name ([how transfers work](https://docs.lokutor.com/guides/call-transfer.md)). Phone calls only. |
| **End call** | Says goodbye, in its own words or yours, and hangs up. |

A sub-agent, a transfer or an ending can be **reachable from anywhere**: any step can jump to it when its condition happens ("they ask for a person").

A sub-agent can also have **[dictation](https://docs.lokutor.com/guides/call-settings.md#dictation)**, for the step where somebody gives an e-mail or a number, and **end the call** once it has spoken, with one short goodbye.

### Details

Each detail a sub-agent finds out can say what it is:

| What it is | Checked as it is kept | Settings |
| :- | :- | :- |
| Text | No | |
| E-mail | That it is an address and its domain exists. The agent is told how to read it back, as it would be dictated | Letters that make it spell the address out (`hw`) |
| Phone number | That it is one | |
| Day and hour | That it is both, and ahead | Office hours only; how many days ahead at most |

A detail that is wrong is put right while the caller is still there.

## Lines

* Out of a **sub-agent**: in plain words, when to move on ("the caller wants to change a booking"). The model in that step decides. Or a **rule** on the details it has found out.
* Out of **Start** and **Condition**: rules on variables, tried in order, and one line for everything else. A start with rules sends calls to different steps by the number they called, the hour, or who is calling.
* Out of **Call a tool**: one for when it worked, one for when it failed.
* Out of **Transfer**: what to do when nobody answers. Without one, the agent takes a message.

Moving on costs no extra time until it happens: on every other turn, nothing is asked of any model beyond the reply. The caller hears the same person throughout (or another voice, if you set one).

## Followed by a second model

In the **Start** step, **Followed by a second model** gives the workflow to a request of its own: at each of the caller's turns it decides which line applies and keeps the details, and the model that talks only talks. Use it for long scripts, where one model holding the conversation, the steps and the details misses some of them. Details can then be **read back before going on**: the call does not leave the step until the agent has said it and the caller agreed.

It is one small request more a turn (about 1,400 input tokens), at the default rate. It is not available on an agent with [your own model](https://docs.lokutor.com/guides/bring-your-own-llm.md).

## Variables

Use `{{name}}` in any step's text, tool value or rule.

| Variable | What it holds |
| :- | :- |
| `caller_number`, `caller_country` | Who is on the line (phone calls). |
| `called_number`, `number_label`, `number_pool` | Which of your numbers was called. |
| `direction` | `inbound`, `outbound` or `web`. |
| `call_context` | The notes sent with a call you placed. |
| `date`, `time`, `weekday` | When the call began, in the agent's time zone. |
| Every **[data of the call](https://docs.lokutor.com/guides/call-settings.md#data-of-each-call)** | By its own name. |
| Every **detail** a sub-agent finds out | By its own name. A required detail is asked for before moving on, unless the caller changes the subject or will not give it. |
| The answer of every **Call a tool** step | By the name you give it; `customer.name` is the `name` field of its JSON. |

Every conversation keeps the **path** it took, with the time and reason of each move, and the details collected: open it under **Conversations**.

## Models

Each step can have its own language model. See [Language models](https://docs.lokutor.com/guides/language-models.md).

## Config

The dashboard writes the workflow in the agent's config as `flow`, and the [Agents API](https://docs.lokutor.com/api-reference/agents.md#post-/v1/agents) takes it as a setting: `{ "enabled", "directed", "nodes": [{ "id", "type", "x", "y", "data" }], "edges": [{ "id", "from", "to", "kind", "condition" | "rules" }] }`. Up to 80 steps and 240 lines. The API refuses a workflow that cannot run (no start, no sub-agent, an unknown step); one that is in a config anyway is not run, and the agent answers with its instructions alone.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.