🔐 Enterprise Security

Multi-Signature Wallet API
for AI Agent Swarms

Require M-of-N agent or human approval before any transaction executes. Prevent single points of failure, enforce spending limits, and maintain human oversight on large withdrawals — without sacrificing agent autonomy.

Get API Key Standard Wallet API
M-of-N
Any Threshold
Gnosis Safe
Compatible
6
Chains
Timelock
Configurable Delay

Why Agent Swarms Need Multi-Sig

🛡️

Prevent Rogue Agents

A single compromised or hallucinating agent can't drain the treasury alone. 2-of-3 or 3-of-5 threshold ensures consensus before large outflows.

👤

Human Oversight

For transactions above a threshold (e.g., $10,000), require human approval in addition to agent signatures. Stay compliant with enterprise governance requirements.

Timelock Controls

Add a 24-48 hour delay before large transactions execute. Gives human operators time to review and veto if needed before funds leave.

💰

Spending Limits

Individual agents have daily spending caps. Amounts above the cap require multi-sig approval. Granular control over agent financial autonomy.

🔄

Key Rotation

Rotate individual agent signing keys without interrupting service. Replace a compromised key by getting other signers to approve the key change.

📊

Audit Trail

Every signature, approval, and rejection is recorded on-chain with timestamps. Complete audit trail of who approved what and when.

Implementation: 2-of-3 Agent Treasury

# Multi-sig treasury: 3 agents, 2 signatures required for any transfer
import asyncio, httpx

PURPLE_FLEA_KEY = "your-api-key"

class MultiSigTreasury:
    def __init__(self, api_key: str, signers: list[str], threshold: int):
        self.api_key = api_key
        self.signers = signers  # list of signer agent addresses
        self.threshold = threshold
        self.pending_txs = {}

    async def create_multisig_wallet(self) -> str:
        async with httpx.AsyncClient() as client:
            r = await client.post(
                "https://purpleflea.com/api/wallet/multisig/create",
                json={
                    "signers": self.signers,
                    "threshold": self.threshold,
                    "timelock_hours": 0  # immediate execution once threshold met
                },
                headers={"X-API-Key": self.api_key}
            )
            wallet = r.json()
            print(f"Multi-sig wallet created: {wallet['address']}")
            print(f"Requires {self.threshold}-of-{len(self.signers)} signatures")
            return wallet["address"]

    async def propose_transaction(
        self,
        from_agent: str,
        to: str,
        amount_usdc: float,
        memo: str = ""
    ) -> str:
        """Any agent can propose; threshold must approve before execution."""
        async with httpx.AsyncClient() as client:
            r = await client.post(
                "https://purpleflea.com/api/wallet/multisig/propose",
                json={
                    "proposer": from_agent,
                    "to": to,
                    "amount_usdc": amount_usdc,
                    "memo": memo
                },
                headers={"X-API-Key": self.api_key}
            )
            tx_id = r.json()["tx_id"]
            self.pending_txs[tx_id] = {"signatures": 0, "amount": amount_usdc}
            print(f"Transaction proposed: {tx_id}")
            print(f"Needs {self.threshold - 1} more signatures to execute")
            return tx_id

    async def sign_transaction(self, signer_addr: str, tx_id: str) -> dict:
        """Signer approves the pending transaction."""
        async with httpx.AsyncClient() as client:
            r = await client.post(
                f"https://purpleflea.com/api/wallet/multisig/sign/{tx_id}",
                json={"signer": signer_addr},
                headers={"X-API-Key": self.api_key}
            )
            result = r.json()

            if result["status"] == "executed":
                print(f"Threshold reached! Transaction {tx_id} executed.")
                print(f"On-chain tx: {result['tx_hash']}")
            else:
                remaining = result["required_signatures"] - result["current_signatures"]
                print(f"Signed. {remaining} more signature(s) needed.")

            return result

# Usage: 3-agent treasury requiring 2-of-3 for any payment
treasury = MultiSigTreasury(
    api_key=PURPLE_FLEA_KEY,
    signers=["0xCFO-Agent", "0xRisk-Manager", "0xHuman-Oversight"],
    threshold=2
)

async def main():
    wallet_addr = await treasury.create_multisig_wallet()

    # CFO proposes a large payment
    tx_id = await treasury.propose_transaction(
        from_agent="0xCFO-Agent",
        to="0xVendorAddress",
        amount_usdc=5000,
        memo="Monthly server infrastructure payment"
    )

    # CFO signs first (counts as 1/2)
    await treasury.sign_transaction("0xCFO-Agent", tx_id)

    # Risk manager reviews and signs (2/2 — executes!)
    await treasury.sign_transaction("0xRisk-Manager", tx_id)

asyncio.run(main())

Common Multi-Sig Configurations

🤖

2-of-3 Agent Swarm

Three specialized agents (CFO, Risk Manager, Compliance). Any two can approve routine payments. Great for day-to-day operations.

👥

2-of-3 with Human Key

Two AI agents + one human. Routine ops require both agents. Large transactions require at least one human approval. Balanced autonomy.

🏛️

3-of-5 DAO Treasury

Five DAO member agents. Requires supermajority (3 of 5) for treasury disbursements. Resistant to minority capture.

⏱️

1-of-N with Timelock

Any single agent can initiate; execution delayed 48 hours. Others can veto during the window. Best for transparent, reviewable operations.

Gnosis Safe Compatibility

Purple Flea's multi-sig wallet is compatible with the Gnosis Safe interface on EVM chains. If you already use Gnosis Safe for human operations, you can add AI agent signers to your existing Safe — no migration needed. Agent keys are generated and managed by Purple Flea; signatures are submitted on-chain via the standard Safe protocol.

Secure Your Agent Treasury

Add multi-sig controls to your AI agent swarm's finances. Get an API key and configure M-of-N approval in minutes.