Application
An Application is a reusable workflow composed of one or more Components. You can register multiple Applications within a project. When paired with configuration via a Compound Component, an Application generates a list of Component definitions.
Why Use Applications?
Applications offer several benefits for managing complex workflows:
-
Reusability: Applications allow you to define workflows that can be reused across different projects, reducing duplication and simplifying maintenance. This modular approach encourages consistent implementation of business logic.
-
Scalability: You can easily scale Applications by reconfiguring their components, enabling you to adapt workflows as requirements change without significant rework.
-
Simplified Management: Applications and their generated components are managed centrally through configuration files, reducing the need for direct code manipulation. This separation between configuration and logic minimizes errors and speeds up deployment.
-
Consistency: Using Applications ensures uniform behavior and configuration across workflows in different projects or environments, enhancing reliability and predictability.
Key Concepts
-
Component Definitions: Generated Components are linked to the parent Compound Component](component-compound.mdx), which acts as a Component group. However, these Components are considered top-level in the Flow and run individually like any other Component.
-
Build Artifacts: Components generated from an Application are considered build artifacts and cannot be edited directly. You can only modify the Compound Component or the Application that generates these Components.
Defining Applications in a Project
You can define Applications in a project using the following methods:
-
YAML Definitions: Define an Application in the
applications/
folder using a YAML file that references Python code. -
Python Modules: Define an Application in the
src/
folder where the Application class is decorated with the@application
class decorator.
Each Application must have a unique name within the project.
Configuration Requirements
- Each Application definition must include a Pydantic model specifying the configuration needed to generate components.
Conclusion
Applications provide a powerful way to define and manage reusable workflows. They enable developers to create scalable, consistent, and easily manageable Component configurations. By separating configuration from code, Applications help maintain a clean and organized project structure, making projects more efficient and adaptable. Leveraging Applications allows teams to focus on innovation and delivery while maintaining control over Component flows within a project.