Skip to content

Commit 51189e3

Browse files
authored
Merge pull request #303 from cardanoapi/feat/readme
Feat/readme
2 parents 94202ba + c2c10ef commit 51189e3

File tree

31 files changed

+545
-356
lines changed

31 files changed

+545
-356
lines changed

.env.example

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Frontend
2+
NEXT_PUBLIC_API_URL=http://localhost:8000/api
3+
NEXT_PUBLIC_NETWORK_NAME=sanchonet
4+
NEXT_PUBLIC_MANAGER_BASE_DOMAIN=agent_manager:3001
5+
6+
# API and Manager Common
7+
KAFKA_PREFIX=testing
8+
DATABASE_URL=postgresql://root:root@postgres:5432/cardano_autonomous_agent_testing_db
9+
KAFKA_BROKERS=kafka:9093
10+
AGENT_MNEMONIC=
11+
12+
# API
13+
DOCS_URL=/api/docs
14+
KAFKA_ENABLED=true
15+
METADATA_BASE_URL=https://metadata.drep.id/api
16+
DB_SYNC_BASE_URL=http://dbsync:9000/api
17+
18+
# Agent Manager
19+
CLIENT_ID=my-app
20+
CARDANO_NODE_URL=172.31.0.4:3004
21+
KUBER_BASE_URL=https://sanchonet.kuber.cardanoapi.io
22+
KUBER_API_KEY=
23+
MANAGER_WALLET_ADDRESS=
24+
MANAGER_WALLET_SIGNING_KEY=
25+
FAUCET_API_KEY=
26+
CARDANO_NETWORK_MAGIC=4
27+
BLOCKFROST_API_KEY=
28+
ENABLE_BLOCKFROST_SUBMIT_API=True
29+
NETWORK_NAME=sanchonet
30+
31+
# Postgres
32+
POSTGRES_DB=cardano_autonomous_agent_testing_db
33+
POSTGRES_USER=root
34+
POSTGRES_PASSWORD=root
35+
36+
# DbSync
37+
DBSYNC_PORT=9000
38+
DBSYNC_CORS_ENABLE=true
39+
DBSYNC_DATABASE_URL=
40+
41+
# KAFKA
42+
KAFKA_BROKER_ID= 1
43+
KAFKA_ZOOKEEPER_CONNECT= zookeeper:2181
44+
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP= DOCKER_NET:PLAINTEXT,HOST_NET:PLAINTEXT
45+
KAFKA_ADVERTISED_LISTENERS= DOCKER_NET://kafka:9093,HOST_NET://localhost:9092
46+
KAFKA_INTER_BROKER_LISTENER_NAME= DOCKER_NET
47+
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR= 1
48+
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR= 1
49+
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR= 1
50+
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS= 0
51+
KAFKA_JMX_PORT= 9999
52+
KAFKA_CREATE_TOPICS= "trigger_config_updates:1:1"
53+
54+
#zookeeper
55+
ZOOKEEPER_CLIENT_PORT = 2181
56+
ZOOKEEPER_TICK_TIME = 2000
57+
ZOOKEEPER_SYNC_LIMIT = 2
58+
59+
# Docker network name
60+
DOCKER_NETWORK_NAME=cardano_autonomous_agent
61+
62+
# Docker network name
63+
DOCKER_NETWORK_NAME=cardano_autonomous_agent
64+
65+
# Agent
66+
AGENT_NODE_DOCKER_IMAGE_NAME=autonomous_agent
67+
68+
69+
70+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ app.log
33
.idea/
44
.vscode/
55
*/**/.vscode/
6+
.env
67

78

README.md

Lines changed: 121 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,138 @@
1-
Cardano Autonomous Agent Monorepo
2-
============
1+
# Welcome to Autonomous Agent Testing
32

4-
1. [Backend](api/)
5-
2. [Agent Manager](agent-manager/)
6-
3. [Agent](agent-node/)
7-
4. [Frontend](frontend/)
3+
Autonomous Agent Testing focuses on evaluating features introduced in the Cardano Improvement Proposal (CIP) 1694. This includes testing the creation and voting mechanisms for proposals to ensure the governance model operates seamlessly. Additionally, it verifies functionalities such as:
84

9-
## Running the stack locally
5+
- Registering and deregistering as a Delegated Representative (DRep).
6+
- Managing stake registrations and deregistrations.
7+
- Performing ADA transfers.
8+
- Triggering operations manually, via a CRON schedule, or through event filtering.
109

11-
Setup the required dependencies by running the command locally.
10+
The testing process ensures these operations are secure, efficient, and aligned with the decentralized governance objectives of Cardano's Voltaire era.
1211

13-
```shell
14-
docker compose -f docker-compose.local.yml up -d
12+
---
13+
14+
## Accessing the Deployed Service
15+
16+
You can access the deployed service here: [Autonomous Agent Testing](https://agents.cardanoapi.io/)
17+
18+
---
19+
20+
## Running the Stack Locally
21+
22+
### Directory Structure
23+
24+
1. **`api`**: Backend service.
25+
2. **`manager`**: Middleware between agents and the backend; handles various agent-related services.
26+
3. **`agent-node`**: Agent responsible for executing various functions.
27+
4. **`frontend`**: User interface for autonomous agent testing.
28+
5. **`dbsync-api`**: Service for interacting with the dbsync database.
29+
---
30+
31+
### Using Docker
32+
33+
Before running the entire service locally using Docker, create `.env` files from `.env.example` and populate them with the necessary environment variables. Below are descriptions of key variables:
34+
> **Note:** Some variables in `.env.example` are prepopulated. Keep them as it is or change them carefully.
35+
36+
#### Changes to be made in `.env` file
37+
38+
##### API and Manager
39+
40+
- **`KAFKA_PREFIX`**: Prefix for Kafka topics.
41+
- **`AGENT_MNEMONIC`**: Seed phrase to generate a wallet.
42+
43+
##### Agent Manager
44+
45+
- **`KUBER_API_KEY`**: Generate an API key from [KuberIde](https://kuberide.com/kuber/settings/api-keys).
46+
- **`MANAGER_WALLET_ADDRESS`** (Optional): Wallet address with sufficient ADA for transfers.
47+
- **`MANAGER_WALLET_SIGNING_KEY`** (Optional): Signing key for the manager wallet.
48+
- **`FAUCET_API_KEY`** (Optional): API key to load ADA for agent transfers if the manager wallet lacks sufficient funds.
49+
- **`BLOCKFROST_API_KEY`** (Required if `ENABLE_BLOCKFROST_SUBMIT_API` is enabled): Obtain from [Blockfrost](https://blockfrost.io/).
50+
51+
> **Note:** If `ENABLE_BLOCKFROST_SUBMIT_API` is not enabled, transactions will be submitted using `Kuber`, which may take a few minutes.
52+
53+
##### DBSync
54+
55+
- **`DBSYNC_DATABASE_URL`**: URL for the `dbsync-api service`. Default running on `http://localhost:9000` on starting `dbsync-api` service.
56+
57+
##### Docker Network Name
58+
59+
- **`DOCKER_NETWORK_NAME`**: Customize the Docker network name (default value provided in `.env.example`).
60+
61+
##### Agent
62+
63+
- **`AGENT_NODE_DOCKER_IMAGE_NAME`**: Customize the Docker image name for the agent node.
64+
65+
#### Running in `Preprod` or `Preview` Networks
66+
67+
To run in `Preprod` or `Preview` networks, update the following environment variables:
68+
69+
##### Frontend
70+
71+
- **`NEXT_PUBLIC_NETWORK_NAME`**: Set to `preview` or `preprod`.
72+
73+
##### API and Manager
74+
75+
- **`DB_SYNC_BASE_URL`**:
76+
- `https://preprod-dbync.agents.cardanoapi.io/api` for `preprod`
77+
- `https://preview-dbync.agents.cardanoapi.io/api` for `preview`
78+
79+
##### Manager Only
80+
81+
- **`KUBER_BASE_URL`**:
82+
- `https://preview.kuber.cardanoapi.io` for `preview`
83+
- `https://preprod.kuber.cardanoapi.io` for `preprod`
84+
- **`CARDANO_NETWORK_MAGIC`**:
85+
- `3` for `preview`
86+
- `2` for `preprod`
87+
- **`BLOCKFROST_API_KEY`**: Obtain from [Blockfrost](https://blockfrost.io/) for the desired network.
88+
- **`NETWORK_NAME`**: Set to `preprod` or `preview`.
89+
90+
##### DBSync
91+
92+
- **`DBSYNC_DATABASE_URL`**: Update the URL and database name accordingly.
93+
---
94+
95+
#### Starting the Service
96+
97+
Run the following command:
98+
99+
```bash
100+
docker compose -f docker-compose.dev.yml up -d
15101
```
16102

17-
**Note**: You can also use already existing services in place of this
103+
> **Note:** Ensure no applications are running on ports `3000` and `8000`.
104+
105+
#### Finally Running the Agent
106+
107+
1. Visit the frontend at `http://localhost:3000` and connect your wallet.
108+
2. Navigate to the `My Agent` tab in the bottom left to access the `Agents Page`.
109+
3. In the `Overview Tab`, click the `Run Agent` button in the top-right corner of the `Agents Overview Section`.
110+
4. Copy the Docker command and run it in the terminal. Your agent is now ready to operate.
111+
112+
---
18113

114+
### Local Setup
19115

20-
The setup guide for each services are in the respective directories:
116+
Each service has its own setup guide within its respective directory.
21117

22118
1. [Backend](api/README.md)
23119
2. [Agent Manager](agent-manager/README.md)
24120
3. [Agent](agent-node/README.md)
25121
4. [Frontend](frontend/README.md)
122+
5. [DbSync-Api](dbsync-api/README.md)
26123

124+
**`Note`**: For running all services locally, dependencies like `Kafka` and `PostgreSQL` can be run via Docker using the following command:
125+
```bash
126+
docker compose -f docker-compose.dev.yml up -d
127+
```
128+
129+
---
130+
131+
## Important
27132

28-
# IMPORTANT
133+
Before committing any changes to the repository, set up the pre-commit hook by running the following command:
29134

30-
Please setup the pre-commit hook before adding any commit for git by running the following command:
31-
```shell
135+
```bash
32136
./install-pre-commit-hook.sh
33-
```
137+
```
138+

agent-manager/.env.example

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,31 @@
1-
KAFKA_BROKERS=127.0.0.1:9092
2-
KAFKA_CLIENT_ID=
3-
KAFKA_PREFIX=local
1+
# Kafka
2+
KAFKA_BROKERS=
3+
KAFKA_TOPIC_PREFIX=
4+
KAFKA_CONSUMER_GROUP=
5+
CLIENT_ID=
46

5-
CARDANO_NODE_URL=
6-
CARDANO_NETWORK_MAGIC=4
77

8-
KUBER_BASE_URL=
8+
# Cardano
9+
CARDANO_NODE_URL=172.31.0.4:3004
10+
KUBER_BASE_URL='https://sanchonet.kuber.cardanoapi.io'
911
KUBER_API_KEY=
12+
METADATA_BASE_URL='https://metadata.drep.id'
13+
DB_SYNC_BASE_URL=
14+
CARDANO_NETWORK_MAGIC=4
1015
BLOCKFROST_API_KEY=
11-
ENABLE_BLOCKFROST_SUBMIT_API=
16+
ENABLE_BLOCKFROST_SUBMIT_API='True'
1217

1318

14-
DATABASE_URL=postgresql://root:root@localhost:5432/cardano_autonomous_agent_testing_db
15-
19+
# Wallet
1620
MANAGER_WALLET_ADDRESS=
1721
MANAGER_WALLET_SIGNING_KEY=
18-
19-
SANCHONET_FAUCET_API_KEY=
20-
22+
FAUCET_API_KEY=
2123
AGENT_MNEMONIC=
22-
METADATA_BASE_URL=
23-
METADATA_FETCH_BASE_URL=
24-
25-
DB_SYNC_BASE_URL=
26-
27-
SERVER_PORT=
28-
NETWORK_NAME=
29-
3024

25+
# Database
26+
DATABASE_URL=
3127

3228

33-
ELASTIC_APM_SERVER_URL=https://apm.sireto.io
34-
ELASTIC_APM_API_KEY=XXX
29+
# Server
30+
SERVER_PORT=3002
31+
NETWORK_NAME=sanchonet

0 commit comments

Comments
 (0)