High-Level Structure
Every Workflow Definition adheres to the following core JSON schema:Top-Level Properties
Components Array
Thecomponents array contains objects detailing the individual processing units. Each component has an ID, a type definition, and configurations for its specific behavior and positional placement if rendered visually in the UI.
The Component Object
A component is one object in thecomponents array. id, category, type and name are required. A component that
lacks one fails the check with Component `<label>` is missing required field(s): <fields>.
The four categories are
flow for the steps that give an execution its shape, data for a component that holds a
value, processor for a step that does work, and provider for a component that supplies a service, such as a model or
a credential, to a step. The Workflow Components page lists every type under its category.
Ports
A port entry carries acategory, a route and a value.
categoryis the kind of port, as the component’s page lists it:data_input,data_outputorprovider_input.routeis the port’s name on that component. A port with noroutefails withPort at position <n> (category: `<category>`) on component `<name>` is missing required field(s): route.valueis a value object, written as on Data Types: atypeand the field that type reads, such as{"type": "text", "text": "..."}or{"type": "choice", "id": "session"}.
Port `<route>` (category: `<category>`) is required, and a data component’s persistence left out reads as
none (Persistence).
Custom routes
Alogic.code names its own routes. A route is whatever name its code uses, and the definition declares it where the
route is used:
- A flow route is a connection from the code component’s
flow_outputwhoserouteis that name. The check does not read the program, so it cannot see which routes the program passes toset_result: a route with no connection fails the execution when the program names it, withDesired route ("<route>") is not satisfied in the workflow definition. - A data input is a
data_inputport with that route, or a connection from the component’sdata_inputto a data component’sdata_reference. A data output is only the second kind, a connection fromdata_output: a program that writes a route with no such connection writes nothing. The program reads an input withget_data_input(route)and writes an output withset_data_output(route, value). - A provider is a connection from
provider_inputto the provider’sprovider_reference, and the program reads it withget_provider_credential(route, ...).
Example
Corvel Freight books a carrier, waits for the carrier’s system to confirm, and then runs a check that reads the dispatch notes.flow.start leads to a logic.sleep with seconds set to 2.5, then to a logic.code, then to flow.end.
The notes are a data.message kept in the session under the alias dispatch/carrier_notes: its persistence is
session and it holds no inline value, so an earlier execution or an upload supplies it. A connection from the code
component’s data_input to the message’s data_reference, with the route carrier_notes, is how the program reads it.
Component `<name>` is not referred to, so the
data.message needs c4. A component with no connection leading to it fails with Component `<name>` is unreachable, and one with no flow connection leaving it fails with Component `<name>` does not have outbound connections.
The check
upload_definition stores a definition after checking its shape against the schema, not the rules of the manifest. An
execution runs the manifest check when it starts, the same one the Check
Definition operation runs, and a definition that fails it ends the
execution with a flow.error event, Workflow definition check failed, whose data.events holds the findings. A
hand-written definition therefore goes upload,
check, create a
session, create an
execution; the check is the step that shows a refusal before a run
does.
Connections Array
Theconnections array defines how control passes between components upon execution. Connections are directional edges between a specific output “route” of a source component and a specific input “route” of a target component.
Connection Properties
id: The connection’s own identifier, unique within the definition. Required — a definition whose connections omit it, or reuse one, fails validation and will not execute. Visual editors key their edges by this value, so connections without one collapse into a single edge when the workflow is drawn.source_id: The ID of the component yielding control.target_id: The ID of the component receiving control.source_port: The physical output port the connection originates from.target_port: The physical input port the connection arrives at.route: The semantic logic path dictating when this edge fires (e.g.,"success","failure","next").
Connector Placement
Every component exposes its connectors at fixed positions on the node. Knowing where each one sits lets you place components (via theirposition) so edges stay short and non-crossing — clean, readable flows. The diagram below shows
all connector types on a single component (logic.code) and the components they connect to:


Data and provider components expose the matching reference ports (
data_reference, provider_reference) so the edges
land on their facing side.
Laying out clean flows
Because the connectors are fixed, a few conventions produce tidy definitions:- Flow runs top → bottom.
flow_inputis on the top edge andflow_outputon the bottom, so stack sequential steps vertically — samex, increasingy. - Data sits to the right.
data_inputanddata_outputexit the right side, so place the message / list / data components a step reads or produces to its right. - Providers sit to the left.
provider_inputis on the left edge, so place provider components to the left.
position field ({ "x", "y" }) on each component is what the editor renders from; following these conventions
keeps the graph legible.
