> ## Documentation Index
> Fetch the complete documentation index at: https://cobo.com/products/agentic-wallet/manual/llms.txt
> Use this file to discover all available pages before exploring further.

# CrewAI

> 5-minute CrewAI quickstart with pact submission and policy-aware transfer execution.

## Before you start

Complete the [CLI quickstart](/products/agentic-wallet/manual/developer/cli) 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

```bash theme={null}
pip install "cobo-agentic-wallet[crewai]"
```

## Step 2: Configure environment

```bash theme={null}
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

```python title="crewai_quickstart.py" theme={null}
import asyncio
import os

from crewai import LLM, Agent, Crew, Process, Task

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

INCLUDE_TOOLS = [
    "submit_pact", "get_pact", "transfer_tokens",
    "estimate_transfer_fee", "get_transaction_record_by_request_id", "get_audit_logs",
]


async def main() -> None:
    _ = os.environ["OPENAI_API_KEY"]  # consumed implicitly by CrewAI's LLM
    wallet_id = os.environ["AGENT_WALLET_WALLET_ID"]
    destination = os.environ.get("CAW_DESTINATION", "0x1111111111111111111111111111111111111111")
    prompt = (
        f"Use wallet {wallet_id}. Submit a pact for a controlled transfer task and wait until "
        f"it is active. Using the newly created pact, transfer 0.001 SETH to {destination} on "
        f"SETH. Next, using the same pact, attempt 0.005 SETH. If denied, follow the denial "
        f"guidance and retry with a compliant amount. Track the result by request_id and "
        f"summarize what happened."
    )

    async with WalletAPIClient(
        base_url=os.environ["AGENT_WALLET_API_URL"],
        api_key=os.environ["AGENT_WALLET_API_KEY"],
    ) as client:
        toolkit = CoboAgentWalletCrewAIToolkit(client=client, include_tools=INCLUDE_TOOLS)
        try:
            operator = Agent(
                role="Wallet Operator",
                goal=(
                    "Submit pacts and execute controlled transfers. "
                    "If a transfer is denied by policy, read the denial suggestion "
                    "and retry with compliant parameters."
                ),
                backstory=(
                    "You operate inside CAW guardrails. You submit a pact before execution "
                    "and adapt your next step based on policy feedback. "
                    "If a tool call returns a validation error, read the error message, "
                    "correct the arguments, and call the tool again — do not give up."
                ),
                tools=toolkit.get_tools(),
                llm=LLM(model="gpt-4.1-mini"),
            )
            task = Task(
                description=prompt,
                expected_output=(
                    "A short summary of the allowed transfer, the blocked attempt, "
                    "and the compliant retry."
                ),
                agent=operator,
            )
            crew = Crew(agents=[operator], tasks=[task], process=Process.sequential)
            print(await crew.kickoff_async())
        finally:
            await toolkit.aclose()


asyncio.run(main())
```

CrewAI works especially well when each role gets a smaller CAW subset:

```python theme={null}
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.

<CardGroup cols={2}>
  <Card title="Python SDK" href="/products/agentic-wallet/manual/developer/api-client-python">
    Use WalletAPIClient directly for custom tool functions.
  </Card>
</CardGroup>
