Skip to main content

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)


Metadata

Release files for goat-sdk-adapter-crewai 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for goat-sdk-adapter-crewai 0.1.0
File Size Uploaded Provenance Actions
goat_sdk_adapter_crewai-0.1.0.tar.gz 3.4 kB Without provenance Details for goat_sdk_adapter_crewai-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for goat-sdk-adapter-crewai 0.1.0
File Interpreter ABI Platform Actions
goat_sdk_adapter_crewai-0.1.0-py3-none-any.whl Python 3 none any Details for goat_sdk_adapter_crewai-0.1.0-py3-none-any.whl

Total release size: 7.3 kB

Release files / goat_sdk_adapter_crewai-0.1.0.tar.gz

Download URL goat_sdk_adapter_crewai-0.1.0.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8df14c91d12a1c9d557432eabd56a90bf67ff6aeac5b83042537157921b9e8dc
BLAKE2b-256 checksum
How to use checksums
dcfbbefd9b7ede1300a0573c074de299f4af5789993a81c06e76bfef3a660673
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.16 Linux/6.8.0-1021-azure

Release files / goat_sdk_adapter_crewai-0.1.0-py3-none-any.whl

Download URL goat_sdk_adapter_crewai-0.1.0-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da33f6064cd80fcec6e96a980fd7ccb26a33c73e2e58ef977dcb0b7a81b86019
BLAKE2b-256 checksum
How to use checksums
f9c9ce3c34e0f57c99062e4956d168f644462c5c34d2a6b5ee244a1a10972a10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.16 Linux/6.8.0-1021-azure

Security for goat-sdk-adapter-crewai 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page