Workflow Logic & State

Workflows are designed to manage complex processes by chaining together a series of actions or Blocks. Understanding the logical flow of Workflows and how state is managed between them is crucial for effective automation and integration.

Logical Flow of Workflows

Workflows operate by executing a sequence of Blocks, each performing specific tasks that contribute to the overall process. These Blocks can include operations like data retrieval, network requests, transformation, and output generation. The logical flow begins with the initiation of the Workflow, typically triggered by an input or event, which then progresses through each Block in the specified order.

State Management

State in Workflows is managed through the passing of data between Blocks. Each Block can produce outputs that become inputs for subsequent Blocks, facilitating a dynamic flow of information. This is achieved using placeholders in the form of {{block_id.your_custom_field}} or {{block_id.output}}. For instance in the screenshot above, {{inputs.user_message}} can be used to represent the initial input provided to the Workflow, while {{collection_vp81p.output}} refers to the output generated by the Collection block, identified by its ID.

To use the Workflow input in the query against my Collection block, I would reference it in the Query field of the Collection block’s configuration like so:

Then, continuing with the same example, I may pass a prompt to my LLM block that contains the output, as referenced by {{collection_vp81p.output}} in the Content field, from the Collection block query:

Execution Considerations

Ensure that each Block is configured to correctly process the inputs it receives and that it outputs data in a format usable by subsequent Blocks. Reference Blocks documentation for details on each specific Block type.

In addition, consider the following:

  • Error Handling: Implement strategies within your execution logic to manage potential errors or exceptions that might occur during execution.
  • Performance: Optimize the sequence and configuration of Blocks to reduce latency and improve the efficiency of the Workflow, particularly when a Workflow is customer facing.