Stripe Agent Toolkit 使用教程

Stripe Agent Toolkit 使用教程

agent-toolkit Python and TypeScript library for integrating the Stripe API into agentic workflows agent-toolkit 项目地址: https://gitcode.com/gh_mirrors/ag/agent-toolkit

1. 项目介绍

Stripe Agent Toolkit 是一个开源库,用于帮助开发者将 Stripe API 集成到各种代理工作流程中。该库支持 Python 和 TypeScript 语言,构建在 Stripe 的 Python 和 Node SDK 之上。它允许流行的代理框架如 OpenAI 的 Agent SDK、LangChain、CrewAI、Vercel 的 AI SDK 和 Model Context Protocol (MCP) 通过函数调用与 Stripe API 进行集成。

2. 项目快速启动

Python 版本

安装:

pip install stripe-agent-toolkit

使用:

from stripe_agent_toolkit.openai.toolkit import StripeAgentToolkit

stripe_agent_toolkit = StripeAgentToolkit(
    secret_key="sk_test_...",
    configuration={
        "actions": {
            "payment_links": {
                "create": True
            }
        }
    }
)

TypeScript 版本

安装:

npm install @stripe/agent-toolkit

使用:

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

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

3. 应用案例和最佳实践

创建支付链接

在 Python 中:

# 假设 stripe_agent_toolkit 已经初始化
payment_link = stripe_agent_toolkit.create_payment_link()

在 TypeScript 中:

// 假设 stripeAgentToolkit 已经初始化
const paymentLink = await stripeAgentToolkit.createPaymentLink();

集成到代理框架

在 Python 中使用 OpenAI 的 Agent SDK:

from agents import Agent
stripe_agent = Agent(
    name="Stripe Agent",
    instructions="You are an expert at integrating with Stripe",
    tools=stripe_agent_toolkit.get_tools()
)

在 TypeScript 中使用 LangChain:

import { AgentExecutor, createStructuredChatAgent } from "langchain/agents";
const tools = stripeAgentToolkit.getTools();
const agent = await createStructuredChatAgent({ llm, tools, prompt });

4. 典型生态项目

  • OpenAI's Agent SDK:用于创建可以与用户进行交互的智能代理。
  • LangChain:提供了一系列工具和库来帮助构建复杂的语言模型应用。
  • CrewAI:一个机器学习平台,用于构建和部署智能系统。
  • Vercel's AI SDK:为 Vercel 平台上的开发者提供了构建 AI 应用的工具。

以上就是 Stripe Agent Toolkit 的使用教程,希望对您的开发工作有所帮助。

agent-toolkit Python and TypeScript library for integrating the Stripe API into agentic workflows agent-toolkit 项目地址: https://gitcode.com/gh_mirrors/ag/agent-toolkit

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

凌洲丰Edwina

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值