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
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.fixCreate 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.fixConsult 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.fixThoroughly 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.fixWhile `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.