Powered by Turnkey
- Catena built agentic treasury and banking infrastructure on Turnkey, giving AI agents their own accounts, payments, and treasury management. Policy guardrails are enforced at the enclave level, including tamper-proof spend limits, multi-party approvals, and agent-to-agent commerce with built-in identity verification.
Key implementation decisions
| Decision | What to consider |
|---|---|
| Wallet architecture | Dedicate wallets per agent or per payment flow. Agents should never share wallets across different trust levels. See Agentic Wallets for provisioning patterns. |
| Payment controls | Define policies that scope what agents can pay, where funds can move, and under what conditions. Use spending caps and destination allowlists to limit blast radius. |
| Transaction management | Use Turnkey’s transaction lifecycle management so agents can sign and broadcast in a single API call, with built-in confirmation tracking and retries. |
| Transaction monitoring | Use webhooks to track transaction status, confirmations, and failures so agents can react to payment outcomes without polling. |
| Gas strategy | Sponsored transactions eliminate the need for agents or end users to hold native tokens for gas. |
| Balance visibility | Agents need to know what they can spend before acting. Use real-time balances to inform payment decisions without manual reconciliation. |
| Human-in-the-loop | For high-value payments, require multi-party approval (agent + human, or agent + agent) before the enclave signs. |
| Chain coverage | EVM and SVM have different transaction models and require separate policies. Plan for the networks your agents will transact on. |
Example: autonomous payment agent
The following examples walk through three agentic payment patterns, all using the same agent wallet and policy foundation:- Stablecoin payout - Agent sends USDC to an approved recipient, covering wallet setup, policies, gas sponsorship, and balance checks.
- x402 payment - Agent responds to an HTTP 402 Payment Required response by completing an onchain payment automatically.
- MPP payment - Agent fulfills a payment request from a service using Stripe’s Machine Payments Protocol.
1. Stablecoin payout
This example assumes you’ve provisioned an agent wallet and credentials following the Agentic Wallets guide. The agent client below uses those credentials.
Define a payment policy
Restrict the agent to only interact with the USDC contract. This policy is created once by an admin:The policy above restricts which contract the agent can interact with. To control the actual recipient addresses within an ERC-20 transfer, you can upload the contract ABI and write policies against individual function parameters. See Smart Contract Interfaces to learn more.
Send the USDC payout with gas sponsorship
With gas sponsorship enabled, the agent doesn’t need to hold ETH to pay for transaction fees. Turnkey covers gas so the agent can transact using only its USDC balance:
2. x402 payment
The x402 protocol revives HTTP’s 402 Payment Required status code as a payment rail for autonomous agents. When an agent requests a paid resource, the server responds with a 402 and payment requirements. The agent completes the onchain payment and retries the request. Turnkey plugs into this flow through@turnkey/viem, which provides a viem-compatible account that signs via the secure enclave. This replaces the raw private key that x402 clients normally use.
Create a Turnkey-backed viem account
Instead of using a raw private key with
privateKeyToAccount(), create a viem account backed by Turnkey:Register the x402 client
Pass the Turnkey account to the x402 EVM scheme. The
ExactEvmScheme accepts any viem account, so the Turnkey signer works as a drop-in replacement:3. MPP payment
The Machine Payments Protocol (MPP) is an open standard co-authored by Tempo and Stripe that lets agents pay for services over HTTP. Like x402, an MPP-enabled server responds with a 402 challenge when payment is required. The agent signs a payment credential and retries the request. The Turnkey integration follows the same pattern as x402: themppx client accepts a viem account, so a Turnkey-backed signer works as a drop-in.
Create the MPP client with a Turnkey signer
Pass the Turnkey-backed viem account from the previous example to the MPP client. The
tempo method handles stablecoin payments on the Tempo network: