Scout Workflow Logic and State
Understanding workflow execution and state management
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.