Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsMay 8, 2026·4 min de lecture

Stripe Agent Toolkit — Payments SDK for LLM Agents

Stripe Agent Toolkit gives LangChain, OpenAI Agents SDK, CrewAI, and Vercel AI SDK direct tool access to charges, customers, and refunds.

Stripe
Stripe · Community
Introduction

The Stripe Agent Toolkit is an official open-source SDK from Stripe that exposes Stripe's API as tool calls for LLM agents. Available in Python and TypeScript with first-class adapters for LangChain, OpenAI Agents SDK, CrewAI, and the Vercel AI SDK. Best for: AI shopping assistants, billing chatbots, refund support agents, anywhere an LLM needs to actually move money. Works with: any framework that accepts a tools list — Claude, GPT-4o, Gemini, Llama. Setup time: 3 minutes (npm/pip + STRIPE_SECRET_KEY).


Install

# Python
pip install stripe-agent-toolkit

# TypeScript
npm install @stripe/agent-toolkit

LangChain (Python)

from stripe_agent_toolkit.langchain.toolkit import StripeAgentToolkit
from langchain_openai import ChatOpenAI
from langchain.agents import AgentExecutor, create_tool_calling_agent

stripe_toolkit = StripeAgentToolkit(
    secret_key="sk_test_...",
    configuration={
        "actions": {
            "payment_links": {"create": True},
            "products":      {"create": True, "read": True},
            "prices":        {"create": True},
            "customers":     {"read": True},
        }
    },
)

llm = ChatOpenAI(model="gpt-4o")
agent = create_tool_calling_agent(llm, stripe_toolkit.get_tools(), prompt)
executor = AgentExecutor(agent=agent, tools=stripe_toolkit.get_tools())

executor.invoke({"input": "Create a $50 one-time product called Founders T-Shirt and give me the payment link."})

OpenAI Agents SDK (TypeScript)

import { StripeAgentToolkit } from "@stripe/agent-toolkit/openai";
import OpenAI from "openai";

const stripe = new StripeAgentToolkit({
  secretKey: process.env.STRIPE_SECRET_KEY!,
  configuration: {
    actions: {
      paymentLinks: { create: true },
      invoices: { create: true, update: true },
    },
  },
});

const tools = stripe.getTools();
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
  model: "gpt-4o",
  messages: [{ role: "user", content: "Email Acme Corp a $5,000 invoice for the May retainer." }],
  tools,
});

Action surface

Resource Available actions
Customers create, read, update
Products + Prices create, read
Payment Links create
Invoices + Items create, update, finalize
Refunds create
Subscriptions read, update, cancel

Restricted keys

Always use a Stripe restricted key (rk_live_...) scoped to only the actions the agent needs — never a full secret key. Generate at dashboard.stripe.com/apikeys → Restricted keys.


FAQ

Q: Is the Agent Toolkit production-safe? A: Yes — it's the same Stripe SDK underneath. The toolkit just narrows the action surface for LLM tool calling. Use restricted keys, scope actions, and treat any agent-initiated charge as user-confirmed (require a human-in-the-loop step before high-value writes).

Q: Does it support test mode? A: Yes — pass any sk_test_... key. Stripe's test mode supports the entire API including payment links, subscriptions, refunds, with no real money moving. Test cards: 4242 4242 4242 4242.

Q: Can I add custom Stripe actions? A: Yes — the toolkit exports a base Tool class. Subclass it, point at any Stripe API endpoint, register with the toolkit. Useful for org-specific workflows like custom metadata writes or Connect platform actions.


Quick Use

  1. pip install stripe-agent-toolkit (or npm install @stripe/agent-toolkit)
  2. Generate restricted key at dashboard.stripe.com/apikeys
  3. Add toolkit tools to any LangChain / OpenAI / CrewAI agent

Intro

The Stripe Agent Toolkit is an official open-source SDK from Stripe that exposes Stripe's API as tool calls for LLM agents. Available in Python and TypeScript with first-class adapters for LangChain, OpenAI Agents SDK, CrewAI, and the Vercel AI SDK. Best for: AI shopping assistants, billing chatbots, refund support agents, anywhere an LLM needs to actually move money. Works with: any framework that accepts a tools list — Claude, GPT-4o, Gemini, Llama. Setup time: 3 minutes (npm/pip + STRIPE_SECRET_KEY).


Install

# Python
pip install stripe-agent-toolkit

# TypeScript
npm install @stripe/agent-toolkit

LangChain (Python)

from stripe_agent_toolkit.langchain.toolkit import StripeAgentToolkit
from langchain_openai import ChatOpenAI
from langchain.agents import AgentExecutor, create_tool_calling_agent

stripe_toolkit = StripeAgentToolkit(
    secret_key="sk_test_...",
    configuration={
        "actions": {
            "payment_links": {"create": True},
            "products":      {"create": True, "read": True},
            "prices":        {"create": True},
            "customers":     {"read": True},
        }
    },
)

llm = ChatOpenAI(model="gpt-4o")
agent = create_tool_calling_agent(llm, stripe_toolkit.get_tools(), prompt)
executor = AgentExecutor(agent=agent, tools=stripe_toolkit.get_tools())

executor.invoke({"input": "Create a $50 one-time product called Founders T-Shirt and give me the payment link."})

OpenAI Agents SDK (TypeScript)

import { StripeAgentToolkit } from "@stripe/agent-toolkit/openai";
import OpenAI from "openai";

const stripe = new StripeAgentToolkit({
  secretKey: process.env.STRIPE_SECRET_KEY!,
  configuration: {
    actions: {
      paymentLinks: { create: true },
      invoices: { create: true, update: true },
    },
  },
});

const tools = stripe.getTools();
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
  model: "gpt-4o",
  messages: [{ role: "user", content: "Email Acme Corp a $5,000 invoice for the May retainer." }],
  tools,
});

Action surface

Resource Available actions
Customers create, read, update
Products + Prices create, read
Payment Links create
Invoices + Items create, update, finalize
Refunds create
Subscriptions read, update, cancel

Restricted keys

Always use a Stripe restricted key (rk_live_...) scoped to only the actions the agent needs — never a full secret key. Generate at dashboard.stripe.com/apikeys → Restricted keys.


FAQ

Q: Is the Agent Toolkit production-safe? A: Yes — it's the same Stripe SDK underneath. The toolkit just narrows the action surface for LLM tool calling. Use restricted keys, scope actions, and treat any agent-initiated charge as user-confirmed (require a human-in-the-loop step before high-value writes).

Q: Does it support test mode? A: Yes — pass any sk_test_... key. Stripe's test mode supports the entire API including payment links, subscriptions, refunds, with no real money moving. Test cards: 4242 4242 4242 4242.

Q: Can I add custom Stripe actions? A: Yes — the toolkit exports a base Tool class. Subclass it, point at any Stripe API endpoint, register with the toolkit. Useful for org-specific workflows like custom metadata writes or Connect platform actions.


Source & Thanks

Built by Stripe. Licensed under MIT.

stripe/agent-toolkit — ⭐ 1,400+

🙏

Source et remerciements

Built by Stripe. Licensed under MIT.

stripe/agent-toolkit — ⭐ 1,400+

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires