Skip to main content
Start with the language SDK quickstart first, then move to OpenAI Agents SDK once the pact-to-execution flow works without an agent loop.

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. Create Cobo-enabled OpenAI agent
  2. Submit a pact and wait for owner approval
  3. Execute success plus denial contract-call sequence
  4. Let agent adapt using denial context
  5. Track by request_id and verify with audit logs

Step 1: Install

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

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 agent flow

openai_quickstart.py
import asyncio
import os

from agents import Runner

from cobo_agentic_wallet.client import WalletAPIClient
from cobo_agentic_wallet.integrations.openai import create_cobo_agent, create_cobo_agent_context


def main() -> None:
    client = WalletAPIClient(
        base_url=os.environ["AGENT_WALLET_API_URL"],
        api_key=os.environ["AGENT_WALLET_API_KEY"],
    )
    agent = create_cobo_agent(client=client, model="gpt-4.1-mini")
    context = create_cobo_agent_context()

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

    prompt = (
        f"Use wallet {wallet_uuid}. "
        "First, submit a pact with intent 'Transfer tokens for testing', permissions "
        "write:transfer, max_tx 100, and duration 86400. Wait until the pact status is active. "
        f"Then transfer 50 USDC to {destination} on BASE. "
        "Then attempt 200 USDC. If denied, read the suggestion and retry with a compliant amount. "
        f"After retry, query audit logs for wallet {wallet_uuid}."
    )

    result = Runner.run_sync(agent, prompt, context=context, max_turns=10)
    print(result.final_output)

    asyncio.run(client.close())


if __name__ == "__main__":
    main()
For a smaller first integration, you can expose only the tools your runtime actually needs:
agent = create_cobo_agent(
    client=client,
    model="gpt-4.1-mini",
    include_tools=[
        "submit_pact",
        "get_pact",
        "transfer_tokens",
        "estimate_transfer_fee",
        "get_transaction_record_by_request_id",
        "get_audit_logs",
    ],
)

Step 4: Validate results

Confirm final output includes:
  • pact submission and activation confirmation
  • success event
  • denial reason and suggestion
  • successful compliant retry
  • transaction lookup by request_id
  • audit confirmation

Keep the OpenAI layer thin

The OpenAI agent should coordinate the CAW flow, not absorb every wallet capability by default.
  • expose only the tools needed for the runtime role
  • keep pact submission and execution close together so the approval story stays legible
  • prefer durable tracking by request_id
  • move deterministic checks outside the agent loop when you need strict control

Go further

In Python, create_cobo_agent wires up the widened CAW runtime toolkit directly. In TypeScript, the normal pattern is to wrap the CAW TypeScript SDK in OpenAI tool functions and expose only the subset your runtime needs.
  • Define custom function tools — in Python, add functions alongside CAW’s built-in adapter; in TypeScript, wrap @cobo/agentic-wallet API calls in framework-native tool definitions.
  • Keep CAW behind a narrow tool surface — do not expose the whole API to the model. Start with Pact Drafting, Execution, and Observer roles.
  • Use direct SDK calls for out-of-band operations — run pact submission, policy dry-runs, and audit queries programmatically outside the agent loop when you need deterministic behavior.
  • Combine with CLI — use caw for onboarding and debugging; use the SDK tools for agent-time execution.
  • Use role-based presets — start with Pact Drafting, Execution, and Observer responsibilities instead of exposing the entire toolkit immediately.

OpenAI Integration Details

Context handling and denial behavior.

Python SDK

Use WalletAPIClient directly for custom tool functions.