Skip to main content

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.

Start with the language SDK quickstart first, then move to LangChain 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. Build LangChain tools from CoboAgentWalletToolkit
  2. Submit a pact and wait for owner approval
  3. Run an allowed contract-call request
  4. Trigger policy denial from a non-compliant contract call
  5. Retry using denial guidance
  6. Track by request_id and query audit logs

Step 1: Install

pip install "cobo-agentic-wallet[langchain]" langchain-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: Wire toolkit and agent

langchain_quickstart.py
import asyncio
import os

from cobo_agentic_wallet import WalletAPIClient
from cobo_agentic_wallet.integrations.langchain import CoboAgentWalletToolkit
from langchain.agents import create_agent
from langchain_openai import ChatOpenAI

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 ChatOpenAI
    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 = CoboAgentWalletToolkit(client=client, include_tools=INCLUDE_TOOLS)
        try:
            agent = create_agent(
                model=ChatOpenAI(model="gpt-4.1-mini"),
                tools=toolkit.get_tools(),
            )
            result = await agent.ainvoke({"messages": [{"role": "user", "content": prompt}]})
            print(result["messages"][-1].content)
        finally:
            await toolkit.aclose()


asyncio.run(main())
If you want a tighter first integration, start with a smaller tool subset:
toolkit = CoboAgentWalletToolkit(
    client=client,
    include_tools=[
        "submit_pact",
        "get_pact",
        "transfer_tokens",
        "estimate_transfer_fee",
        "get_transaction_record_by_request_id",
        "get_audit_logs",
    ],
)
tools = toolkit.get_tools()

Step 4: Confirm denial loop happened

Verify agent output includes:
  • a pact submission and activation confirmation
  • a successful contract call
  • a policy denial payload/text
  • a corrected retry
  • a transaction lookup by request_id
  • audit log summary

Keep the LangChain layer thin

LangChain should wrap the canonical CAW flow, not replace it with a different mental model.
  • keep CAW tools limited to the exact runtime role
  • keep pact drafting separate from broad wallet management
  • prefer get_transaction_record_by_request_id over ad hoc polling patterns
  • move deterministic business logic outside the model loop when possible

Go further

In Python, CoboAgentWalletToolkit gives you the widened CAW runtime toolkit directly. In TypeScript, the usual pattern is to wrap @cobo/agentic-wallet calls in LangChain tools and expose only the subset your runtime needs.
  • Define custom LangChain tools — in Python, register @tool functions alongside CAW’s adapter; in TypeScript, wrap the CAW SDK in tool(...) definitions with zod schemas.
  • Add CLI tools — call caw via subprocess for operations you want to handle as shell commands rather than Python calls.
  • Use direct SDK calls when determinism matters — for pact lifecycle management, audit queries, or recovery flows, keep the CAW call outside the agent loop.
  • Use role-based presets — a good default split is Pact Drafting, Execution, and Observer. Start narrow and only add more tools when the runtime proves it needs them.

Python SDK

Use WalletAPIClient directly for custom tool functions.