Skip to main content

Before you start

Complete the CLI quickstart first so your runtime already has a paired wallet, API key, and wallet UUID.

5-minute outcome

  1. Build CrewAI tools from Cobo toolkit
  2. Submit a pact and wait for owner approval
  3. Run role-based task flow
  4. Trigger and handle policy denial
  5. Verify retry and audit outcomes

Step 1: Install

pip install "cobo-agentic-wallet[crewai]"

Step 2: Configure environment

export AGENT_WALLET_API_URL=https://api.agenticwallet.cobo.com
export AGENT_WALLET_API_KEY=your-api-key
export OPENAI_API_KEY=your-openai-api-key

Step 3: Run crew flow

crewai_quickstart.py
from __future__ import annotations

import asyncio
import os

from crewai import Agent, Crew, Process, Task

from cobo_agentic_wallet.client import WalletAPIClient
from cobo_agentic_wallet.integrations.crewai import CoboAgentWalletCrewAIToolkit


def main() -> None:
    client = WalletAPIClient(
        base_url=os.environ["AGENT_WALLET_API_URL"],
        api_key=os.environ["AGENT_WALLET_API_KEY"],
    )
    toolkit = CoboAgentWalletCrewAIToolkit(client=client)
    tools = toolkit.get_tools()

    wallet_uuid = "your-wallet-uuid"
    destination = "0x1111111111111111111111111111111111111111"

    analyst = Agent(
        role="Wallet Analyst",
        goal="Check wallet state and audit trails.",
        backstory="You inspect balances and transfer history.",
        tools=tools,
        verbose=True,
    )

    operator = Agent(
        role="Wallet Operator",
        goal="Submit pacts, execute transfers safely, and self-correct on denial.",
        backstory="You follow policy guidance and retry with compliant values.",
        tools=tools,
        verbose=True,
    )

    transfer_task = Task(
        description=(
            f"For wallet {wallet_uuid}: "
            "First, submit a pact using submit_pact with intent 'Transfer tokens for testing', "
            "permissions write:transfer, max_tx 100, and duration 86400. Wait until the pact "
            "status is active before proceeding. "
            f"Then transfer 50 USDC to {destination} on BASE, then try 200 USDC. "
            "If denied, use the suggestion and retry with a compliant amount."
        ),
        expected_output="Pact activation confirmation, transfer outcomes including denial and corrected retry.",
        agent=operator,
    )

    audit_task = Task(
        description=f"Query get_audit_logs for wallet {wallet_uuid} and summarize allowed plus denied events.",
        expected_output="Audit summary.",
        agent=analyst,
        context=[transfer_task],
    )

    crew = Crew(
        agents=[operator, analyst],
        tasks=[transfer_task, audit_task],
        process=Process.sequential,
        verbose=True,
    )

    print(crew.kickoff())
    asyncio.run(client.close())


if __name__ == "__main__":
    main()
CrewAI works especially well when each role gets a smaller CAW subset:
operator_toolkit = CoboAgentWalletCrewAIToolkit(
    client=client,
    include_tools=[
        "submit_pact",
        "get_pact",
        "transfer_tokens",
        "estimate_transfer_fee",
        "get_transaction_record_by_request_id",
    ],
)

Step 4: Validate outcomes

Confirm the crew result captures:
  • pact submission and activation
  • allowed transfer
  • denied transfer with suggestion
  • corrected retry
  • audit summary

Go further

CoboAgentWalletCrewAIToolkit gives your crew the widened CAW runtime toolkit. You can extend it for more complex multi-agent workflows:
  • Write custom CrewAI tools — define @tool functions that call WalletAPIClient directly and assign them to specific agents. For example, a PriceAnalyst agent with a custom price-checking tool that the WalletOperator agent uses to gate transfer decisions.
  • Use the Python SDK in task callbacks — run pact submission, policy dry-runs, and audit queries programmatically in your crew’s task logic for deterministic control.
  • Combine with CLI — use caw for provisioning, debugging, and manual inspection; use CrewAI tools for agent-time execution.
  • Use role-based presets — split responsibilities into Pact Drafting, Execution, and Observer tool sets so each agent sees only the tools it needs.

CrewAI Integration Details

Tool schema and denial mapping specifics.

Python SDK

Use WalletAPIClient directly for custom tool functions.