Skip to content

Commit ce16579

Browse files
authored
Merge pull request #3 from Brahma-fi/ft-readme
readme changes
2 parents 08e9a4f + 66ffe14 commit ce16579

File tree

3 files changed

+92
-52
lines changed

3 files changed

+92
-52
lines changed

README.md

Lines changed: 22 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,72 +2,42 @@
22

33
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.
44

5+
![alt text](./docs/image.png)
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+
510
## Features
611

712
- Zero-config workflow scheduling
813
- Automatic retry handling
914
- Native Brahma Builder Kit integration
1015
- Temporal engine under the hood
1116

12-
## Architecture
17+
## Running locally
1318

14-
### Core Components
19+
1. Setup vault
1520

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
2224
```
2325

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
4827

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+
```
5432

55-
#### Resource Management
56-
- Workload distribution
57-
- Execution throttling
58-
- Resource allocation
33+
3. Run scheduler & workers
5934

60-
### Design Considerations
35+
```
36+
go run cmd/main.go scheduler|base-worker|morpho-worker
37+
```
6138

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
6740

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.
7242

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).

docs/architecture.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
## Architecture
2+
3+
### Core Components
4+
5+
#### Executor Interface
6+
7+
The primary interface for implementing custom strategies:
8+
9+
```go
10+
type Executor interface {
11+
Execute(ctx context.Context, req *entity.ExecuteTaskReq) (*entity.ExecuteTaskResp, error)
12+
}
13+
```
14+
15+
#### Runtime Components
16+
17+
- **Temporal Scheduler**: Manages schedule creation and trigger handling
18+
- **Activity Executor**: Handles strategy execution and lifecycle management
19+
- **State Manager**: Maintains execution state and handles persistence
20+
- **Error Handler**: Implements retry mechanisms and failure recovery
21+
22+
### Implementation Requirements
23+
24+
#### Strategy Development
25+
26+
1. Implement the `Executor` interface
27+
2. Process incoming `ExecuteTaskReq`
28+
3. Return execution results via `ExecuteTaskResp`
29+
30+
#### System Integration
31+
32+
- Strategies are automatically registered with Temporal
33+
- Schedules are created based on subscription configurations
34+
- Execution is triggered according to defined intervals
35+
36+
### Managed Components
37+
38+
#### Scheduling
39+
40+
- Schedule creation and management
41+
- Trigger processing and distribution
42+
- Execution window management
43+
44+
#### Execution
45+
46+
- Activity lifecycle management
47+
- State persistence
48+
- Error handling and retries
49+
- Result processing
50+
51+
#### Resource Management
52+
53+
- Workload distribution
54+
- Execution throttling
55+
- Resource allocation
56+
57+
### Design Considerations
58+
59+
#### Strategy Implementation
60+
61+
- Implement atomic, single-responsibility strategies
62+
- Utilize provided context for execution control
63+
- Handle edge cases within strategy implementation
64+
- Return structured responses via `ExecuteTaskResp`
65+
66+
#### Performance
67+
68+
- Strategies are executed as Temporal activities
69+
- Built-in support for parallel execution
70+
- Automatic resource scaling

docs/image.png

156 KB
Loading

0 commit comments

Comments
 (0)