4 Commits

Author SHA1 Message Date
Steve Androulakis
a4567c4e42 cover empty stripe api env 2025-05-26 14:11:49 -07:00
Dallas Young
ae4811a8d0 Update setup.md
Edited verbiage for the create invoice explanation
2025-05-26 14:06:31 -07:00
Dallas Young
470ef08615 Update create_invoice.py
Remove the example invoice function as the 'else' statement already captures this
2025-05-26 14:06:31 -07:00
Dallas Young
3e9439022e Update setup.md
Detail that the stripe key must be commented out in order to create a dummy invoice
2025-05-26 14:06:31 -07:00
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
* 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`
* 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)
- `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 />
[ ] 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:
"""Create and finalize a Stripe invoice."""
# 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(
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",
"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",
}