Skip to main content

Connecting Agents via API

This guide shows how to connect different AI agent frameworks to Conto, enabling them to request, approve, execute, and confirm payments depending on the wallet model you choose.
Before integrating, make sure you’ve connected your agent, linked a wallet, and generated an SDK key. If you are an autonomous agent evaluating Conto without a human account, use the agent sandbox quickstart first.

SDK Authentication

All SDK endpoints require the agent’s SDK key in the Authorization header:
Set that key as CONTO_API_KEY. Do not use CONTO_ORG_API_KEY for these /api/sdk/* calls.

Choose Your Wallet Flow First

Before wiring up tool calls, decide whether your agent uses a managed wallet or an external wallet.
The framework examples below assume a managed wallet and use request -> execute. If your agent holds the signing keys, switch to approve -> transfer -> confirm instead. See Custody Modes for the full breakdown.

Register The Wallet The Right Way

If your integration already has a wallet, register that same address in Conto as EXTERNAL instead of creating a second one. Include the address and network in the wallet request. Repeating the same registration returns the existing wallet, so a safe retry does not create a duplicate. Choose MANAGED when you want Conto to create and operate the wallet. Choose EXTERNAL when the signing keys remain in your existing wallet stack and use the external approve -> transfer -> confirm flow. For a managed wallet, Privy protects the key material and Conto does not store the wallet’s raw private key. An organization-controlled wallet gives the customer owner quorum root administration and export authority while Conto is a separate signer used after policies and approvals. A Conto-managed wallet has no customer self-service export. See Custody Modes for the enforcement boundary of each model.

The Shared Payment Helper

Every framework integration wraps the same two-call flow: request (policy check), then execute. Define it once and reuse it from each framework’s tool handler:
The Python equivalent for Python-based frameworks:

Framework Integrations

With the shared helper in place, each framework only needs its own tool wiring.

OpenAI Assistants

In your OpenAI chat loop, check for tool_calls in the response. When the model calls make_payment, parse the arguments, pass them to executeContoPayment, and send the result back as a tool response message.

Anthropic Claude (Tool Use)

LangChain

Python (Any Framework)

Register make_payment (defined above) as a tool in your framework of choice (CrewAI, AutoGen, or a custom loop) and return its dict result to the model as the tool output.

Payment Endpoints Reference

Error Handling

Policy denials are not HTTP errors. When a payment violates a policy (spend limit, time window, counterparty rule), /api/sdk/payments/request returns 200 with status: "DENIED" and a violations array describing each violation (for example DAILY_LIMIT or TIME_WINDOW). For full error handling patterns, see Error Handling.

Next Steps

Make Your First Payment

Detailed payment flow walkthrough

SDK Reference

Full SDK documentation

Examples

Complete integration examples

Error Handling

Handle errors gracefully