|
2 | 2 |
|
3 | 3 | Scalable, high-performance workflow scheduling engine built on Temporal for executing custom strategies with the Brahma Builder Kit API. Seamlessly manages workflow orchestration, fault tolerance, and Brahma ecosystem integration.
|
4 | 4 |
|
| 5 | + |
| 6 | + |
| 7 | +- **[Architecture reference](./docs/architecture.md)** |
| 8 | +- **[Additional context](https://www.notion.so/brahmafi/Bringing-AI-Agents-On-Chain-Automate-Execute-and-Scale-with-Brahma-175a53ecb04c80d9b9d6cf16cd1dd98a#175a53ecb04c8078b143f61bd9681e2b)** |
| 9 | + |
5 | 10 | ## Features
|
6 | 11 |
|
7 | 12 | - Zero-config workflow scheduling
|
8 | 13 | - Automatic retry handling
|
9 | 14 | - Native Brahma Builder Kit integration
|
10 | 15 | - Temporal engine under the hood
|
11 | 16 |
|
12 |
| -## Architecture |
| 17 | +## Running locally |
13 | 18 |
|
14 |
| -### Core Components |
| 19 | +1. Setup vault |
15 | 20 |
|
16 |
| -#### Executor Interface |
17 |
| -The primary interface for implementing custom strategies: |
18 |
| -```go |
19 |
| -type Executor interface { |
20 |
| - Execute(ctx context.Context, req *entity.ExecuteTaskReq) (*entity.ExecuteTaskResp, error) |
21 |
| -} |
| 21 | +``` |
| 22 | +make setup-local-vault |
| 23 | +make setup-local-plugin |
22 | 24 | ```
|
23 | 25 |
|
24 |
| -#### Runtime Components |
25 |
| -- **Temporal Scheduler**: Manages schedule creation and trigger handling |
26 |
| -- **Activity Executor**: Handles strategy execution and lifecycle management |
27 |
| -- **State Manager**: Maintains execution state and handles persistence |
28 |
| -- **Error Handler**: Implements retry mechanisms and failure recovery |
29 |
| - |
30 |
| -### Implementation Requirements |
31 |
| - |
32 |
| -#### Strategy Development |
33 |
| -1. Implement the `Executor` interface |
34 |
| -2. Process incoming `ExecuteTaskReq` |
35 |
| -3. Return execution results via `ExecuteTaskResp` |
36 |
| - |
37 |
| -#### System Integration |
38 |
| -- Strategies are automatically registered with Temporal |
39 |
| -- Schedules are created based on subscription configurations |
40 |
| -- Execution is triggered according to defined intervals |
41 |
| - |
42 |
| -### Managed Components |
43 |
| - |
44 |
| -#### Scheduling |
45 |
| -- Schedule creation and management |
46 |
| -- Trigger processing and distribution |
47 |
| -- Execution window management |
| 26 | +2. Setup env |
48 | 27 |
|
49 |
| -#### Execution |
50 |
| -- Activity lifecycle management |
51 |
| -- State persistence |
52 |
| -- Error handling and retries |
53 |
| -- Result processing |
| 28 | +``` |
| 29 | +export VAULT_ADDR=127.0.0.1:8200 |
| 30 | +export ENV=local |
| 31 | +``` |
54 | 32 |
|
55 |
| -#### Resource Management |
56 |
| -- Workload distribution |
57 |
| -- Execution throttling |
58 |
| -- Resource allocation |
| 33 | +3. Run scheduler & workers |
59 | 34 |
|
60 |
| -### Design Considerations |
| 35 | +``` |
| 36 | +go run cmd/main.go scheduler|base-worker|morpho-worker |
| 37 | +``` |
61 | 38 |
|
62 |
| -#### Strategy Implementation |
63 |
| -- Implement atomic, single-responsibility strategies |
64 |
| -- Utilize provided context for execution control |
65 |
| -- Handle edge cases within strategy implementation |
66 |
| -- Return structured responses via `ExecuteTaskResp` |
| 39 | +## Example |
67 | 40 |
|
68 |
| -#### Performance |
69 |
| -- Strategies are executed as Temporal activities |
70 |
| -- Built-in support for parallel execution |
71 |
| -- Automatic resource scaling |
| 41 | +Morpho Yield Optimizer is a strategy that is built using Brahma builder. It maximises user’s Morpho positions by taking decisions on which vaults to choose based on APY; liquidity and TVL, on every rebalance. |
72 | 42 |
|
73 |
| -For reference implementation, see [Morpho Optimizer Strategy](https://github.com/Brahma-fi/brahma-builder/blob/main/internal/usecase/workflows/activities/morpho/activity.go). |
| 43 | +For reference implementation, see [Morpho Optimizer Strategy](https://github.com/Brahma-fi/brahma-builder/blob/main/internal/usecase/workflows/activities/morpho/activity.go). |
0 commit comments