{"id":7771,"library":"stripe-agent-toolkit","title":"Stripe Agent Toolkit","description":"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.","status":"active","version":"0.7.0","language":"en","source_language":"en","source_url":"https://github.com/waldzellai/agent-toolkit","tags":["stripe","api","payments","agents","ai","langchain","openai","crewai","financial"],"install":[{"cmd":"pip install stripe-agent-toolkit","lang":"bash","label":"Install core package"},{"cmd":"pip install stripe-agent-toolkit[openai,langchain,crewai,strands]","lang":"bash","label":"Install with all optional dependencies"}],"dependencies":[{"reason":"Core functionality built on Stripe Python SDK.","package":"stripe"},{"reason":"Optional dependency for OpenAI's Agent SDK integration.","package":"openai","optional":true},{"reason":"Optional dependency for LangChain integration.","package":"langchain","optional":true},{"reason":"Optional dependency for CrewAI integration.","package":"crewai","optional":true}],"imports":[{"note":"For OpenAI's Agent SDK integration, direct class import.","symbol":"StripeAgentToolkit","correct":"from stripe_agent_toolkit.openai.toolkit import StripeAgentToolkit"},{"note":"For LangChain integration, direct class import.","symbol":"StripeAgentToolkit","correct":"from stripe_agent_toolkit.langchain.toolkit import StripeAgentToolkit"},{"note":"Asynchronous factory function for OpenAI Agent SDK. Recommended in recent examples.","symbol":"create_stripe_agent_toolkit","correct":"from stripe_agent_toolkit.openai.toolkit import create_stripe_agent_toolkit"},{"note":"Asynchronous factory function for LangChain. Recommended in recent examples.","symbol":"create_stripe_agent_toolkit","correct":"from stripe_agent_toolkit.langchain.toolkit import create_stripe_agent_toolkit"},{"note":"For Vercel's AI SDK and Model Context Protocol (MCP) integrations.","symbol":"create_stripe_agent_toolkit","correct":"from stripe_agent_toolkit.ai_sdk import create_stripe_agent_toolkit"}],"quickstart":{"code":"import asyncio\nimport os\nfrom stripe_agent_toolkit.openai.toolkit import create_stripe_agent_toolkit\n\nasync def main():\n    # It is strongly recommended to use a Restricted API Key (rk_*) for better security.\n    # Store your secret key securely, e.g., in an environment variable.\n    stripe_secret_key = os.environ.get('STRIPE_SECRET_KEY', 'sk_test_YOUR_TEST_KEY')\n\n    if not stripe_secret_key or stripe_secret_key == 'sk_test_YOUR_TEST_KEY':\n        print(\"Warning: Please set the STRIPE_SECRET_KEY environment variable \",\n              \"or replace 'sk_test_YOUR_TEST_KEY' with a real (test) key.\")\n        return\n\n    # Initialize the toolkit with your secret key and specify allowed actions.\n    # Tool availability is determined by permissions on the restricted key.\n    toolkit = await create_stripe_agent_toolkit(\n        secret_key=stripe_secret_key,\n        configuration={\n            \"actions\": {\n                \"payment_links\": {\n                    \"create\": True\n                }\n            }\n        }\n    )\n\n    try:\n        tools = toolkit.get_tools()\n        print(f\"Available Stripe Agent Tools: {[tool.name for tool in tools]}\")\n\n        # Example: Integrate with an agent framework (e.g., OpenAI's Agent SDK or LangChain)\n        # This part assumes an agent framework is set up to consume these tools.\n        # For a full agent example, refer to the Stripe Agent Toolkit documentation.\n\n        # In a real agent workflow, the agent would call these tools based on user prompts.\n        # For demonstration, let's pretend to call a tool.\n        if 'create_payment_link' in [tool.name for tool in tools]:\n            print(\"\\n'create_payment_link' tool is available. Your agent can now create payment links.\")\n            # Example of how an agent might use a tool (simplified representation):\n            # agent_response = await agent.run(\"Create a payment link for a product 'Premium Widget' for $25.00.\")\n            # print(agent_response)\n\n    finally:\n        # Clean up resources when done.\n        await toolkit.close()\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n","lang":"python","description":"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."},"warnings":[{"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.","message":"Always 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.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"The 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.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"Agent behavior can be non-deterministic. When integrating the toolkit with AI agents that perform financial transactions, unexpected outcomes can occur if not properly managed.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"Direct 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.","severity":"deprecated","affected_versions":"Potentially future major versions (e.g., 1.0.0+)"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Ensure the `secret_key` parameter is correctly passed to `create_stripe_agent_toolkit` or `StripeAgentToolkit`, typically by loading it from an environment variable (e.g., `os.environ.get('STRIPE_SECRET_KEY')`).","cause":"The Stripe secret key was not provided during the toolkit initialization or was an empty string.","error":"stripe.error.AuthenticationError: No API key provided."},{"fix":"Review the permissions configured for your Restricted API Key in the Stripe Dashboard. Add the specific read/write permissions required for the Stripe API resources (e.g., `payment_links`, `products`) that your agent needs to interact with.","cause":"The Restricted API Key (rk_*) used to initialize the toolkit does not have the necessary permissions for the Stripe API action the agent attempted to perform.","error":"stripe.error.PermissionError: Your API key does not have permissions to access this resource."},{"fix":"Verify that the desired Stripe API functionality is part of the supported subset offered by the `stripe-agent-toolkit`. If it's not, you may need to use the native `stripe` Python SDK directly for that specific call or rethink the agent's approach.","cause":"The agent attempted to call a Stripe API function that is not exposed or supported by the `stripe-agent-toolkit`.","error":"AttributeError: 'StripeAgentToolkit' object has no attribute 'some_missing_api_call'"},{"fix":"Install the necessary optional dependencies using `pip install stripe-agent-toolkit[openai]` (or `[langchain]`, `[crewai]`, etc.) to ensure the submodule is available.","cause":"Attempting to import from `stripe_agent_toolkit.openai.toolkit` (or similar submodules for other frameworks) without having the corresponding optional dependencies installed.","error":"ModuleNotFoundError: No module named 'stripe_agent_toolkit.openai'"}]}