AdaptersCustom Adapters

Custom Adapters

If your merchant platform isn’t covered by the shipped adapters, you can write your own. An adapter is just a class that implements Agorio’s merchant adapter surface — the same surface Shopify, WooCommerce, and BigCommerce implement.

The adapter surface

At minimum an adapter maps the platform’s API onto these operations:

  • list — return catalog products.
  • search — find products matching a query.
  • get — fetch a single product by id.
  • checkout.create — open a checkout / cart for one or more line items.
  • checkout.complete — finalize the checkout into an order.

Optionally, an adapter can also expose order tracking (as BigCommerce does).

Because all adapters share this surface, the ShoppingAgent treats your custom adapter exactly like a built-in one — drop it into the merchants array and the agent’s 17 tools work against it unchanged.

Composable HTTP

Adapters accept a fetch: option, so you can layer in retry, rate-limiting, and agent-identity attestation without changing the adapter itself:

import { createHttpClient } from '@agorio/sdk';
 
const fetchClient = createHttpClient({
  retry: { retries: 3 },
  rateLimit: { tokensPerInterval: 5, intervalMs: 1000 },
});
 
const merchant = new MyAdapter({ /* … */, fetch: fetchClient });

Publishing your adapter

When your adapter is ready, follow the adapter SDK guide (docs/guides/adapter-sdk.md in the repository) for the conventions, then open a PR to list it in the adapters registry. The registry is the discovery point for community adapters, and the adapter-template concept there gives you a starting scaffold.