🗳️ On-Chain Governance for AI

AI Agents that Vote
in DAO Governance

Let your AI agents participate in decentralized governance. Cast votes, submit proposals, delegate voting power, and track outcomes — all on-chain, all automated, all through Purple Flea's API.

Get API Key Wallet API Docs
100+
DAOs Supported
6
Chains
REST
Simple API
+MCP
Tool Protocol

What Agents Can Do in DAO Governance

🗳️

Cast Votes

Vote FOR, AGAINST, or ABSTAIN on active proposals in any supported DAO. Votes are signed by the agent's wallet and submitted on-chain.

📜

Submit Proposals

Agents with sufficient voting power can submit governance proposals. On-chain calldata, description text, and voting period configured via API.

🔁

Delegate Voting Power

Delegate token voting power to specialized governance agents. One agent accumulates delegations; another specializes in specific protocol governance.

🔍

Research Proposals

Fetch proposal text, voting status, quorum progress, and historical vote records. Agents can analyze proposals before deciding how to vote.

Monitor Active Votes

Watch for new proposals and vote deadlines. Automated alerts when a proposal needs a vote and the deadline is approaching.

📊

Track Voting History

Full on-chain audit trail of every vote cast by an agent. Useful for transparency reporting and delegation accountability.

Complete DAO Governance Agent in Python

# Autonomous DAO governance agent that monitors proposals and votes
import asyncio, httpx
from openai import AsyncOpenAI

PURPLE_FLEA_KEY = "your-api-key"
oai = AsyncOpenAI()

class DAOGovernanceAgent:
    def __init__(self, api_key: str, dao_addresses: list[str]):
        self.api_key = api_key
        self.daos = dao_addresses
        self.voted = set()  # track proposals already voted on

    async def get_active_proposals(self, dao_addr: str) -> list[dict]:
        async with httpx.AsyncClient() as client:
            r = await client.get(
                f"https://purpleflea.com/api/dao/{dao_addr}/proposals",
                params={"status": "active"},
                headers={"X-API-Key": self.api_key}
            )
            return r.json()["proposals"]

    async def analyze_proposal(self, proposal: dict) -> str:
        """Use LLM to determine how to vote based on proposal text."""
        response = await oai.chat.completions.create(
            model="gpt-4o",
            messages=[
                {
                    "role": "system",
                    "content": """You are a DAO governance agent for a DeFi protocol.
Vote FOR proposals that: increase treasury yield, improve security, or reduce fees.
Vote AGAINST proposals that: increase inflation, add centralization risks, or harm token holders.
Respond with exactly one word: FOR, AGAINST, or ABSTAIN."""
                },
                {
                    "role": "user",
                    "content": f"Proposal: {proposal['title']}\n\nDescription: {proposal['description']}"
                }
            ]
        )
        return response.choices[0].message.content.strip()

    async def cast_vote(self, dao_addr: str, proposal_id: str, vote: str) -> dict:
        async with httpx.AsyncClient() as client:
            r = await client.post(
                f"https://purpleflea.com/api/dao/{dao_addr}/vote",
                json={
                    "proposal_id": proposal_id,
                    "support": {"FOR": 1, "AGAINST": 0, "ABSTAIN": 2}[vote],
                    "reason": f"Autonomous vote by governance agent: {vote}"
                },
                headers={"X-API-Key": self.api_key}
            )
            return r.json()

    async def run_governance_loop(self):
        """Check for new proposals every hour and vote autonomously."""
        while True:
            for dao_addr in self.daos:
                proposals = await self.get_active_proposals(dao_addr)

                for proposal in proposals:
                    prop_id = proposal["id"]
                    if prop_id in self.voted:
                        continue

                    # Analyze and vote
                    vote = await self.analyze_proposal(proposal)
                    result = await self.cast_vote(dao_addr, prop_id, vote)

                    print(f"Voted {vote} on '{proposal['title']}' — tx: {result['tx_hash']}")
                    self.voted.add(prop_id)

            await asyncio.sleep(3600)  # check hourly

# Run the governance agent for multiple DAOs
agent = DAOGovernanceAgent(
    api_key=PURPLE_FLEA_KEY,
    dao_addresses=[
        "0xUniswapGovernor",
        "0xCompoundGovernor",
        "0xAaveGovernance"
    ]
)
asyncio.run(agent.run_governance_loop())

DAO Governance API Reference

MethodEndpointDescription
GET/api/dao/:addr/proposalsList active, passed, failed proposals
GET/api/dao/:addr/proposals/:idGet full proposal details + vote counts
POST/api/dao/:addr/voteCast a vote (FOR/AGAINST/ABSTAIN)
POST/api/dao/:addr/proposeSubmit a new governance proposal
POST/api/dao/:addr/delegateDelegate voting power to an address
GET/api/dao/:addr/voting-powerGet current voting power of wallet
GET/api/dao/:addr/vote-historyGet full vote history for wallet

Supported Governance Standards

Purple Flea supports OpenZeppelin Governor (used by Uniswap, Compound, ENS, Gitcoin), Compound Bravo Governor, and Snapshot off-chain voting. More governance systems (Aragon, Tally) on the roadmap.

Start Participating in DAO Governance

Get a Purple Flea API key and build an autonomous governance agent that represents your interests in any DAO.