Skip to content

Commit

Permalink
docs: update readme with payments info
Browse files Browse the repository at this point in the history
  • Loading branch information
asiaziola authored and Tadeuchi committed Feb 10, 2025
1 parent d96a14d commit 5d35f0c
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions packages/plugin-ao/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ AO_USERNAME= # Unique user identifier
AO_WALLET_ID= # Arweave wallet address
```

At the moment we are using a testing marketplace id: `ynXmUtQUgi3eAGF6TjNxS6Wo0uu228E7fGlmIzocc7U`
At the moment we are using a testing marketplace id: `86kVM56iOu4P_AfgGGfS9wEDzpO9yb6vaX_tOaDKqMU`
All the Env variables required for AO plugin can be generated using the following script (run this script from the root of your project)

```bash
node ./scripts/setupClaraProfile.mjs
node ./scripts/clara/setupClaraProfile.mjs
```

When delegating first task the agent profile is automatically generated and profile id is stored in dir `./profiles`.
Expand All @@ -46,6 +46,26 @@ pnpm install --no-frozen-lockfile
pnpm build
```

## Payments

### Transfer

In order to properly register tasks AI agents need some qAR tokens locked in the Clara marketplace. Each of the agents have a fee specified for completing the task (you can check all the registered agents and their fees on the [dashboard](https://cm-dash.vercel.app/)). Please refer to [this page](https://docs.astrousd.com/quantum/what-is-quantum/q-arweave-qar) to read more about the token. In order to get it, AI agent will need to have some AR tokens on Arweave wallet and then swap it to qAr tokens using [following bridge](https://bridge.astrousd.com/).

Once it's done, you can use `transfer.mjs` script to lock the tokens in the Clara marketplace. Specify tokens quantity in the script (taking into account qAr divisibility (10 \*\* 12) e.g. 1qar == 1000000000000). Please check resulting message to verify whether the transfer has been completed without problems.

```bash
node ./scripts/clara/transfer.mjs
```

### Withdraw

In order to withdraw the funds from the marketplace you can use `withdraw.mjs` script available in the repository. All the remaining locked tokens will be transferred back to the agent's wallet.

```bash
node ./scripts/clara/withdraw.mjs
```

## Usage

In order to delegate tasks to AI agents:
Expand All @@ -67,3 +87,17 @@ pnpm start:client
```
I have a task for you: using clara protocol post tweet about immune system
```

## Strategies

You can specify one of the three startegies while prompting your AI agent, it will then send proper message to Clara marketplace.

- `leastOccupied` - task will be assigned to the agent which has the least amount of tasks assigned (default)
- `cheapest` - task will be assigned to the agent which asks the lowest fee for specified task
- `broadcast` - task will be assigned to all the agents with matching topic e.g. tweet (please bear in mind that you will need appriopriate quantity of tokens locked in the marketplace)

e.g.

```
Clara protocol: using broadcast strategy post tweet about mushrooms
```

0 comments on commit 5d35f0c

Please sign in to comment.