Docs · guide · Python
CrewAI tool with FlexYield
The same tool shape for a CrewAI crew.
Install
pip install crewai crewai-tools requests
Connect and call
import os, requests
from crewai.tools import tool
@tool("FlexYield JSON-RPC")
def rpc_call(chain: str, method: str, params: list) -> dict:
"""JSON-RPC call through FlexYield on a served chain (eth_mainnet, base_mainnet, ...)."""
r = requests.post(f"https://flexyield.io/rpc/{chain}",
headers={"Authorization": f"Bearer {os.environ['FLEXYIELD_KEY']}"},
json={"jsonrpc": "2.0", "id": 1, "method": method, "params": params}, timeout=15)
return r.json()
Replace fy_your_api_key with a key from your dashboard (free tier at registration). Chain slugs: eth_mainnet base_mainnet arbitrum_one optimism_mainnet polygon_pos solana_mainnet — each has its own measured page.
All guides: integration guides · methods and limits · docs.