Developer reference
What a flow may contain, what the engine exports, what a package and a collection are on disk, and what an agent tells a board — each rendered from the file the code is held to.
Every reference document on this site is rendered from the single file the product's own tests hold, not retyped for the web. So there is no second description of a node type here to drift out of agreement with the first one. This page says what each document answers and which to open; the documents themselves are the reference.
The only content below is the version matrix, and that is derived from the compiler's own constants at build time for the same reason.
The reference documents#
- The DSL reference — Every node type, channel, edge and requirement a flow may declare, version by version.
rendered fromLGFlow/docs/reference/dsl-reference.md - The API reference — The programmatic surface: what each module exports and what it throws.
rendered fromLGFlow/docs/reference/api.md - The solution package format — What a solution package may contain, and the four gates into the library.
rendered fromLGFlow/docs/reference/package-reference.md - The collection format — What a knowledge collection is on disk — the contract between whatever builds an index and whatever answers from it.
rendered fromLGFlow/docs/reference/collection-format.md - The monitoring protocol — What an agent tells the board, and what the board may tell an agent.
rendered fromLGStudioMonitor/docs/protocol.md
Which document answers which question#
| What you need | Where it is |
|---|---|
| Every node type, and what each one's fields mean | The DSL reference — one section per node type, each with the version it arrived in |
| Channels: the types, the reducers, what a view is | The DSL reference, under state |
| Edges: plain, conditional, routes, limits | The DSL reference; and Writing a flow for the reasoning |
MCP declarations — requires.mcp | The DSL reference, from 0.23; and Build your first MCP agent for how it is used |
| What the engine exports, and what it throws | The API reference |
| What a solution package may contain, and the gates into the library | The solution package format |
| What a knowledge collection is on disk | The collection format |
| What an agent tells a board, and what a board may tell an agent | The monitoring protocol |
| What a generated project contains | Deploy and monitor, and Deployment |
The vocabulary every document assumes#
Four words, and one rule about numbers. Having these straight makes the rest of the reference read easily; not having them straight is where most confusion starts.
Channels#
A flow's state is a set of named channels, declared with a type and a reducer. The types are string, number, boolean, list, object, any and file. The built-in reducers are replace, append and merge; anything else is looked up in the registry.
A node writes to the channel named in its output, and the reducer decides what writing means — replace overwrites, append adds to a list, merge folds into an object. Which matters most in a fan-out, where several copies of the same node write at once.
Nodes#
Fourteen kinds: handler, llm, tool, tools, fanout, ask, form, read, flow, agent, work, knowledge, index and database. That is the whole list, and there is no planner among them — Plan and Execute is composition.
Edges#
A plain edge goes from one node to the next. A conditional edge reads a channel and chooses, with routes mapping a value to a target and limits capping how many times a route may be taken — which is how a loop goes round and how it stops.
A conditional edge's router is generated JavaScript, and a model asked to write JavaScript that reads what somebody meant writes a list of regular expressions. One had seventeen patterns, matched “add customer” and not “add cust”, and sent the question to the wrong half of an agent — where a second model answered it from the wrong half's data, with nothing in the flow saying anything was wrong.
So where a route leads to an MCP server, an llm node classifies into a channel and the edge routes on that channel. Edges that only choose between ordinary handlers are unaffected.
Requirements#
requires is what the flow needs from whatever deploys it, and the division inside it is deliberate. services and settings carry prose. packages names npm dependencies. mcp is the one that is declared rather than described: the server's name and the tools this flow may call, and nothing about transport, address, command or credential, which are the deployment's.
All three arrive on the same object at run time, so a name may not be two of them at once — a handler reading services.crm has to know which was meant.
Error handling#
What the engine throws#
| Class | Thrown when |
|---|---|
LGFlowError | The base. Everything below extends it, so one catch can hold them all. |
LGFlowValidationError | A flow is not a valid flow. Carries the problems, each with the path in the document it is about. |
LGFlowRoutingError | A route could not be taken — no matching target, or a limit reached. |
LGFlowAgentError | A run failed inside the graph. |
LGFlowTriggerError | A trigger could not start or could not run. |
They are identifiers in the engine's public API, so renaming them in prose would give you code that does not compile. Where this site's own pages talk about the product they use its product names; where a reference document names a type you will catch, it names it exactly. The API reference opens with the same note.
What a flow can say about failure#
| Declared on a node | What it does | From |
|---|---|---|
retry | Try the node again before giving up. | 0.3 |
onError | Name the node a failure routes to, or END. | 0.3 |
onError: "SKIP" | Carry on past the failed node rather than routing anywhere. The word is reserved, so an older flow with a node actually called SKIP still means what it meant. | 0.32 |
How a failure is categorised at run time#
Separately from the class, every failure is filed under one of these, and the category goes on the journal entry and the run's exit event:
llm · tool · timeout · agent · delegation · validation · trigger · runtime · unknownFrom the error's class, its code, and which call it came out of — never from its message, so the wording can be improved without moving anybody's counts. Deploy and monitor has the reasoning, including why delegation is kept apart from agent.
Version compatibility#
A flow declares a version and gets exactly that version's features. Every version from 0.1 still compiles, and a flow at 0.12 is refused the things 0.13 added rather than being quietly upgraded. So the question this table answers is: what may a flow at version N declare? — everything listed at N and every row above it.
| From version | What a flow may declare from then on |
|---|---|
0.2 | state — channels — the flow's own named statelimits — a cap on how many times a route may be taken |
0.3 | llm — a model call as a nodeonError — where a run goes when a node throwsretry — try a node again before giving upscopedLimits — a limit counted per something rather than per run |
0.4 | tools — a tool as a node |
0.5 | approval — a node that waits for a person to approve |
0.6 | fanout — the same work over every item in a list |
0.7 | describe — prose a node carries about what it is for |
0.8 | ask — a node that asks the person a question |
0.9 | files — file channels, and where their bytes liveremembers — state that carries from turn to turnpackages — npm packages the generated project needsconversation — the thread, and what persists along it |
0.10 | forms — a node that collects several fields at onceread — fetching a document by addresssuggestions — replies offered to the person as buttons |
0.11 | views — how a channel is shown to a person |
0.12 | page — the flow's own stylesheet for its chat |
0.13 | subflow — another flow run as a single step |
0.14 | interactiveSubflow — a subflow that may itself stop for a person |
0.15 | structuredOutput — an llm node declaring the shape of the answer |
0.17 | dynamicFields — a form taking its fields from stateaskingForFields — an llm node asking for a form's fields |
0.19 | agent — a node that runs a registered agent chosen at run time |
0.20 | triggers — a schedule, an event or a webhook starting the flow |
0.21 | identity — who the agent is, and being reachable as itself |
0.22 | users — this flow's people must be identified before it answers |
0.23 | mcp — MCP servers, declared by name and tool list |
0.24 | work — the ReAct loop — the model calls the tools itself |
0.25 | shell — the chat page's own frame |
0.26 | colors — the agent's palettelayout — how the chat page is arrangedlogo — the agent's markwho — what the agent says it is |
0.27 | approvalNeeds — what an approval has to have before it can be given |
0.28 | approvalWhy — the reason attached to an approval |
0.29 | approvalExhibits — what an approver is shown alongside the question |
0.30 | knowledge — a knowledge collection the flow answers from |
0.31 | building — building an index from a folder of documents |
0.32 | onErrorSkip — carry on past a failed node instead of routing |
0.33 | database — a database the flow may be asked questions over |
All 43 features, grouped by the version that introduced them — read out of the compiler's own FEATURE_VERSIONS when this page was built, not transcribed. The current language version is 0.33.
The language version (0.33) says what a flow.json may contain. The monitoring protocol (0.19) says what an agent tells a board. The package version (0.61.0) says what this build is. They move independently, and a test enforces that none is inferred from another.
And never decide a capability from a version number. Capabilities are named precisely so that an older agent's silence is not mistaken for a “no”. Released
The subject guides#
Longer-form than the reference and shorter than a tutorial: one per subject, each rendered from the product's own documentation.
- Writing a flow — The language from the inside: channels, nodes, edges and what the compiler refuses.
rendered fromLGFlow/docs/guides/writing-a-flow.md - Bringing the three up — What to start, in what order, and the two traps that cost an evening.
rendered fromLGFlow/docs/guides/bringing-it-up.md - Deployment — What the Studio writes, what it vendors, and how the folder becomes an image.
rendered fromLGFlow/docs/guides/deployment.md - Running agents — Starting, stopping, and what a running agent is doing when nobody is asking it anything.
rendered fromLGFlow/docs/guides/running-agents.md - Monitoring — What the board knows, how it learns it, and what it will not store.
rendered fromLGFlow/docs/guides/monitoring.md - What a run shows — Reading a run: the tree, the journal, and the four questions kept apart.
rendered fromLGFlow/docs/guides/what-a-run-shows.md - Triggers — A schedule, an event or a webhook — what starts an agent when nobody is talking to it.
rendered fromLGFlow/docs/guides/triggers.md - Subflows — One flow running another as a single step.
rendered fromLGFlow/docs/guides/subflows.md - Multi-agent — Agents that call other agents, and what that costs.
rendered fromLGFlow/docs/guides/multi-agent.md - Human in the loop — The points where an agent waits for a person, and who that person is.
rendered fromLGFlow/docs/guides/human-in-the-loop.md - Testing — Scenarios over a flow, and what a test can and cannot tell you.
rendered fromLGFlow/docs/guides/testing.md - Evaluating — Scored evaluations with a judge, and reading the score honestly.
rendered fromLGFlow/docs/guides/evaluating.md - Worked examples — The example flows in the repository, and what each one demonstrates.
rendered fromLGFlow/docs/guides/worked-examples.md
The node kinds, channel types, reducers, error classes and the whole version matrix were read out of the engine's source at build time — NODE_TYPES, CHANNEL_TYPES, BUILT_IN_REDUCERS, src/errors.js and FEATURE_VERSIONS in Core 0.61.0. The failure categories and the three-clocks rule are the engine's own. Nothing on this page restates a node type's fields, because the rendered DSL reference is the one place those are written. Released