Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 2 additions & 119 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,124 +15,7 @@ The testing process ensures these operations are secure, efficient, and aligned

You can access the deployed service here: [Autonomous Agent Testing](https://agents.cardanoapi.io/)

---

## Running the Stack Locally

### Directory Structure

1. **`api`**: Backend service.
2. **`manager`**: Middleware between agents and the backend; handles various agent-related services.
3. **`agent-node`**: Agent responsible for executing various functions.
4. **`frontend`**: User interface for autonomous agent testing.
5. **`dbsync-api`**: Service for interacting with the dbsync database.
---

### Using Docker

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:
> **Note:** Some variables in `.env.example` are prepopulated. Keep them as it is or change them carefully.

#### Changes to be made in `.env` file

##### API and Manager

- **`KAFKA_PREFIX`**: Prefix for Kafka topics.
- **`AGENT_MNEMONIC`**: Seed phrase to generate a wallet.

##### Agent Manager

- **`KUBER_API_KEY`**: Generate an API key from [KuberIde](https://kuberide.com/kuber/settings/api-keys).
- **`MANAGER_WALLET_ADDRESS`** (Optional): Wallet address with sufficient ADA for transfers.
- **`MANAGER_WALLET_SIGNING_KEY`** (Optional): Signing key for the manager wallet.
- **`FAUCET_API_KEY`** (Optional): API key to load ADA for agent transfers if the manager wallet lacks sufficient funds.
- **`BLOCKFROST_API_KEY`** (Required if `ENABLE_BLOCKFROST_SUBMIT_API` is enabled): Obtain from [Blockfrost](https://blockfrost.io/).

> **Note:** If `ENABLE_BLOCKFROST_SUBMIT_API` is not enabled, transactions will be submitted using `Kuber`, which may take a few minutes.

##### DBSync

- **`DBSYNC_DATABASE_URL`**: URL for the `dbsync-api service`. Default running on `http://localhost:9000` on starting `dbsync-api` service.

##### Docker Network Name

- **`DOCKER_NETWORK_NAME`**: Customize the Docker network name (default value provided in `.env.example`).

##### Agent

- **`AGENT_NODE_DOCKER_IMAGE_NAME`**: Customize the Docker image name for the agent node.

#### Running in `Preprod` or `Preview` Networks

To run in `Preprod` or `Preview` networks, update the following environment variables:

##### Frontend

- **`NEXT_PUBLIC_NETWORK_NAME`**: Set to `preview` or `preprod`.

##### API and Manager

- **`DB_SYNC_BASE_URL`**:
- `https://preprod-dbync.agents.cardanoapi.io/api` for `preprod`
- `https://preview-dbync.agents.cardanoapi.io/api` for `preview`

##### Manager Only

- **`KUBER_BASE_URL`**:
- `https://preview.kuber.cardanoapi.io` for `preview`
- `https://preprod.kuber.cardanoapi.io` for `preprod`
- **`CARDANO_NETWORK_MAGIC`**:
- `3` for `preview`
- `2` for `preprod`
- **`BLOCKFROST_API_KEY`**: Obtain from [Blockfrost](https://blockfrost.io/) for the desired network.
- **`NETWORK_NAME`**: Set to `preprod` or `preview`.

##### DBSync

- **`DBSYNC_DATABASE_URL`**: Update the URL and database name accordingly.
---

#### Starting the Service

Run the following command:

```bash
docker compose -f docker-compose.dev.yml up -d
```

> **Note:** Ensure no applications are running on ports `3000` and `8000`.

#### Finally Running the Agent

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

---

### Local Setup

Each service has its own setup guide within its respective directory.

1. [Backend](api/README.md)
2. [Agent Manager](agent-manager/README.md)
3. [Agent](agent-node/README.md)
4. [Frontend](frontend/README.md)
5. [DbSync-Api](dbsync-api/README.md)

**`Note`**: For running all services locally, dependencies like `Kafka` and `PostgreSQL` can be run via Docker using the following command:
```bash
docker compose -f docker-compose.dev.yml up -d
```

---

## Important

Before committing any changes to the repository, set up the pre-commit hook by running the following command:
## Running Locally

```bash
./install-pre-commit-hook.sh
```
You can find the guide to run the project locally at : [Setup Guide](https://cardanoapi.github.io/autonomous-agents/archietecture_docusaurus/docs/Setup/docker)

6 changes: 6 additions & 0 deletions agent-node/src/functions/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { FunctionContext } from '../executor/BaseFunction'

export function handler(contex: FunctionContext, a: any, b: any) {
console.log('Sum of two value a and b is: ' + Number(a) + Number(b))
return Number(a) + Number(b)
}
14 changes: 0 additions & 14 deletions agent-node/src/service/AgentRpc.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
import { RpcV1 } from 'libcardano/network/Rpc'

// const TransactionType = [
// 'voteOnProposal',
// 'transferADA',
// 'stakeDelegation',
// 'createInfoGovAction',
// 'proposalNewConstitution',
// 'dRepRegistration',
// 'dRepDeRegistration',
// 'registerStake',
// 'abstainDelegation',
// 'noConfidence',
// 'stakeDeRegistration',
// ]

const agentId = process.env.AGENT_ID || ''

const getAgentId = () => agentId
Expand Down
59 changes: 59 additions & 0 deletions docs/docs/Scenario/Preview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
## Scenario Testing and Evidence ( Preview )

Tests were executed at [preview.agents.cardanoapi.io](https://preview.agents.cardanoapi.io) .

## Info Action Proposal Creation

![](../../static/assets/preview/InfoAction-preview.gif)

[ **View on Cexplorer** ](https://preview.cexplorer.io/tx/a16846400f10bb7613825817b11df5aaa9f08a95a867f4b2148b2dfaf34ea554/governance#data)

**Governance Action ID** : a16846400f10bb7613825817b11df5aaa9f08a95a867f4b2148b2dfaf34ea554

## Update Committee Proposal Creation

![](../../static/assets/preview/UpdateCommittee-preview.gif)

[**View on Cexplorer**](https://preview.cexplorer.io/tx/053437d52f50e798b9fe5f6109a463cd36b6c9962cf769e4c0867cda8ab85d20/governance#data)

**Gocernance Action ID** :
053437d52f50e798b9fe5f6109a463cd36b6c9962cf769e4c0867cda8ab85d20

## New Constitution Proposal Creation

![](../../static/assets/preview/NewConstitution-preview.gif)

[**View on Cexplorer**](https://preview.cexplorer.io/tx/6550d7c5c30a7d7a92d89fed803258beece8d1c38df947f31d068a8e81ba9703/governance#data)

**Governance Action ID** : aabc250eb8b83eca86f191fd8491997bbceabb4c2c4c6d6f286cdf27ff999a9d


## Tresury Withdrawal Proposal Creation

![](../../static/assets/preview/TresuryWithdrawal-preview.gif)

[**View on Cexplorer**](https://preview.cexplorer.io/tx/5a79d5e1b80aa0b3c94ed6fc617ad7a333743ce14508ee0b48b6a744bc3ae8f1/governance#data)

**Governance Action ID**: 5a79d5e1b80aa0b3c94ed6fc617ad7a333743ce14508ee0b48b6a744bc3ae8f1

## Direct Agent Voting


![](../../static/assets/preview/DirectVoting-preview.gif)

[**View on Cexplorer**](https://preview.cexplorer.io/tx/b8b8282bd390131d8387adc703250e73cdc5c115904ca94c4870d1ab2a790008/governance#data)

**Transaction Hash** : b8b8282bd390131d8387adc703250e73cdc5c115904ca94c4870d1ab2a790008


## Agent Delagation to Drep

![](../../static/assets/preview/AgentsDelegation-preview.gif)

[**View on Cexplorer**](https://preview.cexplorer.io/tx/d62543eebce8b966c95a891f18077538b013e55c08d08f46af9e4a77a7010dcd/governance#data)

**DRep ID** :
8141d8651e0139b3bfc9c31f76d885431f83957329d75e0e53a65c2a

**Transaction Hash** :
d62543eebce8b966c95a891f18077538b013e55c08d08f46af9e4a77a7010dcd
77 changes: 77 additions & 0 deletions docs/docs/Scenario/SanchoNet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
## Scenario Testing and Evidence ( SanchoNet )

Tests were executed at [agents.cardanoapi.io](https://agents.cardanoapi.io) .

## Info Action Proposal Creation


![](../../static/assets/sanchonet/InfoAction-sanchonet.gif)

**Governance Action ID** : 8dea16c7e047e4a6de60ac928f33ac36ef9755e38d66a6c7f7870ad8b271bda8#0

**Epoch** : 524

## Update Committee Proposal Creation

![](../../static/assets/sanchonet/UpdateCommittee-sanchonet.gif)

**Gocernance Action ID** :
770354b2132cf55f9d7fdede0be186a5f90ccc8238fb2a061a86177b848ea81e

**Epoch** : 525


## New Constitution Proposal Creation

![](../../static/assets/sanchonet/NewConstitution-sanchonet.gif)

**Governance Action ID** :
64397d882477f795cf209b516685e30d52ee1336654198b1e7e963d3da099520#0

**Epoch** : 525

## Tresury Withdrawal Proposal Creation

![](../../static/assets/sanchonet/TresuryWithdrawal-sanchonet.gif)

**Governance Action ID**: 8accd7d79ed6e4f98bc538c2aea8998c0cb03255b23bb5af408d7c3201dc9b44#0

**Epoch** : 525

## Multiple Agents Voting Directly


![](../../static/assets/sanchonet/DirectVoting-sanchonet.gif)

**Transaction Hash**
- 626b64310f0976f4de2fd0bd85ebe481019c6d67d2b83a8d8bebe814c72f2723
- 8c38a0f4625c30ef556d5f1aa3c40a3ba25ba8b26285e2a6fb02a22cd66f6652
- 36eb0f174fb0f58a567bb403d4a365617c7abc3666a480711ac1c47d204eed7e
- 3a383fe969e2210ee843d4f863ec53037e53741a6dc3523c4ffd5074d4a7d357
- 8318450e2bee736c73f0c790b8bf175301ab93745b35be1e988d6f051ac5f100


## Event Based Agents Voting Autonomously

![](../../static/assets/sanchonet/EventBasedVoting-sanchonet.gif)

**Governance Action ID** :
a5ea393f80a88320e457a1e4f5c8ffb4e198efe9ae798458fc13011f222f3a0c#0

**Transaction Hash**
- 976b6de916ecaa6294c8d0876e39f4df30781813bed92952e03fea340eb8ec26
- fc5924655c91c8c0e3468128b5af702f6c83745591ad14d518d3fcee5856d790

## Multiple Agents Delegating to a DRep

![](../../static/assets/sanchonet/AgentsDelegation-sanchonet.gif)

**DRep ID** :
766fea13963a6c27a98d4c48221548cc3e2d10ad7c085c5fb9936dfa

**Transaction Hash** :
- 6970a725bc883ce08beb0240507b6886c60185cbb4ea3627362f62492404a5ed
- 4f4a5130c7285d3585345c5b1f89a6e184889039908b85a6ca5fd714f86ed34b
- dfc3262b717f7bec91cdea749599e31d8250a4552f0887bc9ab85b6d8c19c7f9
- dfc3262b717f7bec91cdea749599e31d8250a4552f0887bc9ab85b6d8c19c7f9
- c2604bccf2b35bbc172bfacf694b7a8b709188d8b427ad198c209f82c4c374ab
36 changes: 36 additions & 0 deletions docs/docs/Scenario/Scenarios.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Scenarios

## Scenarios covered under the scope of CIP 1694

## Proposal Creation

Agents are able to create different proposals and tirgger Governance actions mentioned in the [CIP 1694 ](https://www.1694.io/en). Proposals can be created manually or be configured to be created by the agent periodically.


- **Info Action Proposal** : An action that has no effect on-chain, other than an on-chain record.

- **Motion of No Confidence** : A motion to create a state of no-confidence in the current constitutional committee.

- **New Constitution** : A modification to the Constitution or Guardrails Script, recorded as on-chain hashes

- **Tresaury Withdrawal** : Withdrawas from the Tresaury

- **Update Committee** : Changes to the members of the constitutional committee and/or to its signature threshold and/or terms


## Voting on Proposal

Agents have the ability to participate in various governance actions through voting. They can be configured to vote either based on event occurrences or through direct voting.

- **Event based Proposal voting** : Agents are able to detect new proposals that are created on the network while they are active and autonomously vote on them.

- **Direct Proposal voting** : Agents are also able to directly vote on existing proposals.

<br></br>

# Governance beyond CIP 1694
Beyond the Scenarios of CIP 1694 , Agents are capable of performing other actions on the network, mimicking the behavior of a real user and providing a realistic simulation of on-chain activity.

- **Ada Transfers** : Agents can transfer Ada to other wallet holders in the network, simulating wallet-to-wallet transactions.

- **Drep Management** : Agents can register and deregister as a Drep, as well as manage their stake and delegation status.
Loading
Loading