Review dallastexas92 nostripekey (#35)

* Update setup.md

Detail that the stripe key must be commented out in order to create a dummy invoice

* Update create_invoice.py

Remove the example invoice function as the 'else' statement already captures this

* Update setup.md

Edited verbiage for the create invoice explanation

* cover empty stripe api env

---------

Co-authored-by: Dallas Young <33672687+dallastexas92@users.noreply.github.com>
This commit is contained in:
Steve Androulakis
2025-05-26 14:13:59 -07:00
committed by GitHub
parent f8e0dd3b2a
commit 847f4bbaef
2 changed files with 3 additions and 15 deletions

View File

@@ -166,7 +166,7 @@ Here is configuration guidance for specific goals. Travel and financial goals ha
* Requires a Stripe key for the `create_invoice` tool. Set this in the `STRIPE_API_KEY` environment variable in .env * Requires a Stripe key for the `create_invoice` tool. Set this in the `STRIPE_API_KEY` environment variable in .env
* It's free to sign up and get a key at [Stripe](https://stripe.com/) * It's free to sign up and get a key at [Stripe](https://stripe.com/)
* Set permissions for read-write on: `Credit Notes, Invoices, Customers and Customer Sessions` * Set permissions for read-write on: `Credit Notes, Invoices, Customers and Customer Sessions`
* If you're lazy go to `tools/create_invoice.py` and replace the `create_invoice` function with the mock `create_invoice_example` that exists in the same file. * If you don't have a Stripe key, comment out the STRIPE_API_KEY in the .env file, and a dummy invoice will be created rather than a Stripe invoice. The function can be found in `tools/create_invoice.py`
### Goal: Find a Premier League match, book train tickets to it and invoice the user for the cost (Replay 2025 Keynote) ### Goal: Find a Premier League match, book train tickets to it and invoice the user for the cost (Replay 2025 Keynote)
- `AGENT_GOAL=goal_match_train_invoice` - Focuses on Premier League match attendance with train booking and invoice generation - `AGENT_GOAL=goal_match_train_invoice` - Focuses on Premier League match attendance with train booking and invoice generation
@@ -252,4 +252,4 @@ For more details, check out [adding goals and tools guide](./adding-goals-and-to
[ ] `cd frontend`, `npm install`, `npx vite` <br /> [ ] `cd frontend`, `npm install`, `npx vite` <br />
[ ] Access the UI at `http://localhost:5173` <br /> [ ] Access the UI at `http://localhost:5173` <br />
And that's it! Happy AI Agent Exploring! And that's it! Happy AI Agent Exploring!

View File

@@ -27,7 +27,7 @@ def ensure_customer_exists(
def create_invoice(args: dict) -> dict: def create_invoice(args: dict) -> dict:
"""Create and finalize a Stripe invoice.""" """Create and finalize a Stripe invoice."""
# If an API key exists in the env file, find or create customer # If an API key exists in the env file, find or create customer
if stripe.api_key is not None: if stripe.api_key is not None and stripe.api_key != "":
customer_id = ensure_customer_exists( customer_id = ensure_customer_exists(
args.get("customer_id"), args.get("email", "default@example.com") args.get("customer_id"), args.get("email", "default@example.com")
) )
@@ -69,15 +69,3 @@ def create_invoice(args: dict) -> dict:
"invoiceURL": "https://pay.example.com/invoice/12345", "invoiceURL": "https://pay.example.com/invoice/12345",
"reference": "INV-12345", "reference": "INV-12345",
} }
def create_invoice_example(args: dict) -> dict:
"""
This is an example implementation of the CreateInvoice tool
Doesn't call any external services, just returns a dummy response
"""
print("[CreateInvoice] Creating invoice with:", args)
return {
"invoiceStatus": "generated",
"invoiceURL": "https://pay.example.com/invoice/12345",
"reference": "INV-12345",
}