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 operationsTwo 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
| Area | Read operations | Write operations |
|---|---|---|
| Payments | List payments, get a payment | Create a payment (moves money - requires confirmation) |
| Refunds | List refunds | Create a refund (moves money - requires confirmation) |
| Customers | List customers, get a customer | Create a customer |
| Balances | List balances, get a balance | — |
| Settlements | List settlements, get a settlement (or the next/open one) | — |
| Payment methods | List active methods | — |
| Subscriptions | List subscriptions | Create a subscription (ongoing financial effect - treat like money-moving) |
| Sales invoices | List sales invoices, get a sales invoice | Create or update a sales invoice |
| Payment links | List payment links, get a link, list a link's payments | Create a payment link (requires confirmation), update a link |
Getting started
npm install @mollie/agent-toolkitUse 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
- See the main Mollie MCP server guide for connecting an AI tool directly to your live Mollie account.
- Or Mollie Agent skills guide for AI coding assistant know-how while you build your integration.
Updated 18 days ago