Skip to content

Commit c3f9e90

Browse files
committed
enhancement: Update Readme for api and frontend
1 parent e9bd1fe commit c3f9e90

File tree

4 files changed

+126
-153
lines changed

4 files changed

+126
-153
lines changed

README.md

Lines changed: 89 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,125 +1,130 @@
1-
### Welcome to Autonomous Agent Testing
2-
Autonomous Agent Testing primarily focuses on evaluating the features introduced in the Cardano Improvement Proposal (CIP) 1694.
3-
This includes testing the creation and voting mechanisms for proposals to ensure the governance model operates seamlessly.
4-
Additionally, it verifies functionalities like registering and deregistering as a Delegated Representative (DRep),
5-
managing stake registrations and deregistrations, and performing ADA transfers. It also provides the feature to trigger these function either
6-
Manually or by setting a CRON schedule or by event filtering The testing process ensures these operations are secure, efficient,
7-
and align with the decentralized governance objectives of Cardano's Voltaire era.
1+
# Welcome to Autonomous Agent Testing
82

9-
## Running the deployed service
10-
[Autonomous Agent Testing](https://agents.cardanoapi.io/)
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:
114

12-
## 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.
9+
10+
The testing process ensures these operations are secure, efficient, and aligned with the decentralized governance objectives of Cardano's Voltaire era.
11+
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
1321

1422
### Directory Structure
15-
1. `api`: the backend service
16-
2. `manager`: Middleman between agents and backend. Also handles different services for agent
17-
3. `agent-node`: agent for handling various functions
18-
4. `frontend`: UI for autonomous agent testing
19-
5. `dbsync-api`: handling services related to dbsync database
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.
2029

2130
### Using Docker
2231

23-
Before running whole service locally using docker you need to create a `.env` and `.env.dbsync` file from `.env.example` and `.env.dbsync.example` respectively to add environment variables.
24-
Below are some of the descriptions of the environment variables.
32+
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:
33+
> **Note:** Some variables in `.env.example` are prepopulated. Keep them as it is or change them carefully.
34+
35+
#### Changes to be made in `.env` file
36+
37+
##### API and Manager
38+
39+
- **`KAFKA_PREFIX`**: Prefix for Kafka topics.
40+
- **`AGENT_MNEMONIC`**: Seed phrase to generate a wallet.
2541

26-
**Changes to be made in `.env` file**
42+
##### Agent Manager
2743

28-
##### api and manager
29-
- KAFKA_PREFIX
30-
- prefix for kafka topic
31-
- AGENT_MNEMONIC
32-
- Add seed phrase to generate wallet
44+
- **`KUBER_API_KEY`**: Generate an API key from [KuberIde](https://kuberide.com/kuber/settings/api-keys).
45+
- **`MANAGER_WALLET_ADDRESS`** (Optional): Wallet address with sufficient ADA for transfers.
46+
- **`MANAGER_WALLET_SIGNING_KEY`** (Optional): Signing key for the manager wallet.
47+
- **`FAUCET_API_KEY`** (Optional): API key to load ADA for agent transfers if the manager wallet lacks sufficient funds.
48+
- **`BLOCKFROST_API_KEY`** (Required if `ENABLE_BLOCKFROST_SUBMIT_API` is enabled): Obtain from [Blockfrost](https://blockfrost.io/).
3349

34-
##### agent_manager
35-
- KUBER_API_KEY
36-
- Visit [KuberIde](https://kuberide.com/kuber/settings/api-keys) and generate api-key
37-
- MANAGER_WALLET_ADDRESS (OPTIONAL)
38-
- MANAGER_WALLET_SIGNING_KEY (OPTIONAL)
39-
- Add a wallet address having sufficient ADA so that it can be used to transfer ADA to agent when requested
40-
- FAUCET_API_KEY (OPTIONAL)
41-
- Add faucet api key to load ADA which will be used to transfer ADA to agents as per request. And it will only be used if the provided `MANAGER_WALLET_ADDRESS` doesnot have sufficient ADA.
42-
- BLOCKFROST_API_KEY (Required if ENABLE_BLOCKFROST_SUBMIT_API is 'True' or enabled)
43-
- Visit [Blockfrost](https://blockfrost.io/) and sign up and generate api key
50+
> **Note:** If `ENABLE_BLOCKFROST_SUBMIT_API` is not enabled, transactions will be submitted using `Kuber`, which may take a few minutes.
4451
45-
***Note***: environment variable `ENABLE_BLOCKFROST_SUBMIT_API` is preferred as if it is not enabled then `Kuber` will be used to submit the transaction which might take couple of minutes.
52+
##### DBSync
4653

47-
##### dbsync
48-
- DBSYNC_DATABASE_URL
49-
- Add database url of dbsync
54+
- **`DBSYNC_DATABASE_URL`**: URL for the dbsync database.
5055

51-
##### docker network name
52-
- DOCKER_NETWORK_NAME
53-
- Change name for docker network as default value is provided in `.env.example`
56+
##### Docker Network Name
5457

55-
##### agent
56-
- AGENT_NODE_DOCKER_IMAGE_NAME
57-
- Change name for docker network as default value is provided in `.env.example`
58+
- **`DOCKER_NETWORK_NAME`**: Customize the Docker network name (default value provided in `.env.example`).
5859

59-
***Note***: Furthermore all env are setup to run in `Sanchonet` so if you want to run in `Preprod` or `Preview`
60-
Network then following environment variables are to be updated:
60+
##### Agent
6161

62-
**Changes to be made in `.env` file**
63-
##### frontend
64-
- NEXT_PUBLIC_NETWORK_NAME
65-
- preview or preprod
62+
- **`AGENT_NODE_DOCKER_IMAGE_NAME`**: Customize the Docker image name for the agent node.
6663

67-
##### api and manager
68-
- DB_SYNC_BASE_URL
69-
- https://preprod-dbync.agents.cardanoapi.io/api for `preprod`
70-
- https://preview-dbync.agents.cardanoapi.io/api for `preview`
64+
#### Running in `Preprod` or `Preview` Networks
7165

72-
##### manager only
73-
- KUBER_BASE_URL
74-
- https://preview.kuber.cardanoapi.io for `preview`
75-
- https://preprod.kuber.cardanoapi.io for `preprod`
66+
To run in `Preprod` or `Preview` networks, update the following environment variables:
7667

77-
- CARDANO_NETWORK_MAGIC
78-
- 3 for `preview`
79-
- 2 for `preprod`
68+
##### Frontend
8069

81-
- BLOCKFROST_API_KEY
82-
- Visit [Blockfrost](https://blockfrost.io/) and sign up and generate api key based on desired network type
70+
- **`NEXT_PUBLIC_NETWORK_NAME`**: Set to `preview` or `preprod`.
8371

84-
- NETWORK_NAME
85-
- preprod or preview
72+
##### API and Manager
8673

87-
##### dbsync
88-
- DBSYNC_DATABASE_URL
89-
- Update the dbsync database url and database name accordingly
74+
- **`DB_SYNC_BASE_URL`**:
75+
- `https://preprod-dbync.agents.cardanoapi.io/api` for `preprod`
76+
- `https://preview-dbync.agents.cardanoapi.io/api` for `preview`
9077

78+
##### Manager Only
9179

92-
Finally run the given command below:
93-
```shell
80+
- **`KUBER_BASE_URL`**:
81+
- `https://preview.kuber.cardanoapi.io` for `preview`
82+
- `https://preprod.kuber.cardanoapi.io` for `preprod`
83+
- **`CARDANO_NETWORK_MAGIC`**:
84+
- `3` for `preview`
85+
- `2` for `preprod`
86+
- **`BLOCKFROST_API_KEY`**: Obtain from [Blockfrost](https://blockfrost.io/) for the desired network.
87+
- **`NETWORK_NAME`**: Set to `preprod` or `preview`.
88+
89+
##### DBSync
90+
91+
- **`DBSYNC_DATABASE_URL`**: Update the URL and database name accordingly.
92+
93+
#### Starting the Service
94+
95+
Run the following command:
96+
97+
```bash
9498
docker compose -f docker-compose.dev.yml up -d
9599
```
96100

97-
**Note** Make sure no application is running on port `3000`, `8000`
101+
> **Note:** Ensure no applications are running on ports `3000` and `8000`.
98102
99-
**Note**: After running the above command line, you can run the agent by following steps:
100-
###### For running agent:
101-
- Visit frontend at `http://localhost:3000` and connect your wallet.
102-
- Then click the `My Agent` tab at bottom left. you will be navigated to `Agents Page`
103-
- In `Overview Tab` click `Run Agent` button at the top right of `Agents Overview Section`
104-
- Now copy the docker command and run it in terminal. And Finally your agent is ready to run.
103+
#### Running the Agent
105104

105+
1. Visit the frontend at `http://localhost:3000` and connect your wallet.
106+
2. Navigate to the `My Agent` tab in the bottom left to access the `Agents Page`.
107+
3. In the `Overview Tab`, click the `Run Agent` button in the top-right corner of the `Agents Overview Section`.
108+
4. Copy the Docker command and run it in the terminal. Your agent is now ready to operate.
106109

107-
### Setup Locally
110+
---
108111

109-
The setup guide for each services are in the respective directories:
110-
111-
For running all services locally some of the dependent services like `Kafka`, `Postgresql` can be run via Docker using following command.
112+
### Local Setup
112113

114+
Each service has its own setup guide within its respective directory. For running all services locally, dependencies like `Kafka` and `PostgreSQL` can be run via Docker using the following command:
113115

114116
1. [Backend](api/README.md)
115117
2. [Agent Manager](agent-manager/README.md)
116118
3. [Agent](agent-node/README.md)
117119
4. [Frontend](frontend/README.md)
118120

121+
---
122+
123+
## Important
119124

120-
# IMPORTANT
125+
Before committing any changes to the repository, set up the pre-commit hook by running the following command:
121126

122-
Please setup the pre-commit hook before adding any commit for git by running the following command:
123-
```shell
127+
```bash
124128
./install-pre-commit-hook.sh
125-
```
129+
```
130+

api/.env.example

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1-
# Environment
2-
# Allowed Values : development , production
3-
APP_ENV=production
4-
51
DATABASE_URL=
6-
AGENT_MNEMONIC=""
2+
AGENT_MNEMONIC=
73
KAFKA_BROKERS=
84
KAFKA_ENABLED=true
95
DOCS_URL=/api/docs
10-
OPENAPI_URL=/api/openapi.json
11-
DB_SYNC_BASE_URL=
126

137
KUBER_URL=localhost
148
KAFKA_PREFIX=

api/README.md

Lines changed: 28 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,6 @@ Python version : 3.12.2
88

99
Poetry version : 1.8.2
1010

11-
## Docker
12-
13-
## Setup Guide
14-
15-
Clone the project
16-
17-
```bash
18-
git clone https://github.com/sireto/cardano-autonomous-agent
19-
```
20-
21-
Change directory
22-
23-
```bash
24-
cd cardano-autonomous-agent
25-
```
26-
27-
Run Docker-Compose . This will setup up the **postgres Database**, **pgadmin4** , **kafka** and **backend** via Docker.
28-
29-
```bash
30-
docker compose -f "docker-compose.deployment.yml" up --build -d
31-
```
32-
33-
After successfully run ,Go to http://0.0.0.0:8000/ , to see the list of api services
34-
35-
## Locally
36-
37-
## Setup Guide
38-
3911
#### Prerequisites
4012

4113
- Python version: `3.12` or higher
@@ -48,9 +20,20 @@ After successfully run ,Go to http://0.0.0.0:8000/ , to see the list of api serv
4820
>
4921
> - Postgres (Required)
5022
>
51-
> - Kafka with Zookeeper (Optional)
52-
>
53-
> - Redis (Optional)
23+
> - Kafka with Zookeeper (Required)
24+
25+
#### Setup environment variables
26+
Make new file `.env` using `.env.example` and update the environments before running the below steps:
27+
28+
- **`KAFKA_PREFIX`**: Prefix for Kafka topics.
29+
- **`AGENT_MNEMONIC`**: Seed phrase to generate a wallet.
30+
- **`DOCS_URL`**: Path for swagger docs
31+
- **`KAFKA_ENABLED`**: To enable kafka (Must be enabled by putting value `true` to run the testing agents)
32+
- **`METADATA_BASE_URL`**: Metadata url to fetch metadata of the drep and proposals of different network
33+
- **`DB_SYNC_BASE_URL`**: DbSync url
34+
- **`KAFKA_PREFIX`**: Kafka prefix topic
35+
- **`DATABASE_URL`**: Postgres database url
36+
- **`KAFKA_BROKERS`**: Kafka broker url
5437

5538
<br/>
5639

@@ -65,6 +48,16 @@ After successfully run ,Go to http://0.0.0.0:8000/ , to see the list of api serv
6548
```shell
6649
poetry shell
6750
```
51+
3. Check if your virtual env is created using python of version `3.12` or higher
52+
> **Note:** Your terminal should have something like this `(backend-py3.12) `
53+
- If it is not created using python of version `3.12` or higher then create virtual environment again using command
54+
```shell
55+
poetry env use 3.12
56+
```
57+
- And finally again use command
58+
```shell
59+
poetry shell
60+
```
6861

6962
3. Install Dependencies
7063

@@ -74,27 +67,22 @@ After successfully run ,Go to http://0.0.0.0:8000/ , to see the list of api serv
7467

7568
4. Update the environment variables copying it form `.env.example` to `.env`
7669

70+
7771
5. Run this command for generating the database client and creating the required table mentioned in schema
7872

7973
```shell
8074
prisma generate
8175
prisma migrate dev
8276
```
8377

84-
## Running the Server
85-
86-
Activate Poetry venv inside autonomous-agents-api folder by running the following command.
87-
88-
```bash
89-
poetry shell
90-
```
78+
> **Note**: You should always activate virtual environment by using command `poetry shell` before running below command
9179

9280
Start the server with env variables.
9381

9482
```bash
9583
uvicorn backend.app:get_application --port 8000 --reload --env-file .env
9684
```
9785

98-
Go to http://localhost:8000
86+
Go to http://localhost:8000/api/docs
9987

100-
You would see the list of API available
88+
You would see the list of available API

frontend/README.md

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2-
31
## Getting Started
42

5-
First, run the development server:
3+
First, install the required dependencies for the project using the following command:
4+
5+
```bash
6+
yarn install
7+
```
8+
9+
Once the installation is complete, run one of the commands below to start the development server:
610

711
```bash
812
npm run dev
@@ -14,23 +18,5 @@ pnpm dev
1418
bun dev
1519
```
1620

17-
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18-
19-
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20-
21-
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
22-
23-
## Learn More
24-
25-
To learn more about Next.js, take a look at the following resources:
26-
27-
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28-
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29-
30-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
31-
32-
## Deploy on Vercel
33-
34-
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
21+
Open [http://localhost:3000](http://localhost:3000) in your browser to view the application.
3522

36-
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

0 commit comments

Comments
 (0)