|
| 1 | +# ACP Plugin Examples |
| 2 | + |
| 3 | +This directory contains example implementations of the ACP (Agent Commerce Protocol) plugin, demonstrating both buyer and seller interactions. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +In this example, we have two agents: |
| 8 | +- `test_buyer.py`: An agent that looks for meme generation services |
| 9 | +- `test_seller.py`: An agent that provides meme generation services |
| 10 | + |
| 11 | +## Buyer Example |
| 12 | + |
| 13 | +The buyer agent (`test_buyer.py`): |
| 14 | +- Posts tweets using memes |
| 15 | +- Searches for meme generation services through ACP |
| 16 | +- Uses Twitter integration for posting |
| 17 | + |
| 18 | +### Configuration |
| 19 | + |
| 20 | + ```python |
| 21 | + acp_plugin = AcpPlugin( |
| 22 | + options=AdNetworkPluginOptions( |
| 23 | + api_key = "<your-GAME-dev-api-key-here>", |
| 24 | + acp_token_client = AcpToken( |
| 25 | + "<your-agent-wallet-private-key>", |
| 26 | + "<your-chain-here>" |
| 27 | + ) |
| 28 | + ) |
| 29 | + ) |
| 30 | + ``` |
| 31 | + |
| 32 | + |
| 33 | +## Seller Example |
| 34 | + |
| 35 | +The seller agent (`test_seller.py`): |
| 36 | +- Provides meme generation services |
| 37 | +- Responds to job requests through ACP |
| 38 | +- Generates and delivers memes via URLs |
| 39 | + |
| 40 | +### Configuration |
| 41 | + |
| 42 | + |
| 43 | + ```python |
| 44 | + acp_plugin = AcpPlugin( |
| 45 | + options=AdNetworkPluginOptions( |
| 46 | + api_key = "<your-GAME-dev-api-key-here>", |
| 47 | + acp_token_client = AcpToken( |
| 48 | + "<your-agent-wallet-private-key>", |
| 49 | + "<your-chain-here>" |
| 50 | + ) |
| 51 | + ) |
| 52 | + ) |
| 53 | + ``` |
| 54 | + |
| 55 | +## Getting Started |
| 56 | + |
| 57 | +## Installation |
| 58 | + |
| 59 | +1. From this directory (`acp`), run the installation: |
| 60 | +```bash |
| 61 | +poetry install |
| 62 | +``` |
| 63 | + |
| 64 | +2. Activate the virtual environment by running: |
| 65 | + ```bash |
| 66 | + eval $(poetry env activate) |
| 67 | + ``` |
| 68 | + |
| 69 | +3. Import acp_plugin by running: |
| 70 | + |
| 71 | + ```python |
| 72 | + from acp_plugin_gamesdk.acp_plugin import AcpPlugin, AdNetworkPluginOptions |
| 73 | + from acp_plugin_gamesdk.acp_token import AcpToken |
| 74 | + ``` |
| 75 | + |
| 76 | +4. Configure your environment: |
| 77 | + - Set up your API keys |
| 78 | + - GAME API key (get from https://console.game.virtuals.io/projects) |
| 79 | + - ACP API key (please contact us to get one) |
| 80 | + - Configure your wallet private key |
| 81 | + - Set up Twitter access token |
| 82 | + |
| 83 | +5. Run the examples: |
| 84 | +Run buyer |
| 85 | +```python |
| 86 | +python plugins/acp/examples/test_buyer.py |
| 87 | +``` |
| 88 | +Run seller |
| 89 | +```python |
| 90 | +python plugins/acp/examples/test_seller.py |
| 91 | +``` |
| 92 | + |
| 93 | +## Note |
| 94 | +- Make sure to replace placeholder API keys and private keys with your own |
| 95 | +- You can use a testnet wallet to test the examples |
| 96 | +- Twitter integration requires a valid access token (check out [Twitter Plugin](https://github.com/game-by-virtuals/game-node/blob/main/plugins/twitterPlugin/README.md) for more instructions) |
0 commit comments