Registry / payments / stripe-agent-toolkit

stripe-agent-toolkit

JSON →
library0.7.0pypypi✓ verified 79d ago

The Stripe Agent Toolkit is a Python library (current version 0.7.0) enabling popular agent frameworks like OpenAI's Agent SDK, LangChain, and CrewAI to integrate with Stripe APIs through function calling. It's built directly on top of the Stripe Python SDK, providing a subset of Stripe's API functionality to facilitate agentic workflows for payments, billing, and more. The library is actively maintained, with updates following the Stripe API's monthly minor releases and twice-yearly major releases.

pip install stripe-agent-toolkit
INSTALL
IMPORT
SIG · STRIPE-AGENT-TOOLK
S
stripe-agent-toolkit
paymentspythonv0.7.0
Install
13.9s avg
Import
Disk
38MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.6.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 1.51s
py 3.11
✓ —
✓ 38.6s
py 3.12
✓ —
4/8 runs
py 3.13
✓ —
4/8 runs
py 3.9
✓ —
✓ 1.7s
38MB installed
● package 38MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Configuration
from stripe_agent_toolkit import Configuration
from stripe_agent_toolkit import StripeAgentToolkit
Context
from stripe_agent_toolkit import Context
VERSION
from stripe_agent_toolkit import VERSION

This quickstart demonstrates how to initialize the `stripe-agent-toolkit` with your Stripe secret key and configure its available actions. It emphasizes the use of Restricted API Keys (rk_*) for enhanced security and outlines how to retrieve the tools that an AI agent can then utilize. The example includes a basic setup, indicating where an agent framework would integrate with the toolkit's provided tools, and strongly recommends setting the Stripe API key via environment variables.

import asyncio import os from stripe_agent_toolkit.openai.toolkit import create_stripe_agent_toolkit async def main(): # It is strongly recommended to use a Restricted API Key (rk_*) for better security. # Store your secret key securely, e.g., in an environment variable. stripe_secret_key = os.environ.get('STRIPE_SECRET_KEY', 'sk_test_YOUR_TEST_KEY') if not stripe_secret_key or stripe_secret_key == 'sk_test_YOUR_TEST_KEY': print("Warning: Please set the STRIPE_SECRET_KEY environment variable ", "or replace 'sk_test_YOUR_TEST_KEY' with a real (test) key.") return # Initialize the toolkit with your secret key and specify allowed actions. # Tool availability is determined by permissions on the restricted key. toolkit = await create_stripe_agent_toolkit( secret_key=stripe_secret_key, configuration={ "actions": { "payment_links": { "create": True } } } ) try: tools = toolkit.get_tools() print(f"Available Stripe Agent Tools: {[tool.name for tool in tools]}") # Example: Integrate with an agent framework (e.g., OpenAI's Agent SDK or LangChain) # This part assumes an agent framework is set up to consume these tools. # For a full agent example, refer to the Stripe Agent Toolkit documentation. # In a real agent workflow, the agent would call these tools based on user prompts. # For demonstration, let's pretend to call a tool. if 'create_payment_link' in [tool.name for tool in tools]: print("\n'create_payment_link' tool is available. Your agent can now create payment links.") # Example of how an agent might use a tool (simplified representation): # agent_response = await agent.run("Create a payment link for a product 'Premium Widget' for $25.00.") # print(agent_response) finally: # Clean up resources when done. await toolkit.close() if __name__ == "__main__": asyncio.run(main())
Debug
Known issues
gotchaAlways use Restricted API Keys (rk_*) in production for enhanced security and to limit the agent's access to only the necessary Stripe API functionality. Standard secret keys (sk_*) grant broad access.
fix
Create a Restricted API Key in your Stripe Dashboard (dashboard.stripe.com/apikeys) and assign only the minimum required permissions for your agent's tasks. Use this rk_ key instead of a full sk_ key.
affects: All versions
gotchaThe Stripe Agent Toolkit does not expose the entire Stripe API. It provides a curated subset of functionalities relevant to agentic workflows. Attempting to access unsupported Stripe API features through the toolkit will result in errors.
fix
Consult the official `stripe-agent-toolkit` documentation and examples to understand the supported Stripe API actions. If a required API is missing, consider contributing or using the raw Stripe Python SDK for that specific functionality outside the agent toolkit context.
affects: All versions
gotchaAgent behavior can be non-deterministic. When integrating the toolkit with AI agents that perform financial transactions, unexpected outcomes can occur if not properly managed.
fix
Thoroughly test your agent in a sandbox environment (using Stripe's test mode keys) and implement robust error handling, monitoring, and human oversight mechanisms. Define clear boundaries for agent actions and consider explicit user confirmation steps for critical financial operations.
affects: All versions
deprecatedDirect instantiation of `StripeAgentToolkit` via `StripeAgentToolkit(...)` might be replaced or augmented by asynchronous factory functions like `create_stripe_agent_toolkit(...)` in future major versions, especially for frameworks that benefit from async initialization.
fix
While `StripeAgentToolkit(...)` currently works, it's advisable to use the `create_stripe_agent_toolkit()` asynchronous factory function when available and appropriate for your agent framework, as shown in more recent quickstarts.
affects: Potentially future major versions (e.g., 1.0.0+)
Upgrade
Version history
0.7.0latest on PyPI · released Feb 12, 2026
Audit
Dependencies
striperequiredCore functionality built on Stripe Python SDK.
openaioptionalOptional dependency for OpenAI's Agent SDK integration.
langchainoptionalOptional dependency for LangChain integration.
crewaioptionalOptional dependency for CrewAI integration.
Agent activity
33 hits · last 30 days
node
26
OpenAI (training)
1
Resources
stripe-agent-toolkit — pip install stripe-agent-toolkit · libregistry