Skip to main content

Architecture of a Flow

The underlying flow engine is built upon a a few key constructs. These constructs are the Loader and Runtime Providers.

The Loader stores a symbol registry that contains all all nodes and any entry points they want to expose to the rest of the flow system. The nodes are defined as symbols and the entry points exposed by a node are defined as callable symbols within the Loader system.

The Loader exposes functionality to lookup symbols and registry symbols along with various other helpful functions. The main functions that will be used are Register, Lookup, and LookupCallable.

The flow engine has three runtime providers that expose various capabilities of the system. These runtimes are known as the Visual Script runtime, the Native runtime, and the JavaScript runtime.

The Visual Script runtime handles creating all nodes defined within a graph along with setting up all connections between the nodes in the graph.

The Native runtime handles creating nodes that are built as part of the agent package itself.

The JavaScript runtime handles the JavaScript environment and executing nodes that are defined in JavaScript.

In order to allow nodes in different runtime to interoperate, all nodes conform to the Symbol functionality.

For symbols that can be executed, these have extra functionality and conform to Callable Symbol. To retrieve a symbol or callable symbol, use the Loaders Lookup and LookupCallable functionality to access symbols and callable symbols, respectively. Callable symbols expose a function called Call that will, when called, execute the functionality exposed by that callable symbol.

Note

The Call function exposed by all CallableSymbols must take as the first parameter a context. This will also be the first argument passed to any entry point function so can easily be passed through the system when necessary.

To inspect the symbol registry for a flow, a topic is published for each flow called registry. Once this topic has been subscribed, any updates to the symbol registry will cause a message to be published to the registry topic with the updated symbol registry. The symbol registry information can be used to see what entry points are exposed by all of the nodes and may help to build up further flows.