{"id":19829725,"url":"https://github.com/patterns-ai-core/ecommerce-ai-assistant-demo","last_synced_at":"2025-08-16T08:14:22.511Z","repository":{"id":229402508,"uuid":"776629897","full_name":"patterns-ai-core/ecommerce-ai-assistant-demo","owner":"patterns-ai-core","description":"An e-commerce AI assistant built with Langchain.rb","archived":false,"fork":false,"pushed_at":"2024-10-23T19:17:57.000Z","size":65,"stargazers_count":55,"open_issues_count":5,"forks_count":9,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-01T14:45:13.017Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/patterns-ai-core.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-03-24T03:01:07.000Z","updated_at":"2025-04-01T13:23:04.000Z","dependencies_parsed_at":"2024-06-16T05:24:55.465Z","dependency_job_id":"02951200-abcb-45ee-acbf-06b4be9a80ee","html_url":"https://github.com/patterns-ai-core/ecommerce-ai-assistant-demo","commit_stats":null,"previous_names":["andreibondarev/ecommerce-ai-assistant","patterns-ai-core/ecommerce-ai-assistant-demo"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/patterns-ai-core/ecommerce-ai-assistant-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patterns-ai-core%2Fecommerce-ai-assistant-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patterns-ai-core%2Fecommerce-ai-assistant-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patterns-ai-core%2Fecommerce-ai-assistant-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patterns-ai-core%2Fecommerce-ai-assistant-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patterns-ai-core","download_url":"https://codeload.github.com/patterns-ai-core/ecommerce-ai-assistant-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patterns-ai-core%2Fecommerce-ai-assistant-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270684386,"owners_count":24627784,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T11:19:44.957Z","updated_at":"2025-08-16T08:14:22.489Z","avatar_url":"https://github.com/patterns-ai-core.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# E-commerce AI Agent\nAn e-commerce AI Agent built with [Langchain.rb](https://github.com/andreibondarev/langchainrb) and OpenAI. This demo articulates the idea that business logic will now also live in prompts and be handled by AI Agents. A lot of modern (Rails) software development is stringing services (classes and APIs) together. This demo illustrate how AI can assist in executing business logic and orchestrating calls to various services.\n\n### Background\n![Nerds   Threads](https://github.com/user-attachments/assets/3be65a6d-f1aa-40af-888d-63c0c46d07cc)\n\n### Installation\n1. `git clone`\n2. `bundle install`\n3. `cp .env.example .env` and fill it out with your values (OpenAI API key).\n4. Run `sendmail` in a separate tab.\n\n### Running\n1. Install the dependencies:\n```bash\nbundle install\n```\n\n2. Run setup_db.rb to set up the SQLite database:\n```bash\nruby setup_db.rb\n```\n\n3. Run the rack server:\n```bash\nbundle exec rackup config.ru\n```\n\n4. Navigate to the `localhost:9292` in the browser.\n\n5. Insert the instructions in the \"Instructions\" field:\n```\nYou are an AI that runs an e-commerce store called \"Nerds \u0026 Threads\" that sells comfy nerdy t-shirts for software engineers that work from home.\n\nYou have access to the shipping service, inventory service, order management, payment gateway, email service and customer management systems.\n\nYou are only responsible for processing new orders. Refuse all other workflows.\n\nNew order step by step procedures below. Follow them in this exact sequential (non-parallel) order:\nStep 1. Create customer account if it doesn't exist\nStep 2. Check inventory for items\nStep 3. Calculate total amount\nStep 4. Charge customer\nStep 5. Create order\nStep 6. Create shipping label. If the address is in Europe, use DHL. If the address is in US, use FedEx.\nStep 7. Send an email notification to customer\n```\n\n6. Insert the below in the \"Event\" field and click \"Run\" to run the AI Agent:\n```\nNew order: { customer_email: 'andrei@sourcelabs.io', quantity: 5, sku: 'Y3048509', address: '667 Madison Avenue, New York, NY 10065'}\n```\n\n7. Observe the \"Execution Output\" and confirm that it is correct\n\n8. Attempt to return an order by inserting in the \"Event\" field and running the AI Agent:\n```\nReturn Order: { customer_email: 'andrei@sourcelabs.io', order_id: 1 }\n```\n\n9. Update the \"Instructions\" field with instructions that include Return Order procedures:\n```\nYou are an AI that runs an e-commerce store called \"Nerds \u0026 Threads\" that sells comfy nerdy t-shirts for software engineers that work from home.\n\nYou have access to the shipping service, inventory service, order management, payment gateway, email service and customer management systems.\n\nYou are only responsible for processing new orders and returning orders. Refuse all other workflows.\n\nNew order step by step procedures below. Follow them in this exact sequential (non-parallel) order:\nStep 1. Create customer account if it doesn't exist\nStep 2. Check inventory for items\nStep 3. Calculate total amount\nStep 4. Charge customer\nStep 5. Create order\nStep 6. Create shipping label. If the address is in Europe, use DHL. If the address is in US, use FedEx.\nStep 7. Send an email notification to customer\n\nReturn Order step by step procedures.\nFollow them in this exact sequential (non-parallel) order:\n\nStep 1. Lookup the order\nStep 2. Refund the payment\nStep 3. Mark the order as refunded\n```\n\n10. Rerun the Return Order event:\n```\nReturn Order: { customer_email: 'andrei@sourcelabs.io', order_id: 1 }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatterns-ai-core%2Fecommerce-ai-assistant-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatterns-ai-core%2Fecommerce-ai-assistant-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatterns-ai-core%2Fecommerce-ai-assistant-demo/lists"}