The Workflow System is the core orchestration mechanism in the AVA SDK, enabling developers to create, manage, and execute automated sequences of operations.
The Workflow System is the core orchestration mechanism in the AVA SDK, enabling developers to create, manage, and execute automated sequences of operations. This document covers the architecture of the workflow system, its components, and how to interact with it programmatically.
For information about specific trigger types that initiate workflows, see Triggers. For details on the different types of nodes that can be included in workflows, see Nodes.
The Workflow System allows developers to define automated processes as a directed graph of operations (nodes) connected by relationships (edges). Workflows are triggered by specific conditions and executed by the AVS service, with execution results being recorded for monitoring and debugging.
Sources:
A workflow is defined by the following components:
Sources:
| Property | Description |
|---|---|
id | Unique identifier for the workflow, generated when submitted |
name | Human-readable name for the workflow |
smartWalletAddress | Address of the smart wallet associated with the workflow |
owner | Address of the EOA that owns the workflow |
startAt | Timestamp when the workflow should start (Unix timestamp) |
expiredAt | Timestamp when the workflow should expire (Unix timestamp) |
maxExecution | Maximum number of times the workflow can execute (0 for unlimited) |
status | Current status of the workflow (Active, Canceled, Expired) |
trigger | Condition that initiates the workflow |
nodes | Array of operations to be performed |
edges | Array of connections between nodes, defining the workflow graph |
Sources:
The workflow lifecycle consists of creation, submission, execution, and optional cancellation or deletion.
Sources:
Workflows are created in two steps:
client.createWorkflow()client.submitWorkflow()Sources:
Sources:
You can retrieve individual workflows by ID or multiple workflows by smart wallet address.
Sources:
Workflows can be canceled to stop them from executing and deleted to remove them entirely.
Sources:
When a workflow's trigger conditions are met, the workflow is executed by the AVS service.
Sources:
Execution records contain information about the execution of the workflow, including the status of each step and any outputs or errors.
Sources:
Workflows can also be triggered manually using the triggerWorkflow method.
Sources:
Nodes are the building blocks of workflows, representing operations that can be performed as part of a workflow. The SDK provides various node types for different operations.
Sources:
Example node configurations can be found throughout the code, including:
Triggers define when workflows should be executed. The SDK supports several types of triggers.
Sources:
Example trigger configurations:
The Workflow System provides error handling both at the workflow level and for individual nodes.
Sources:
When retrieving executions, each step in the execution contains a success flag and potentially an error message:
The examples directory contains several practical workflow examples:
These examples demonstrate how to construct workflows for various use cases, including blockchain monitoring, notifications, and automated token management.
When working with the Workflow System, consider the following best practices:
For more information about specific aspects of the Workflow System, see: