Agent Toolkit - your own AI agent on Mollie

What is Agent Toolkit?

@mollie/agent-toolkit is a ready-made code library you can plug into your own AI agent: OpenAI's Agents SDK, LangChain or the Vercel AI SDK. Instead of writing custom code to connect your agent to Mollie, you get Mollie actions pre-packaged as building blocks your AI can call directly to look up a payment, list balances, issue a refund, create a subscription and more.

Who is this for?

Anyone building their own AI product that needs to read or act on Mollie data can benefit from this offering - a support agent checking a customer's payment status, a finance assistant helping reconcile settlements, a reporting tool answering questions about the account in natural language etc. Instead of a multi-week integration process, you can simply pick from a pre-built, tested set of actions.

📘

This toolkit can perform financial operations

Two of the following rules aren't optional when working with the Agent Toolkit:

  • Default to read-only permissions. Always list exactly which tools your agent may use and never give it all persmissions by default. Anything the AI reads (a customer's message, a description etc) could otherwise be used to steer it into calling a tool it shouldn't.
  • A human must confirm any action that moves funds. It's adviced to put a person (or build a server-side check) between the AI's decision to create a payment, refund, subscription, or payment link and it actually happening. Telling the model "ask the user first" in its instructions is not enough - that's a suggestion, not a safeguard and it can be overridden.

What Agent Toolkit can do

AreaRead operationsWrite operations
PaymentsList payments, get a paymentCreate a payment (moves money - requires confirmation)
RefundsList refundsCreate a refund (moves money - requires confirmation)
CustomersList customers, get a customerCreate a customer
BalancesList balances, get a balance—
SettlementsList settlements, get a settlement (or the next/open one)—
Payment methodsList active methods—
SubscriptionsList subscriptionsCreate a subscription (ongoing financial effect - treat like money-moving)
Sales invoicesList sales invoices, get a sales invoiceCreate or update a sales invoice
Payment linksList payment links, get a link, list a link's paymentsCreate a payment link (requires confirmation), update a link

Getting started

npm install @mollie/agent-toolkit

Use a test API key while you build - it does not process an actual payment and hence has no financial effect. Only switch to a live key once you've checked how your agent behaves (including testing how it responds to unexpected or misleading inputs) and you have a confirmation step in place for anything that moves funds.

import { MollieAgentToolkit } from "@mollie/agent-toolkit";
import { toVercelAITools } from "@mollie/agent-toolkit/vercel-ai";
import { generateText } from "ai";

// Read-only agent — safe to run first. Add write tools only once you
// have a confirmation step in place.
const toolkit = new MollieAgentToolkit({
  apiKey: process.env.MOLLIE_API_KEY!,
  tools: ["list_payments", "get_payment", "list_balances", "get_balance"],
});

const { text } = await generateText({
  model: /* your chosen model provider */,
  tools: toVercelAITools(toolkit),
  prompt: "List my last 5 payments",
});

OpenAI's Agents SDK and LangChain are supported the same way, with a different adapter import. See the full documentation & examples on GitHub, plus a complete example with write-tool confirmation built in.

Also available


Did this page help you?