Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: add Tolca action provider
  • Loading branch information
yayabough authored Nov 12, 2026
commit 9e126a6ed8647c4db99f48c8a49a98fa5802874d
13 changes: 13 additions & 0 deletions typescript/agentkit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,19 @@ const agent = createAgent({
</table>
</details>
<details>
<summary><strong>Tolca</strong></summary>
<table width="100%">
<tr>
<td width="200"><code>check_x402_seller</code></td>
<td width="768">Checks an x402 seller before paying it (OFAC crypto addresses, official USDC, mainnet, Bazaar price and payTo) and returns allow, review or block with a signed receipt.</td>
</tr>
<tr>
<td width="200"><code>screen_sanctions</code></td>
<td width="768">Screens a company or person name against US, UK and EU sanctions lists and returns allow, review or block with the matching entries.</td>
</tr>
</table>
</details>
<details>
<summary><strong>Twitter</strong></summary>
<table width="100%">
<tr>
Expand Down
1 change: 1 addition & 0 deletions typescript/agentkit/src/action-providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export * from "./opensea";
export * from "./spl";
export * from "./superfluid";
export * from "./sushi";
export * from "./tolca";
export * from "./truemarkets";
export * from "./twitter";
export * from "./wallet";
Expand Down
59 changes: 59 additions & 0 deletions typescript/agentkit/src/action-providers/tolca/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Tolca Action Provider

This directory contains the **TolcaActionProvider**, which lets an agent check who it is about to pay before an x402 payment.

## Directory Structure

```
tolca/
├── tolcaActionProvider.ts # Provider with the two actions
├── tolcaActionProvider.test.ts # Tests
├── schemas.ts # Action schemas and configuration type
├── index.ts # Main exports
└── README.md # This file
```

## Actions

### `check_x402_seller`

Checks an x402 seller before the agent pays it ($0.01 USDC per check). Give the seller's `url` (Tolca reads its 402 payment request without paying it) or the `paymentRequired` object the agent already received, and optionally the `sellerName`.

Tolca checks:

- the `payTo` wallet against OFAC SDN crypto addresses
- that the asset is the official USDC contract on its network, and that the network is a mainnet
- that price and `payTo` match the seller's Coinbase x402 Bazaar listing
- optionally, the seller's company name against US, UK and EU sanctions lists

The answer's `action` is `allow`, `review` (ask a human before paying) or `block`, with the reasons and an Ed25519-signed receipt.

### `screen_sanctions`

Screens a company or person name against US (Consolidated Screening List, including OFAC SDN), UK and EU sanctions lists ($0.005 USDC per check). Returns `allow`, `review` or `block`, the matching entries, the date of each list and a signed receipt.

## Payment

Each call is paid per use over x402 from the agent's own wallet, in USDC on Base mainnet or Solana mainnet. No API key or account is needed.

Before paying, the provider reads Tolca's 402 payment request and refuses to pay unless every option goes to Tolca's own wallet, in official USDC, at or below `maxPriceUsdc` (default 0.02 USDC).

## Configuration

```typescript
import { tolcaActionProvider } from "@coinbase/agentkit";

const provider = tolcaActionProvider({
maxPriceUsdc: 0.02, // optional, highest price paid for one call
});
```

## Network Support

- Base mainnet (`base-mainnet`)
- Solana mainnet (`solana-mainnet`)

## Notes

- Signed receipts can be verified at https://tolca.tonbot.ca/receipts/verify with the public key at https://tolca.tonbot.ca/.well-known/tolca-receipt-key.json.
- API reference: https://tolca.tonbot.ca/openapi.json
2 changes: 2 additions & 0 deletions typescript/agentkit/src/action-providers/tolca/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { TolcaActionProvider, tolcaActionProvider } from "./tolcaActionProvider";
export * from "./schemas";
60 changes: 60 additions & 0 deletions typescript/agentkit/src/action-providers/tolca/schemas.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { z } from "zod";

/**
* Configuration for the TolcaActionProvider.
*/
export interface TolcaConfig {
/**
* Base URL of the Tolca API. Defaults to https://tolca.tonbot.ca.
*/
baseUrl?: string;

/**
* Highest price, in USDC, the provider will pay for one Tolca call.
* Defaults to 0.02 (payment-check costs 0.01, sanctions screening 0.005).
*/
maxPriceUsdc?: number;
}

/**
* Input schema for checking an x402 seller before paying it.
*/
export const CheckX402SellerSchema = z
.object({
url: z
.string()
.url()
.nullable()
.describe(
"URL of the x402 endpoint the agent is about to pay. Tolca requests it without paying and reads its 402 payment request. Provide this or paymentRequired.",
),
paymentRequired: z
.record(z.string(), z.unknown())
.nullable()
.describe(
"The decoded 402 payment request (PAYMENT-REQUIRED header or 402 body) the agent received from the seller. Provide this or url.",
),
sellerName: z
.string()
.max(160)
.nullable()
.describe(
"Optional legal name of the company behind the seller, to also screen it against US, UK and EU sanctions lists.",
),
})
.strip()
.describe("Check an x402 seller with Tolca payment-check before paying it");

/**
* Input schema for screening a company or person name against sanctions lists.
*/
export const ScreenSanctionsSchema = z
.object({
name: z
.string()
.min(2)
.max(160)
.describe("Name of the company or person to screen, e.g. 'Acme Trading Ltd.'"),
})
.strip()
.describe("Screen a company or person name against sanctions lists with Tolca");
Loading