The Stop Graph block is used to halt the execution of a graph at a specific point in the workflow. When the Stop Graph block is executed, it immediately stops the entire graph, preventing any further actions or operations from being executed.
In the example below, the Stop Graph block is used to create a conditional termination of the graph:
When the graph is run, the flow of execution reaches the Stop Graph block. If the specified condition is met (in this case, "isMarketClosed" is true), the graph will terminate immediately. Otherwise, if the condition is false, the graph will continue executing other blocks after the Stop Graph block.
The Stop Graph block is helpful when we need to introduce conditional termination points in our graphs, allowing us to control the flow of execution based on certain conditions or events.