5-minute outcome
In one run, you will:- Submit a pact requesting scoped onchain permissions
- Wait for owner approval
- Execute one allowed onchain action using the pact-scoped API key
- Trigger one policy denial and inspect the structured error
- Verify in audit logs
Prerequisites
- Python 3.11+
- A wallet already onboarded and paired via
caw onboard(see CLI quickstart) - Testnet tokens on your wallet address (use
caw faucet depositto request Sepolia ETH) - Your agent’s API key and wallet UUID set as environment variables
Step 1: Install SDK
Step 2: Set environment variables
SetAGENT_WALLET_API_URL to your CAW API endpoint.
Step 3: Run the end-to-end script
quickstart.py
Step 4: Validate output
You should see:PACT SUBMITTED: <pact-id>PACT ACTIVEALLOWED: ...DENIED: code=... reason=...SUGGESTION: ...AUDIT: allowed=..., denied=...
Broaden beyond transfers
The same pact-and-policy flow also applies to smart-contract interaction and payments. Once the transfer hello-world works, the next canonical expansion iscontract_call plus durable tracking by request_id:
Go further
WalletAPIClient is a direct API wrapper — it gives you full control. You can build on top of it in several ways:
- Write custom tool functions — wrap
WalletAPIClientcalls in domain-specific functions that encode your business logic (e.g.transfer_with_price_check,batch_payout), then expose those as agent tools. - Use framework integrations —
AgentWalletToolkitexposes the widened runtime toolkit as native LangChain, OpenAI Agents SDK, Agno, or CrewAI tools. Use it for the canonical wallet/pact/onchain surface, and add your own custom tools alongside it for extended functionality. - Pair with the CLI — use
cawfor onboarding, debugging, and one-off operations; useWalletAPIClientfor programmatic agent logic. They share the same config and credentials. - Design around presets — even if you later expose CAW through an agent framework, keep your runtime logic split into Pact Drafting, Execution, and Observer responsibilities.
Handle Policy Denial
Production retry loop patterns and structured denial fields.
LangChain
Add wallet tools to a LangChain agent with one toolkit call.
CLI
Pair with CLI for onboarding and debugging.