CrewAi
Integration of Agentipy with crewAI
# 1. Import both libraries
from crewai import Agent, Crew, Task
from agentipy.agent import SolanaAgentKit
# 2. Create a Solana kit instance
solana_kit = SolanaAgentKit(
private_key=os.getenv("SOLANA_PRIVATE_KEY"),
rpc_url="https://api.devnet.solana.com"
)
# 3. Create tools from agentipy capabilities
@tool("get_sol_balance")
def get_sol_balance() -> str:
# Use agentipy BalanceFetcher to get blockchain data
balance = loop.run_until_complete(BalanceFetcher.get_balance(agent))
return f"The current SOL balance is {balance:.4f} SOL"
# 4. Attach tools to crewAI agents
solana_agent = Agent(
config=agents_config["solana_operator"],
tools=[make_balance_tool(agent=solana_kit)],
llm=ChatOpenAI(model=os.getenv("MODEL"), temperature=0)
)
# 5. Create tasks using these agents
solana_task = Task(
description="Analyze instruction and take action: {user_input}",
agent=solana_agent
)
# 6. Orchestrate with crewAI
crew = Crew(
agents=[solana_agent],
tasks=[solana_task],
process=Process.sequential
)Architecture
Components
Setup and Installation
Prerequisites
Installation Steps
Usage
Customization
Integration with agentipy
Dependencies
Advanced Use Cases
Troubleshooting
Last updated
