Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GOAT connection: enable infinite on-chain actions #75

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

karimodm
Copy link

@karimodm karimodm commented Jan 10, 2025

What does this PR do?

GOAT is an open-source framework for connecting AI agents to any onchain app.

This PR integrates GOAT tools into ZerePy framework through a configurable and stateful connection implementation.
It would not be possible to maintain a proper state by implementing all the GOAT actions via the @register_action decorators.

The connection supports every plugin supported by GOAT by using runtime module discovery & importing, all the plugins can be declared for use in the agent json configuration, as per all the other connection types.
Using Goat’s plugin system, developers can enable agents to:

  • Manage onchain wallets
  • ERC20 tokens transactions
  • ...
    All with just a single line of code.

The framework supports multichain functionality by either:

  • Defining actions for a specific set of chains
  • Dynamically selecting chains per action

Plugin configuration to support Coingecko & ERC20 tokens:

    {
      "name": "goat",
      "plugins": [
        {
          "name": "coingecko",
          "args": {
            "api_key": "YOUR_API_KEY"
          }
        },
        {
          "name": "erc20",
          "args": {
            "tokens": ["goat_plugins.erc20.token.PEPE", "goat_plugins.erc20.token.USDC"]
          }
        }
      ]
    }

Connection configuration

ZerePy-CLI (ExampleAgent) > configure-connection goat
Starting GOAT configuration setup
GOAT API is already configured
Do you want to reconfigure? (y/n): y

🔗 GOAT CONFIGURATION SETUP

📝 You will need:
1. An RPC provider URL (e.g. from Infura, Alchemy, or your own node)
2. A wallet private key for signing transactions

⚠️ IMPORTANT: Never share your private key with anyone!
--------------------------------------------------------------------

Please enter your credentials:
Enter your RPC provider URL: https://eth-sepolia.g.alchemy.com/v2/o9sfe*********
Enter your wallet private key (will be stored in .env): 0x*****************

Testing

At the moment, the main agent loop doesn't support "agentic" choice of actions in a continous feed-decision-action loop.
It has been tested though, that, once the connection gets properly configured, all the actions are wrapped according to ZerePy requirements:

                    self.connection_manager.connections["goat"].perform_action(
                        "get_balance",
                        address="0xE0be57630b8B2944243b13E8A96451f8Ae653fa3",
                    )

{'value': '0.02835722115674725', 'decimals': 18, 'symbol': 'ETH', 'name': 'Ether', 'in_base_units': '28357221156747250'}
special variables
function variables
'value' =
'0.02835722115674725'
'decimals' =
18
'symbol' =
'ETH'
'name' =
'Ether'
'in_base_units' =
'28357221156747250'
len() =
5

@ayoubed it would be awesome to complement the amazing work you have done with some agentic flow!

@rux-eth
Copy link
Collaborator

rux-eth commented Jan 10, 2025

hello karimodm and welcome! I was wondering if you have a twitter account or telegram so i can message you? I have some questions. Regardless, thank you for your input and PR!

@karimodm
Copy link
Author

@rux-eth reach out Telegram https://t.me/elandreo

@ayoubed
Copy link
Collaborator

ayoubed commented Jan 10, 2025

Amazing, thanks @karimodm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants