goat-sdk


Namegoat-sdk JSON
Version 0.1.4 PyPI version JSON
download
home_pagehttps://ohmygoat.dev/
SummaryGoat 🐐 (Great Onchain Agent Toolkit) is an open-source framework for connecting AI agents to any onchain app
upload_time2025-02-12 10:44:01
maintainerNone
docs_urlNone
authorAndrea Villa
requires_python<4.0,>=3.10
licenseNone
keywords goat sdk web3 agents ai
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
<div align="center">

[Website](https://ohmygoat.dev) | [X](https://x.com/goat_sdk) | [Discord](https://discord.gg/goat-sdk)

GOAT is free software, MIT licensed, sponsored by [Crossmint](https://www.crossmint.com)

![NPM Downloads](https://img.shields.io/npm/dm/%40goat-sdk%2Fcore)
![GitHub License](https://img.shields.io/github/license/goat-sdk/goat)

![PyPI - Python Version](https://img.shields.io/pypi/pyversions/goat-sdk)


</div>

# GOAT 🐐  (Python)
![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/goat-sdk)

GOAT (Great Onchain Agent Toolkit) is a library that adds more than +200 onchain tools to your AI agent.

* **[+200 tools](#plugins)**: DeFi (Uniswap, Jupiter, KIM, Orca, etc.), minting (OpenSea, MagicEden, etc.), betting (Polymarket, etc.), analytics (CoinGecko, BirdEye, Allora, etc.) and more
* **Chains**: EVM (Base, Polygon, Mode, Sei, etc.), Solana, Aptos, Chromia, Fuel, Sui, Starknet and Zilliqa
* **[Wallets](#wallets)**: keypair, smart wallets (Crossmint, etc.), LIT, MPC (Coinbase, etc.)
* **[Agent Frameworks](#agent-frameworks-adapters)**: AI SDK, Langchain, Eliza, ZerePy, GAME, ElevenLabs, etc.


## Table of Contens
- [GOAT 🐐  (Python)](#goat---python)
  - [Table of Contens](#table-of-contens)
  - [Installation](#installation)
  - [Usage](#usage)
  - [How to create a plugin](#how-to-create-a-plugin)
    - [Using the Plugin Generator](#using-the-plugin-generator)
    - [Manual Creation](#manual-creation)
      - [1. Define your plugin extending the PluginBase class.](#1-define-your-plugin-extending-the-pluginbase-class)
      - [2. Add tools to the plugin](#2-add-tools-to-the-plugin)
      - [3. Add the plugin to the agent](#3-add-the-plugin-to-the-agent)
      - [Next steps](#next-steps)
  - [How to add a chain](#how-to-add-a-chain)
    - [1. Add the chain to the `chain.py` file](#1-add-the-chain-to-the-chainpy-file)
    - [2. Create a new wallet provider package](#2-create-a-new-wallet-provider-package)
    - [3. Create a plugin to allow sending your native token to a wallet](#3-create-a-plugin-to-allow-sending-your-native-token-to-a-wallet)
    - [4. Implement the wallet client](#4-implement-the-wallet-client)
    - [5. Submit a PR](#5-submit-a-pr)
  - [How to add a wallet provider](#how-to-add-a-wallet-provider)
  - [Packages](#packages)
    - [Core](#core)
    - [Wallets](#wallets)
    - [Agent Framework Adapters](#agent-framework-adapters)
    - [Plugins](#plugins)

## Installation
1. Install the core package
```bash
pip install goat-sdk
```
2. Depending on the type of wallet you want to use, install the corresponding wallet (see all wallets [here](#wallets)):
```bash
pip install goat-sdk-wallet-solana
```
3. Install the plugins for the protocols you need (see all available plugins [here](#plugins))

```bash
pip install goat-sdk-plugin-spl-token
```
4. Install the adapter for the agent framework you want to use (see all available adapters [here](#adapters))
```bash
pip install goat-sdk-adapter-langchain
```

## Usage
1. Configure your wallet
```python
from goat_wallets.solana import solana

# Initialize Solana client and wallet
client = SolanaClient(os.getenv("SOLANA_RPC_ENDPOINT"))
keypair = Keypair.from_base58_string(os.getenv("SOLANA_WALLET_SEED") or "")
wallet = solana(client, keypair)
```

2. Configure your tools for the framework you want to use
```python
# Initialize SPL Token plugin
spl_token_plugin = spl_token(SplTokenPluginOptions(
    network="devnet",  # Using devnet as specified in .env
    tokens=SPL_TOKENS
))

# Initialize tools with Solana wallet
tools = get_on_chain_tools(
    wallet=wallet,
    plugins=[spl_token_plugin]
)
```

3. Plug into your agent framework
```python
agent = create_tool_calling_agent(llm, tools, prompt)
agent_executor = AgentExecutor(
    agent=agent, tools=tools, handle_parsing_errors=True, verbose=True
)

response = agent_executor.invoke(
    {
        "input": "Send 10 USDC to ohmygoat.sol",
    }
)

print(response)
```

## How to create a plugin
GOAT plugins enable your agent to interact with various blockchain protocols. 

Plugins can be chain-specific (EVM, Solana, etc.) or chain-agnostic. If a plugin is chain-specific it will fail to compile when being used with a wallet of a different chain.

You can see all available plugins [here](#plugins).

### Using the Plugin Generator
Run the plugin generator script from the `python` directory:

```bash
cd python
python scripts/create_plugin.py <plugin-name> [--evm]
```

Options:
- `<plugin-name>`: Name of your plugin (e.g., 'my-token', 'my-service')
- `--evm`: Optional flag to indicate if the plugin is EVM-compatible

Examples:
1. Create an EVM-compatible plugin:
```bash
python scripts/create_plugin.py my-token --evm
```

2. Create a chain-agnostic plugin:
```bash
python scripts/create_plugin.py my-service
```

The script generates a complete plugin package with the following structure:

```
src/plugins/<plugin-name>/
├── pyproject.toml          # Project configuration and dependencies
├── README.md              # Plugin documentation
└── goat_plugins/<plugin-name>/
    ├── __init__.py       # Plugin initialization and configuration
    ├── parameters.py     # Pydantic parameter models
    └── service.py        # Service implementation with Tool decorators
```

### Manual Creation
#### 1. Define your plugin extending the [PluginBase](https://github.com/goat-sdk/goat/tree/main/python/src/goat_sdk/goat/classes/plugin_base.py) class.

```python
from goat.classes.plugin_base import PluginBase

# For a chain-agnostic plugin we use the WalletClientBase interface, for a chain-specific plugin we use the EVMWalletClient, SolanaWalletClient, or corresponding interfaces
class MyPlugin(PluginBase[WalletClientBase]):
    def __init__(self):
        # We define the name of the plugin
        super("myPlugin", []);

    # We define the chain support for the plugin, in this case we support all chains
    def supports_chain(self, chain: Chain) -> bool:
        return True

# We export a factory function to create a new instance of the plugin
my_plugin = () => MyPlugin()
```

#### 2. Add tools to the plugin
You can create a class and decorate its methods with the `@Tool` decorator to create tools.

The tool methods will receive the wallet client as the first argument and the parameters as the second argument.

```python
from pydantic import BaseModel, Field

class SignMessageParameters(BaseModel):
    message: str = Field(..., description="The message to sign")

class MyTools {
    @Tool({
        "name": "sign_message",
        "description": "Sign a message",
        "parameters_schema": SignMessageParameters
    })
    async def sign_message(self, walletClient: WalletClientBase, parameters: dict):
        signed = await walletClient.sign_message(parameters.message);
        return signed.signed_message;
    }
```

Once we have our class we now need to import it in our plugin class.

```python
class MyPlugin(PluginBase[WalletClientBase]):
    def __init__(self):
        # We define the name of the plugin
        super("myPlugin", [MyTools()]);

    # We define the chain support for the plugin, in this case we support all chains
    def supports_chain(self, chain: Chain) -> bool:
        return True
}

# We export a factory function to create a new instance of the plugin
my_plugin = () => MyPlugin()
```

Inside the method, we will return an array of tools created using the `createTool` function.

```typescript
import { PluginBase, WalletClientBase, createTool } from "@goat-sdk/core";

// Since we are creating a chain-agnostic plugin, we can use the WalletClientBase interface
export class MyPlugin extends PluginBase<WalletClientBase> {
    constructor() {
        // We define the name of the plugin
        super("myPlugin", []);
    }

    // We define the chain support for the plugin, in this case we support all chains
    supportsChain = (chain: Chain) => true;

    getTools(walletClient: WalletClientBase) {
        return [
            // Create tool requires two arguments:
            // 1. The tool metadata (name, description, parameters)
            // 2. The tool method (the function that will be executed when the tool is used)
            createTool(
                {
                    name: "sign_message",
                    description: "Sign a message",
                    parameters: z.object({
                        message: z.string(),
                    }),
                },
                async (parameters) => {
                    const signed = await walletClient.signMessage(parameters.message);
                    return signed.signedMessage;
                },
            ),
        ];
    }
}

// We export a factory function to create a new instance of the plugin
export const myPlugin = () => new MyPlugin();
```

#### 3. Add the plugin to the agent

```python
tools = get_on_chain_tools(
    wallet=wallet,
    plugins=[my_plugin]
)
```

#### Next steps
- Share your plugin with others!
- Open a PR to add it to the [plugins registry](https://github.com/goat-sdk/goat/tree/main/python/src/plugins) in the [GOAT SDK](https://github.com/goat-sdk/goat).


## How to add a chain

### 1. Add the chain to the `chain.py` file
Add your chain to the `chain.py` file in the [core package](https://github.com/goat-sdk/goat/tree/main/python/src/goat_sdk/goat/types/chain.py).

```python
class MyAwesomeChain(TypedDict):
    """MyAwesomeChain chain type definition
    
    Args:
        type: Literal "my-awesome-chain" chain type identifier
    """
    type: Literal["my-awesome-chain"]

# ... 
Chain = Union[EvmChain, SolanaChain, MyAwesomeChain]    
```

### 2. Create a new wallet provider package
Create a new package in the [wallets directory](https://github.com/goat-sdk/goat/tree/main/python/src/wallets) with the name of your chain (e.g. `my-awesome-chain`) or copy an existing one (e.g. `evm`).
In this package you will define the abstract class for your chain's wallet client which will extend the `WalletClientBase` class defined in the [core package](https://github.com/goat-sdk/goat/tree/main/python/src/goat-sdk/goat/wallets/core.py).

WalletClientBase only includes the methods that are supported by all chains such as:
1. `get_address`
2. `get_chain`
3. `sign_message`
4. `balance_of`

As well as includes the `get_core_tools` method which returns the core tools for the chain.

```python
class MyAwesomeChainWalletClient(WalletClientBase):
    @abstractmethod
    def get_chain(self) -> MyAwesomeChain:
        """Get the EVM chain this wallet is connected to."""
        pass

    @abstractmethod
    def send_transaction(self, transaction: MyAwesomeChainTransaction) -> Dict[str, str]:
        """Send a transaction on the EVM chain."""
        pass

    @abstractmethod
    def read(self, request: MyAwesomeChainReadRequest) -> MyAwesomeChainReadResult:
        """Read data from a smart contract."""
        pass
}
```

### 3. Create a plugin to allow sending your native token to a wallet
Create a plugin to allow sending your native token to a wallet. Create a file in the same package as your wallet client and create a new file like `send<native-token>.py`.

Implement the core plugin.


```python
class SendMYAWESOMETOKENPlugin(PluginBase[MyAwesomeChainWalletClient]):
    def __init__(self):
        super().__init__("sendMYAWESOMETOKEN", [])

    def supports_chain(self, chain: Chain) -> bool:
        return chain["type"] == "my-awesome-chain"

    def get_tools(self, wallet_client: MyAwesomeChainWalletClient) -> List[ToolBase]:
        send_tool = create_tool(
            config={
                "name": f"send_myawesometoken",
                "description": f"Send MYAWESOMETOKEN to an address.",
                "parameters": SendMYAWESOMETOKENParameters,
            },
            execute_fn=lambda params: send_myawesometoken_method(
                wallet_client, cast(Dict[str, str], params)
            ),
        )
        return [send_tool]
```

### 4. Implement the wallet client
Extend your abstract class with the methods you need to implement and create your first wallet client! (e.g `MyAwesomeChainKeyPairWalletClient`)

```python
class MyAwesomeChainKeyPairWalletClient(MyAwesomeChainWalletClient):
    # Implement the methods here
    pass

# Export the wallet client with a factory function
my_awesome_chain_wallet_client = () => MyAwesomeChainKeyPairWalletClient()
```

### 5. Submit a PR
Submit a PR to add your wallet provider to the [wallets directory](https://github.com/goat-sdk/goat/tree/main/typescript/packages/wallets).

## How to add a wallet provider
If you don't see your wallet provider supported, you can easily integrate it by implementing the specific [WalletClient](https://github.com/goat-sdk/goat/blob/main/python/src/wallets) interface for the chain and type of wallet you want to support:

Checkout [here how the web3 client implementation](https://github.com/goat-sdk/goat/tree/main/python/src/wallets/web3).

If you would like to see your wallet provider supported, please open an issue or submit a PR.

## Packages
### Core
|  | PyPI package |
| --- | --- |
| Core | [goat-sdk](https://pypi.org/project/goat-sdk/) |

### Wallets
| Wallet | PyPI package |
| --- | --- |
|EVM | [goat-sdk-wallet-evm](https://pypi.org/project/goat-sdk-wallet-evm/) |
| Web3 | [goat-sdk-wallet-web3](https://pypi.org/project/goat-sdk-wallet-web3/) |
| Solana | [goat-sdk-wallet-solana](https://pypi.org/project/goat-sdk-wallet-solana/) |

### Agent Framework Adapters
| Adapter | PyPI package |
| --- | --- |
| Langchain | [goat-sdk-adapter-langchain](https://pypi.org/project/goat-sdk-adapter-langchain/) |

**ZerePy and GAME have direct integrations on their respective repos.*

### Plugins
| Plugin | Tools | PyPI package |
| --- | --- | --- |
| 1inch | Get wallet balances using 1inch API | [goat-sdk-plugin-1inch](https://pypi.org/project/goat-sdk-plugin-1inch/) |
| Allora | Get price predictions using Allora API | [goat-sdk-plugin-allora](https://pypi.org/project/goat-sdk-plugin-allora/) |
| CoinGecko | Get coin information using CoinGecko API | [goat-sdk-plugin-coingecko](https://pypi.org/project/goat-sdk-plugin-coingecko/) |
| Dexscreener | Get token information using Dexscreener API | [goat-sdk-plugin-dexscreener](https://pypi.org/project/goat-sdk-plugin-dexscreener/) |
| ERC20 | Interact with any ERC20 token | [goat-sdk-plugin-erc20](https://pypi.org/project/goat-sdk-plugin-erc20/) |
| Farcaster | Read and post casts on Farcaster | [goat-sdk-plugin-farcaster](https://pypi.org/project/goat-sdk-plugin-farcaster/) |
| JSON RPC | Call any JSON RPC endpoint |[goat-sdk-plugin-json-rpc](https://pypi.org/project/goat-sdk-plugin-json-rpc/) |  |
| Jupiter | Get price predictions using Jupiter API | [goat-sdk-plugin-jupiter](https://pypi.org/project/goat-sdk-plugin-jupiter/) |  |
| Nansen | Get wallet insights using Nansen API | [goat-sdk-plugin-nansen](https://pypi.org/project/goat-sdk-plugin-nansen/) |  |
| OpenSea | Get NFT and sales data from OpenSea | [goat-sdk-plugin-opensea](https://pypi.org/project/goat-sdk-plugin-opensea/) |  |
| Rugcheck | Check if tokens are legit with Rugcheck | [goat-sdk-plugin-rugcheck](https://pypi.org/project/goat-sdk-plugin-rugcheck/) |  |
| SPL Tokens | Interact with SPL tokens | [goat-sdk-plugin-spl-token](https://pypi.org/project/goat-sdk-plugin-spl-token/) |  |
| Superfluid | Create streams with Superfluid | [goat-sdk-plugin-superfluid](https://pypi.org/project/goat-sdk-plugin-superfluid/) |  |
| Uniswap | Get quotes and swap on Uniswap | [goat-sdk-plugin-uniswap](https://pypi.org/project/goat-sdk-plugin-uniswap/) |  |

            

Raw data

            {
    "_id": null,
    "home_page": "https://ohmygoat.dev/",
    "name": "goat-sdk",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "goat, sdk, web3, agents, ai",
    "author": "Andrea Villa",
    "author_email": "andreakarimodm@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/a4/39/3a285cd182d22ea776d2129d3eaaafeb4c58dd8139789507e44fdf88966f/goat_sdk-0.1.4.tar.gz",
    "platform": null,
    "description": "\n<div align=\"center\">\n\n[Website](https://ohmygoat.dev) | [X](https://x.com/goat_sdk) | [Discord](https://discord.gg/goat-sdk)\n\nGOAT is free software, MIT licensed, sponsored by [Crossmint](https://www.crossmint.com)\n\n![NPM Downloads](https://img.shields.io/npm/dm/%40goat-sdk%2Fcore)\n![GitHub License](https://img.shields.io/github/license/goat-sdk/goat)\n\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/goat-sdk)\n\n\n</div>\n\n# GOAT \ud83d\udc10  (Python)\n![X (formerly Twitter) Follow](https://img.shields.io/twitter/follow/goat-sdk)\n\nGOAT (Great Onchain Agent Toolkit) is a library that adds more than +200 onchain tools to your AI agent.\n\n* **[+200 tools](#plugins)**: DeFi (Uniswap, Jupiter, KIM, Orca, etc.), minting (OpenSea, MagicEden, etc.), betting (Polymarket, etc.), analytics (CoinGecko, BirdEye, Allora, etc.) and more\n* **Chains**: EVM (Base, Polygon, Mode, Sei, etc.), Solana, Aptos, Chromia, Fuel, Sui, Starknet and Zilliqa\n* **[Wallets](#wallets)**: keypair, smart wallets (Crossmint, etc.), LIT, MPC (Coinbase, etc.)\n* **[Agent Frameworks](#agent-frameworks-adapters)**: AI SDK, Langchain, Eliza, ZerePy, GAME, ElevenLabs, etc.\n\n\n## Table of Contens\n- [GOAT \ud83d\udc10  (Python)](#goat---python)\n  - [Table of Contens](#table-of-contens)\n  - [Installation](#installation)\n  - [Usage](#usage)\n  - [How to create a plugin](#how-to-create-a-plugin)\n    - [Using the Plugin Generator](#using-the-plugin-generator)\n    - [Manual Creation](#manual-creation)\n      - [1. Define your plugin extending the PluginBase class.](#1-define-your-plugin-extending-the-pluginbase-class)\n      - [2. Add tools to the plugin](#2-add-tools-to-the-plugin)\n      - [3. Add the plugin to the agent](#3-add-the-plugin-to-the-agent)\n      - [Next steps](#next-steps)\n  - [How to add a chain](#how-to-add-a-chain)\n    - [1. Add the chain to the `chain.py` file](#1-add-the-chain-to-the-chainpy-file)\n    - [2. Create a new wallet provider package](#2-create-a-new-wallet-provider-package)\n    - [3. Create a plugin to allow sending your native token to a wallet](#3-create-a-plugin-to-allow-sending-your-native-token-to-a-wallet)\n    - [4. Implement the wallet client](#4-implement-the-wallet-client)\n    - [5. Submit a PR](#5-submit-a-pr)\n  - [How to add a wallet provider](#how-to-add-a-wallet-provider)\n  - [Packages](#packages)\n    - [Core](#core)\n    - [Wallets](#wallets)\n    - [Agent Framework Adapters](#agent-framework-adapters)\n    - [Plugins](#plugins)\n\n## Installation\n1. Install the core package\n```bash\npip install goat-sdk\n```\n2. Depending on the type of wallet you want to use, install the corresponding wallet (see all wallets [here](#wallets)):\n```bash\npip install goat-sdk-wallet-solana\n```\n3. Install the plugins for the protocols you need (see all available plugins [here](#plugins))\n\n```bash\npip install goat-sdk-plugin-spl-token\n```\n4. Install the adapter for the agent framework you want to use (see all available adapters [here](#adapters))\n```bash\npip install goat-sdk-adapter-langchain\n```\n\n## Usage\n1. Configure your wallet\n```python\nfrom goat_wallets.solana import solana\n\n# Initialize Solana client and wallet\nclient = SolanaClient(os.getenv(\"SOLANA_RPC_ENDPOINT\"))\nkeypair = Keypair.from_base58_string(os.getenv(\"SOLANA_WALLET_SEED\") or \"\")\nwallet = solana(client, keypair)\n```\n\n2. Configure your tools for the framework you want to use\n```python\n# Initialize SPL Token plugin\nspl_token_plugin = spl_token(SplTokenPluginOptions(\n    network=\"devnet\",  # Using devnet as specified in .env\n    tokens=SPL_TOKENS\n))\n\n# Initialize tools with Solana wallet\ntools = get_on_chain_tools(\n    wallet=wallet,\n    plugins=[spl_token_plugin]\n)\n```\n\n3. Plug into your agent framework\n```python\nagent = create_tool_calling_agent(llm, tools, prompt)\nagent_executor = AgentExecutor(\n    agent=agent, tools=tools, handle_parsing_errors=True, verbose=True\n)\n\nresponse = agent_executor.invoke(\n    {\n        \"input\": \"Send 10 USDC to ohmygoat.sol\",\n    }\n)\n\nprint(response)\n```\n\n## How to create a plugin\nGOAT plugins enable your agent to interact with various blockchain protocols. \n\nPlugins can be chain-specific (EVM, Solana, etc.) or chain-agnostic. If a plugin is chain-specific it will fail to compile when being used with a wallet of a different chain.\n\nYou can see all available plugins [here](#plugins).\n\n### Using the Plugin Generator\nRun the plugin generator script from the `python` directory:\n\n```bash\ncd python\npython scripts/create_plugin.py <plugin-name> [--evm]\n```\n\nOptions:\n- `<plugin-name>`: Name of your plugin (e.g., 'my-token', 'my-service')\n- `--evm`: Optional flag to indicate if the plugin is EVM-compatible\n\nExamples:\n1. Create an EVM-compatible plugin:\n```bash\npython scripts/create_plugin.py my-token --evm\n```\n\n2. Create a chain-agnostic plugin:\n```bash\npython scripts/create_plugin.py my-service\n```\n\nThe script generates a complete plugin package with the following structure:\n\n```\nsrc/plugins/<plugin-name>/\n\u251c\u2500\u2500 pyproject.toml          # Project configuration and dependencies\n\u251c\u2500\u2500 README.md              # Plugin documentation\n\u2514\u2500\u2500 goat_plugins/<plugin-name>/\n    \u251c\u2500\u2500 __init__.py       # Plugin initialization and configuration\n    \u251c\u2500\u2500 parameters.py     # Pydantic parameter models\n    \u2514\u2500\u2500 service.py        # Service implementation with Tool decorators\n```\n\n### Manual Creation\n#### 1. Define your plugin extending the [PluginBase](https://github.com/goat-sdk/goat/tree/main/python/src/goat_sdk/goat/classes/plugin_base.py) class.\n\n```python\nfrom goat.classes.plugin_base import PluginBase\n\n# For a chain-agnostic plugin we use the WalletClientBase interface, for a chain-specific plugin we use the EVMWalletClient, SolanaWalletClient, or corresponding interfaces\nclass MyPlugin(PluginBase[WalletClientBase]):\n    def __init__(self):\n        # We define the name of the plugin\n        super(\"myPlugin\", []);\n\n    # We define the chain support for the plugin, in this case we support all chains\n    def supports_chain(self, chain: Chain) -> bool:\n        return True\n\n# We export a factory function to create a new instance of the plugin\nmy_plugin = () => MyPlugin()\n```\n\n#### 2. Add tools to the plugin\nYou can create a class and decorate its methods with the `@Tool` decorator to create tools.\n\nThe tool methods will receive the wallet client as the first argument and the parameters as the second argument.\n\n```python\nfrom pydantic import BaseModel, Field\n\nclass SignMessageParameters(BaseModel):\n    message: str = Field(..., description=\"The message to sign\")\n\nclass MyTools {\n    @Tool({\n        \"name\": \"sign_message\",\n        \"description\": \"Sign a message\",\n        \"parameters_schema\": SignMessageParameters\n    })\n    async def sign_message(self, walletClient: WalletClientBase, parameters: dict):\n        signed = await walletClient.sign_message(parameters.message);\n        return signed.signed_message;\n    }\n```\n\nOnce we have our class we now need to import it in our plugin class.\n\n```python\nclass MyPlugin(PluginBase[WalletClientBase]):\n    def __init__(self):\n        # We define the name of the plugin\n        super(\"myPlugin\", [MyTools()]);\n\n    # We define the chain support for the plugin, in this case we support all chains\n    def supports_chain(self, chain: Chain) -> bool:\n        return True\n}\n\n# We export a factory function to create a new instance of the plugin\nmy_plugin = () => MyPlugin()\n```\n\nInside the method, we will return an array of tools created using the `createTool` function.\n\n```typescript\nimport { PluginBase, WalletClientBase, createTool } from \"@goat-sdk/core\";\n\n// Since we are creating a chain-agnostic plugin, we can use the WalletClientBase interface\nexport class MyPlugin extends PluginBase<WalletClientBase> {\n    constructor() {\n        // We define the name of the plugin\n        super(\"myPlugin\", []);\n    }\n\n    // We define the chain support for the plugin, in this case we support all chains\n    supportsChain = (chain: Chain) => true;\n\n    getTools(walletClient: WalletClientBase) {\n        return [\n            // Create tool requires two arguments:\n            // 1. The tool metadata (name, description, parameters)\n            // 2. The tool method (the function that will be executed when the tool is used)\n            createTool(\n                {\n                    name: \"sign_message\",\n                    description: \"Sign a message\",\n                    parameters: z.object({\n                        message: z.string(),\n                    }),\n                },\n                async (parameters) => {\n                    const signed = await walletClient.signMessage(parameters.message);\n                    return signed.signedMessage;\n                },\n            ),\n        ];\n    }\n}\n\n// We export a factory function to create a new instance of the plugin\nexport const myPlugin = () => new MyPlugin();\n```\n\n#### 3. Add the plugin to the agent\n\n```python\ntools = get_on_chain_tools(\n    wallet=wallet,\n    plugins=[my_plugin]\n)\n```\n\n#### Next steps\n- Share your plugin with others!\n- Open a PR to add it to the [plugins registry](https://github.com/goat-sdk/goat/tree/main/python/src/plugins) in the [GOAT SDK](https://github.com/goat-sdk/goat).\n\n\n## How to add a chain\n\n### 1. Add the chain to the `chain.py` file\nAdd your chain to the `chain.py` file in the [core package](https://github.com/goat-sdk/goat/tree/main/python/src/goat_sdk/goat/types/chain.py).\n\n```python\nclass MyAwesomeChain(TypedDict):\n    \"\"\"MyAwesomeChain chain type definition\n    \n    Args:\n        type: Literal \"my-awesome-chain\" chain type identifier\n    \"\"\"\n    type: Literal[\"my-awesome-chain\"]\n\n# ... \nChain = Union[EvmChain, SolanaChain, MyAwesomeChain]    \n```\n\n### 2. Create a new wallet provider package\nCreate a new package in the [wallets directory](https://github.com/goat-sdk/goat/tree/main/python/src/wallets) with the name of your chain (e.g. `my-awesome-chain`) or copy an existing one (e.g. `evm`).\nIn this package you will define the abstract class for your chain's wallet client which will extend the `WalletClientBase` class defined in the [core package](https://github.com/goat-sdk/goat/tree/main/python/src/goat-sdk/goat/wallets/core.py).\n\nWalletClientBase only includes the methods that are supported by all chains such as:\n1. `get_address`\n2. `get_chain`\n3. `sign_message`\n4. `balance_of`\n\nAs well as includes the `get_core_tools` method which returns the core tools for the chain.\n\n```python\nclass MyAwesomeChainWalletClient(WalletClientBase):\n    @abstractmethod\n    def get_chain(self) -> MyAwesomeChain:\n        \"\"\"Get the EVM chain this wallet is connected to.\"\"\"\n        pass\n\n    @abstractmethod\n    def send_transaction(self, transaction: MyAwesomeChainTransaction) -> Dict[str, str]:\n        \"\"\"Send a transaction on the EVM chain.\"\"\"\n        pass\n\n    @abstractmethod\n    def read(self, request: MyAwesomeChainReadRequest) -> MyAwesomeChainReadResult:\n        \"\"\"Read data from a smart contract.\"\"\"\n        pass\n}\n```\n\n### 3. Create a plugin to allow sending your native token to a wallet\nCreate a plugin to allow sending your native token to a wallet. Create a file in the same package as your wallet client and create a new file like `send<native-token>.py`.\n\nImplement the core plugin.\n\n\n```python\nclass SendMYAWESOMETOKENPlugin(PluginBase[MyAwesomeChainWalletClient]):\n    def __init__(self):\n        super().__init__(\"sendMYAWESOMETOKEN\", [])\n\n    def supports_chain(self, chain: Chain) -> bool:\n        return chain[\"type\"] == \"my-awesome-chain\"\n\n    def get_tools(self, wallet_client: MyAwesomeChainWalletClient) -> List[ToolBase]:\n        send_tool = create_tool(\n            config={\n                \"name\": f\"send_myawesometoken\",\n                \"description\": f\"Send MYAWESOMETOKEN to an address.\",\n                \"parameters\": SendMYAWESOMETOKENParameters,\n            },\n            execute_fn=lambda params: send_myawesometoken_method(\n                wallet_client, cast(Dict[str, str], params)\n            ),\n        )\n        return [send_tool]\n```\n\n### 4. Implement the wallet client\nExtend your abstract class with the methods you need to implement and create your first wallet client! (e.g `MyAwesomeChainKeyPairWalletClient`)\n\n```python\nclass MyAwesomeChainKeyPairWalletClient(MyAwesomeChainWalletClient):\n    # Implement the methods here\n    pass\n\n# Export the wallet client with a factory function\nmy_awesome_chain_wallet_client = () => MyAwesomeChainKeyPairWalletClient()\n```\n\n### 5. Submit a PR\nSubmit a PR to add your wallet provider to the [wallets directory](https://github.com/goat-sdk/goat/tree/main/typescript/packages/wallets).\n\n## How to add a wallet provider\nIf you don't see your wallet provider supported, you can easily integrate it by implementing the specific [WalletClient](https://github.com/goat-sdk/goat/blob/main/python/src/wallets) interface for the chain and type of wallet you want to support:\n\nCheckout [here how the web3 client implementation](https://github.com/goat-sdk/goat/tree/main/python/src/wallets/web3).\n\nIf you would like to see your wallet provider supported, please open an issue or submit a PR.\n\n## Packages\n### Core\n|  | PyPI package |\n| --- | --- |\n| Core | [goat-sdk](https://pypi.org/project/goat-sdk/) |\n\n### Wallets\n| Wallet | PyPI package |\n| --- | --- |\n|EVM | [goat-sdk-wallet-evm](https://pypi.org/project/goat-sdk-wallet-evm/) |\n| Web3 | [goat-sdk-wallet-web3](https://pypi.org/project/goat-sdk-wallet-web3/) |\n| Solana | [goat-sdk-wallet-solana](https://pypi.org/project/goat-sdk-wallet-solana/) |\n\n### Agent Framework Adapters\n| Adapter | PyPI package |\n| --- | --- |\n| Langchain | [goat-sdk-adapter-langchain](https://pypi.org/project/goat-sdk-adapter-langchain/) |\n\n**ZerePy and GAME have direct integrations on their respective repos.*\n\n### Plugins\n| Plugin | Tools | PyPI package |\n| --- | --- | --- |\n| 1inch | Get wallet balances using 1inch API | [goat-sdk-plugin-1inch](https://pypi.org/project/goat-sdk-plugin-1inch/) |\n| Allora | Get price predictions using Allora API | [goat-sdk-plugin-allora](https://pypi.org/project/goat-sdk-plugin-allora/) |\n| CoinGecko | Get coin information using CoinGecko API | [goat-sdk-plugin-coingecko](https://pypi.org/project/goat-sdk-plugin-coingecko/) |\n| Dexscreener | Get token information using Dexscreener API | [goat-sdk-plugin-dexscreener](https://pypi.org/project/goat-sdk-plugin-dexscreener/) |\n| ERC20 | Interact with any ERC20 token | [goat-sdk-plugin-erc20](https://pypi.org/project/goat-sdk-plugin-erc20/) |\n| Farcaster | Read and post casts on Farcaster | [goat-sdk-plugin-farcaster](https://pypi.org/project/goat-sdk-plugin-farcaster/) |\n| JSON RPC | Call any JSON RPC endpoint |[goat-sdk-plugin-json-rpc](https://pypi.org/project/goat-sdk-plugin-json-rpc/) |  |\n| Jupiter | Get price predictions using Jupiter API | [goat-sdk-plugin-jupiter](https://pypi.org/project/goat-sdk-plugin-jupiter/) |  |\n| Nansen | Get wallet insights using Nansen API | [goat-sdk-plugin-nansen](https://pypi.org/project/goat-sdk-plugin-nansen/) |  |\n| OpenSea | Get NFT and sales data from OpenSea | [goat-sdk-plugin-opensea](https://pypi.org/project/goat-sdk-plugin-opensea/) |  |\n| Rugcheck | Check if tokens are legit with Rugcheck | [goat-sdk-plugin-rugcheck](https://pypi.org/project/goat-sdk-plugin-rugcheck/) |  |\n| SPL Tokens | Interact with SPL tokens | [goat-sdk-plugin-spl-token](https://pypi.org/project/goat-sdk-plugin-spl-token/) |  |\n| Superfluid | Create streams with Superfluid | [goat-sdk-plugin-superfluid](https://pypi.org/project/goat-sdk-plugin-superfluid/) |  |\n| Uniswap | Get quotes and swap on Uniswap | [goat-sdk-plugin-uniswap](https://pypi.org/project/goat-sdk-plugin-uniswap/) |  |\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Goat \ud83d\udc10 (Great Onchain Agent Toolkit) is an open-source framework for connecting AI agents to any onchain app",
    "version": "0.1.4",
    "project_urls": {
        "Bug Tracker": "https://github.com/goat-sdk/goat/issues",
        "Homepage": "https://ohmygoat.dev/",
        "Repository": "https://github.com/goat-sdk/goat"
    },
    "split_keywords": [
        "goat",
        " sdk",
        " web3",
        " agents",
        " ai"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c68747e170c0faba3c7b971df2e3db5e8eadfaf4d384fafdf91ac7de9721e4ea",
                "md5": "ceadafddd6cb3f3dfa32c32f15d28ed0",
                "sha256": "ce965c96537b96dc05a1c904ff09fcfe5c1ce792e1cf23d77b4050135c91f3e5"
            },
            "downloads": -1,
            "filename": "goat_sdk-0.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ceadafddd6cb3f3dfa32c32f15d28ed0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 12931,
            "upload_time": "2025-02-12T10:43:59",
            "upload_time_iso_8601": "2025-02-12T10:43:59.669367Z",
            "url": "https://files.pythonhosted.org/packages/c6/87/47e170c0faba3c7b971df2e3db5e8eadfaf4d384fafdf91ac7de9721e4ea/goat_sdk-0.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a4393a285cd182d22ea776d2129d3eaaafeb4c58dd8139789507e44fdf88966f",
                "md5": "cc87d39da55f60b6a7f77e91978d8e3b",
                "sha256": "7a48d3d4b21a3299ce04afed4c137b0993b3ba2d13297ed79407a13d50196af8"
            },
            "downloads": -1,
            "filename": "goat_sdk-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "cc87d39da55f60b6a7f77e91978d8e3b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 15133,
            "upload_time": "2025-02-12T10:44:01",
            "upload_time_iso_8601": "2025-02-12T10:44:01.815180Z",
            "url": "https://files.pythonhosted.org/packages/a4/39/3a285cd182d22ea776d2129d3eaaafeb4c58dd8139789507e44fdf88966f/goat_sdk-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-12 10:44:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "goat-sdk",
    "github_project": "goat",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "goat-sdk"
}
        
Elapsed time: 0.46363s