This page provides detailed documentation of the task data model in the EigenLayer-AVS system, including the structure of tasks, nodes, edges, and triggers.
This page provides detailed documentation of the task data model in the EigenLayer-AVS system, including the structure of tasks, nodes, edges, and triggers. For information about task execution, see Virtual Machine.
The Task Model defines the core data structures that represent automated workflows in the EigenLayer-AVS system. Tasks are structured as directed graphs of operations (nodes) connected by execution paths (edges), with trigger conditions that determine when tasks should execute.
Sources:
A Task represents a complete workflow definition with the following key components:
| Field | Type | Description |
|---|---|---|
| id | string | Unique identifier (ULID format) |
| owner | string | Ethereum address of the task owner |
| smart_wallet_address | string | Smart wallet address used to execute the task |
| start_at | int64 | Task won't be checked before this timestamp (milliseconds) |
| expired_at | int64 | Task won't run after this timestamp (milliseconds) |
| name | string | Human-readable task name (limited to 255 characters) |
| max_execution | int64 | Maximum number of times this task can run (0 = unlimited) |
| total_execution | int64 | Number of times this task has executed |
| last_ran_at | int64 | Timestamp of last execution (milliseconds) |
| status | TaskStatus | Current state of the task |
| trigger | TaskTrigger | Defines when the task should run |
| nodes | []TaskNode | Collection of operations in the task |
| edges | []TaskEdge | Connections between nodes that define execution flow |
Tasks are created through the CreateTask method in the Task Engine, which validates the task structure before storing it.
Sources:
Tasks transition through different states during their lifetime:
The defined task states are:
| Status | Description |
|---|---|
| Active | Task is eligible to be triggered and executed |
| Executing | Task is currently running |
| Completed | Task has reached its max_execution or expiration time |
| Failed | Task encountered an unrecoverable error |
| Canceled | Task was explicitly canceled by its owner |
A task is considered "runable" if it hasn't reached its maximum execution count and hasn't expired.
Sources:
Nodes represent individual operations within a task. Each node has a specific type that determines its behavior. The TaskNode structure includes a common id and name, plus a type-specific payload.
Sources:
The system supports the following node types:
These nodes interact with external systems:
ETHTransferNode: Transfers ETH to a specified destination
ContractWriteNode: Executes a write operation on a smart contract
ContractReadNode: Reads data from a smart contract
GraphQLQueryNode: Executes a GraphQL query
RestAPINode: Makes HTTP requests to REST APIs
Sources:
These nodes handle data processing and flow control:
CustomCodeNode: Executes custom JavaScript code
BranchNode: Implements conditional branching
FilterNode: Filters arrays based on expressions
LoopNode: Iterates over collections
Sources:
Edges connect nodes together to form a directed graph that defines the execution flow. Each edge has three components:
| Field | Description |
|---|---|
| id | Unique identifier for the edge |
| source | ID of the node where the edge begins |
| target | ID of the node where the edge ends |
The set of edges determines how data and control flow through the task. After executing a node, the system follows the edges to determine which nodes to execute next.
Sources:
Triggers determine when a task should be executed. The system supports various trigger mechanisms to accommodate different use cases.
Sources:
The system supports the following trigger types:
Tasks with manual triggers are executed explicitly by calling the TriggerTask method.
FixedTimeCondition: Triggers at specific timestamps (epochs)
CronCondition: Triggers based on cron-like schedules
BlockCondition: Triggers at specific block intervals
EventCondition: Triggers in response to on-chain events
Event triggers are particularly powerful, allowing tasks to react to blockchain events like token transfers by matching on event topics and other parameters.
Sources:
When a task is triggered, an execution is created to track the progress and results of the run.
Sources:
The execution model includes:
Execution: Records the overall result of a task run
Steps: Track the execution of individual nodes
TriggerReason: Provides detailed information about what triggered the task
This detailed execution history enables precise tracking and debugging of task runs.
Sources:
The Task Model is implemented through several components in the EigenLayer-AVS system:
The primary components involved in the Task Model are:
Task Engine - Central component that manages task creation, storage, and execution coordination
core/taskengine/engine.goStorage System - Persists tasks and executions using BadgerDB
Operator Network - Distributed system for monitoring triggers
Virtual Machine - Executes task nodes based on the task graph
Sources:
The system provides a comprehensive API for working with tasks:
| Operation | Description |
|---|---|
| CreateTask | Creates a new task with specified nodes, edges, and trigger |
| GetTask | Retrieves a task by its ID |
| ListTasks | Lists tasks based on filtering criteria |
| TriggerTask | Manually triggers a task execution |
| CancelTask | Cancels an active task |
| DeleteTask | Permanently removes a task |
| GetExecution | Retrieves execution details by task ID and execution ID |
| ListExecutions | Lists executions for a given task |
| GetExecutionStatus | Checks the status of a specific execution |
These API methods are exposed through the gRPC interface provided by the Aggregator service.
Sources:
The Task Model enforces several constraints to ensure valid task definitions:
Tasks must have at least one node
Tasks must have at least one edge
Tasks must include a trigger definition
Smart wallet addresses must be valid and owned by the task creator
Task IDs are generated as ULIDs (Universally Unique Lexicographically Sortable Identifiers)
Sources:
Feature this wiki to auto refresh weekly