Goat adapter for CrewAI
Project description
CrewAI Adapter for GOAT
Integrate the more than +200 onchain tools of GOAT with CrewAI, a framework for orchestrating role-playing, autonomous AI agents.
Installation
poetry add goat-sdk-adapter-crewai
Usage
See a full working example here.
# --- Setup GOAT Wallet and Plugins (Example: Solana + SPL Token) ---
import os
from dotenv import load_dotenv
from solders.keypair import Keypair
from solana.rpc.api import Client as SolanaClient
from goat_plugins.spl_token import spl_token, SplTokenPluginOptions
from goat_plugins.spl_token.tokens import SPL_TOKENS
from goat_wallets.solana import solana
load_dotenv()
solana_rpc_endpoint = os.getenv("SOLANA_RPC_ENDPOINT")
solana_wallet_seed = os.getenv("SOLANA_WALLET_SEED")
# Make sure environment variables are set
if not solana_rpc_endpoint or not solana_wallet_seed:
raise ValueError("SOLANA_RPC_ENDPOINT and SOLANA_WALLET_SEED must be set in .env")
client = SolanaClient(solana_rpc_endpoint)
keypair = Keypair.from_base58_string(solana_wallet_seed)
wallet = solana(client, keypair)
spl_token_plugin = spl_token(SplTokenPluginOptions(
network="mainnet",
tokens=SPL_TOKENS
))
# --- Import CrewAI and the GOAT Adapter ---
from crewai import Agent, Task, Crew, Process
from goat_adapters.crewai.adapter import get_crewai_tools
# --- Generate CrewAI Tools from GOAT ---
goat_crewai_tools = get_crewai_tools(
wallet=wallet,
plugins=[spl_token_plugin]
)
# --- Define CrewAI Agent using GOAT Tools ---
# Ensure OPENAI_API_KEY is set in the environment for CrewAI's default LLM
if not os.getenv("OPENAI_API_KEY"):
raise ValueError("OPENAI_API_KEY must be set in .env for CrewAI")
crypto_analyst = Agent(
role='Solana SPL Token Analyst',
goal='Provide accurate answers about Solana SPL tokens.',
backstory='Expert analyst for Solana SPL tokens with on-chain tools.',
verbose=True,
tools=goat_crewai_tools # Assign the generated tools
)
# --- Define Task and Crew (as needed) ---
task = Task(
description='What is the balance of USDC for the wallet?',
expected_output='The USDC balance of the wallet.',
agent=crypto_analyst
)
crew = Crew(
agents=[crypto_analyst],
tasks=[task],
process=Process.sequential
)
# --- Kick off the Crew ---
# Note: Ensure you have enough SOL for potential transaction fees if tools perform actions.
result = crew.kickoff()
print(result)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file goat_sdk_adapter_crewai-0.1.0.tar.gz.
File metadata
- Download URL: goat_sdk_adapter_crewai-0.1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.16 Linux/6.8.0-1021-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8df14c91d12a1c9d557432eabd56a90bf67ff6aeac5b83042537157921b9e8dc
|
|
| MD5 |
a4c7ecd479147cbb5eed3416eda61fc3
|
|
| BLAKE2b-256 |
dcfbbefd9b7ede1300a0573c074de299f4af5789993a81c06e76bfef3a660673
|
File details
Details for the file goat_sdk_adapter_crewai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: goat_sdk_adapter_crewai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.16 Linux/6.8.0-1021-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da33f6064cd80fcec6e96a980fd7ccb26a33c73e2e58ef977dcb0b7a81b86019
|
|
| MD5 |
c894a5b976de768c105c15cfe713932c
|
|
| BLAKE2b-256 |
f9c9ce3c34e0f57c99062e4956d168f644462c5c34d2a6b5ee244a1a10972a10
|