Skip to main content

Clicks Protocol yield management tools for CrewAI agent crews on Base

Project description

Clicks Protocol — CrewAI Integration

On-chain yield management tools for CrewAI agent crews on Base.

Powered by Clicks Protocol

What It Does

Gives your CrewAI agents the ability to manage idle USDC as a team. A Treasury Manager agent monitors balances, an Investment Analyst evaluates yield rates, and together they autonomously split funds 80/20: 80% liquid, 20% earning 4-8% APY on Base.

Installation

pip install clicks-crewai

Or from source:

git clone https://github.com/clicks-protocol/clicks-crewai
cd clicks-crewai
pip install -e .

Prerequisites

  • Python >= 3.9
  • Node.js >= 18 (for SDK bridge)
  • @clicks-protocol/sdk installed: npm install @clicks-protocol/sdk

Environment Variables

export CLICKS_PRIVATE_KEY="your-agent-wallet-private-key"
export CLICKS_RPC_URL="https://mainnet.base.org"        # optional
export CLICKS_SDK_PATH="/path/to/sdk"                     # optional

Quick Start

from crewai import Agent, Task, Crew
from clicks_crewai import (
    ClicksCheckBalanceTool,
    ClicksActivateYieldTool,
    ClicksGetAPYTool,
    ClicksSimulateSplitTool,
    ClicksWithdrawYieldTool,
)

AGENT_ADDRESS = "0xYourAgentAddress"

# Create tools
balance_tool = ClicksCheckBalanceTool()
yield_tool = ClicksActivateYieldTool()
apy_tool = ClicksGetAPYTool()
simulate_tool = ClicksSimulateSplitTool()
withdraw_tool = ClicksWithdrawYieldTool()

# Define agents
treasury_manager = Agent(
    role="Treasury Manager",
    goal="Maximize yield on idle USDC while maintaining operational liquidity",
    backstory=(
        "You are an autonomous treasury manager for an AI agent. "
        "Your job is to ensure idle USDC earns yield via Clicks Protocol "
        "while keeping enough liquid for operations. You never risk funds "
        "needed for imminent transactions."
    ),
    tools=[balance_tool, yield_tool, withdraw_tool, simulate_tool],
    verbose=True,
)

investment_analyst = Agent(
    role="Investment Analyst",
    goal="Monitor yield rates and recommend optimal treasury allocation",
    backstory=(
        "You analyze DeFi yield rates and market conditions to advise "
        "the Treasury Manager. You track Clicks Protocol APY and recommend "
        "when to activate, hold, or withdraw yield positions."
    ),
    tools=[apy_tool, balance_tool, simulate_tool],
    verbose=True,
)

# Define tasks
analysis_task = Task(
    description=(
        f"Analyze the current treasury position for {AGENT_ADDRESS}. "
        "Check the current APY rate, simulate a split for any idle funds, "
        "and provide a recommendation on whether to activate yield."
    ),
    expected_output=(
        "A treasury analysis report with: current balances, APY rate, "
        "simulated split breakdown, and a clear recommendation."
    ),
    agent=investment_analyst,
)

execution_task = Task(
    description=(
        f"Based on the analyst's recommendation, take action on {AGENT_ADDRESS}. "
        "If yield activation is recommended and APY > 4%, activate yield on idle funds. "
        "If withdrawal is recommended, withdraw. Always check balance first."
    ),
    expected_output=(
        "Confirmation of action taken with transaction details, or explanation "
        "of why no action was taken."
    ),
    agent=treasury_manager,
    context=[analysis_task],
)

# Run the crew
crew = Crew(
    agents=[investment_analyst, treasury_manager],
    tasks=[analysis_task, execution_task],
    verbose=True,
)

result = crew.kickoff()
print(result)

Available Tools

Tool Description Best For
ClicksCheckBalanceTool View liquid vs. yield balances Treasury Manager
ClicksActivateYieldTool Split USDC 80/20 to earn yield Treasury Manager
ClicksWithdrawYieldTool Withdraw all yield + deposits Treasury Manager
ClicksGetAPYTool Get current APY rate Investment Analyst
ClicksSimulateSplitTool Preview split without moving funds Both

Configuration

from clicks_crewai import configure_sdk

# Configure before creating tools
configure_sdk(
    rpc_url="https://mainnet.base.org",
    private_key="your-key",
    sdk_path="/path/to/sdk",
)

Or use environment variables (recommended):

export CLICKS_PRIVATE_KEY="..."
export CLICKS_RPC_URL="https://mainnet.base.org"

Example: Scheduled Treasury Optimization

import schedule
import time
from crewai import Agent, Task, Crew
from clicks_crewai import get_all_tools

AGENT_ADDRESS = "0xYourAgentAddress"

def run_treasury_check():
    tools = get_all_tools()
    
    manager = Agent(
        role="Treasury Manager",
        goal="Optimize USDC yield allocation",
        backstory="Autonomous treasury manager using Clicks Protocol on Base.",
        tools=tools,
    )
    
    task = Task(
        description=(
            f"Check treasury status for {AGENT_ADDRESS}. "
            "If idle USDC > 500 and APY > 4%, activate yield. "
            "Report current status."
        ),
        expected_output="Treasury status and actions taken.",
        agent=manager,
    )
    
    crew = Crew(agents=[manager], tasks=[task])
    return crew.kickoff()

# Run every 6 hours
schedule.every(6).hours.do(run_treasury_check)

while True:
    schedule.run_pending()
    time.sleep(60)

Contract Addresses (Base Mainnet)

Contract Address
Registry 0x23bb0Ea69b2BD2e527D5DbA6093155A6E1D0C0a3
Splitter 0xc96C1a566a8ed7A39040a34927fEe952bAB8Ad1D
YieldRouter 0x053167a233d18E05Bc65a8d5F3F8808782a3EECD
ClicksReferral 0x1E5Ab896D3b3A542C5E91852e221b2D849944ccC
USDC 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913

License

MIT


Built for autonomous AI agents. Powered by Clicks Protocol.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clicks_crewai-0.1.1.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clicks_crewai-0.1.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file clicks_crewai-0.1.1.tar.gz.

File metadata

  • Download URL: clicks_crewai-0.1.1.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for clicks_crewai-0.1.1.tar.gz
Algorithm Hash digest
SHA256 408fb16f630ea089090ff23f64e3699230bb0458149e9be33508db245209eb8d
MD5 4f5cc7d6426188d975a87e61e6583ee2
BLAKE2b-256 8f6f8f067c15c163a731a1d0f6cf9f497ec48d599f9fadedea0b317d86945485

See more details on using hashes here.

File details

Details for the file clicks_crewai-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: clicks_crewai-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for clicks_crewai-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cc799c56ff17ac98ca5fe0cd01af7c89ee1e6a5312cc58f4efdad4f7311dc2e8
MD5 76edd15d00a7052f51f88bd82b81b985
BLAKE2b-256 209bdad2e47499cb3c5f175a1e4ea86b68d86f423a61cc8694d1109c4955c324

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page