diff --git a/.gitignore b/.gitignore index 090e44c..106d310 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,8 @@ +<<<<<<< HEAD +node_modules/ +dist/ +.env +======= # Dependencies node_modules/ npm-debug.log* @@ -96,3 +101,4 @@ template/.lua/ *.lua.skill.toml lua.skill.toml *.prompt.* +>>>>>>> final-submission/master diff --git a/README.md b/README.md index e008454..561ab37 100644 --- a/README.md +++ b/README.md @@ -1,508 +1,15 @@ - +# Odoo ERP Skill for Antigravity +## Overview +This skill enables an autonomous agent to interact with an Odoo ERP system to fetch inventory data and invoice statuses. It was built as part of the Lua Builder Community marketplace wishlist. -# Lua Platform Demo Examples +## Features +- **Stock Inquiry:** Retrieve real-time stock levels for specific SKUs. +- **Invoice Status:** Check whether specific invoices have been paid or are pending. -> Production-ready AI agent examples showcasing the Lua Platform capabilities - -This repository contains **4 complete, production-ready demo applications** built with Lua CLI v3.0.0. Each demo showcases different platform features and real-world use cases. - ---- - -## ๐ฏ What's Inside - -### 1. ๐๏ธ [E-commerce Shopping Assistant](./lua-shopping-assistant) -**Agent:** Mira -**Use Case:** Complete online shopping experience - -**Features:** -- Product search and catalog browsing -- Shopping cart management -- Checkout and order processing -- Order tracking - -**APIs Used:** Lua Platform APIs (Products, Baskets, Orders) - -**Perfect for:** E-commerce stores, online retailers, product catalogs - -[View Demo โ](./lua-shopping-assistant) - ---- - -### 2. ๐ง [Customer Support Agent](./lua-customer-support) -**Agent:** Alex -**Use Case:** Automated customer support with ticketing - -**Features:** -- Knowledge base search (vector similarity) -- Zendesk ticket creation and management -- Ticket status tracking -- **Webhooks** for real-time ticket updates -- **Scheduled jobs** for daily follow-ups - -**APIs Used:** Zendesk API + Lua Data API (vector search) - -**Perfect for:** Support teams, helpdesks, customer service automation - -[View Demo โ](./lua-customer-support) - ---- - -### 3. ๐ฆ [Financial Services Onboarding](./lua-financial-services) -**Agent:** Financial Onboarding Specialist -**Use Case:** KYC-compliant account opening - -**Features:** -- Multi-step onboarding journey -- Identity verification (Stripe Identity) -- Document upload and verification -- Risk assessment and suitability scoring -- **Webhooks** for verification events -- **PreProcessors** for validation -- **PostProcessors** for compliance disclaimers - -**APIs Used:** Stripe Identity API + Lua Data API - -**Perfect for:** Banks, fintech, financial services, regulated industries - -[View Demo โ](./lua-financial-services) - ---- - -### 4. ๐จ [Hotel Booking Agent](./lua-hotel-agent) -**Agent:** Hotel Concierge -**Use Case:** Hotel reservations and guest services - -**Features:** -- Room availability checking -- Reservation creation and management -- Booking modifications and cancellations -- Room service requests -- Confirmation code system - -**APIs Used:** Lua Data API - -**Perfect for:** Hotels, vacation rentals, hospitality services - -[View Demo โ](./lua-hotel-agent) - ---- - -## ๐ Quick Start - -### Prerequisites - -```bash -# Install Lua CLI globally -npm install -g lua-cli - -# Or use npx -npx lua-cli --version -``` - -### Try a Demo - -```bash -# 1. Navigate to any demo -cd lua-shopping-assistant - -# 2. Install dependencies -npm install - -# 3. Test tools interactively -lua test - -# 4. Start development mode (chat interface) -lua dev - -# 5. Push to server -lua push - -# 6. Deploy to production -lua deploy -``` - ---- - -## ๐ What's New in v3.0.0 - -All demos have been updated to use the **latest Lua CLI v3.0.0 patterns**: - -### 1. **Unified Agent Configuration** -```typescript -export const agent = new LuaAgent({ - name: "agent-name", - persona: `Detailed personality and behavior guidelines...`, - skills: [mySkill], - webhooks: [myWebhook], // NEW in v3.0.0 - jobs: [myScheduledJob], // NEW in v3.0.0 - preProcessors: [validator], // NEW in v3.0.0 - postProcessors: [formatter] // NEW in v3.0.0 -}); -``` - -### 2. **Webhooks** (Customer Support, Financial Services) -React to external events in real-time: -```typescript -const webhook = new LuaWebhook({ - name: 'zendesk-webhook', - execute: async (event) => { - // Handle external events - await User.send([{ type: 'text', text: 'Event received!' }]); - } -}); -``` - -### 3. **Scheduled Jobs** (Customer Support) -Automate recurring tasks: -```typescript -const job = new LuaJob({ - name: 'daily-followup', - schedule: { type: 'cron', pattern: '0 10 * * *' }, - execute: async (job) => { - // Run daily at 10 AM - } -}); -``` - -### 4. **PreProcessors & PostProcessors** (Financial Services) -Process messages before/after AI handling: -```typescript -const preProcessor = new PreProcessor({ - execute: async (message, user) => { - // Validate before processing - return { block: false }; - } -}); - -const postProcessor = new PostProcessor({ - execute: async (user, message, response, channel) => { - // Add disclaimers, format output - return { modifiedResponse: response + "\n\nDisclaimer..." }; - } -}); -``` - ---- - -## ๐ Feature Comparison - -| Feature | Shopping | Support | Financial | Hotel | -|---------|----------|---------|-----------|-------| -| **Platform APIs** | โ Products, Baskets, Orders | โ Data (vector) | โ Data | โ Data | -| **External APIs** | โ | โ Zendesk | โ Stripe Identity | โ | -| **Webhooks** | โ | โ Ticket updates | โ Verification | โ | -| **Scheduled Jobs** | โ | โ Daily follow-ups | โ | โ | -| **PreProcessors** | โ | โ | โ Validation | โ | -| **PostProcessors** | โ | โ | โ Disclaimers | โ | -| **Vector Search** | โ | โ Knowledge base | โ | โ | -| **Multi-Step Flow** | โ Cart โ Checkout | โ | โ 7-step onboarding | โ Book โ Confirm | -| **Complexity** | Basic | Intermediate | Advanced | Basic | - ---- - -## ๐ ๏ธ Technology Stack - -All demos use: -- **TypeScript** - Full type safety -- **Zod** - Schema validation -- **Lua CLI 3.0.1** - Latest version -- **Node.js** - Runtime environment - -Additional integrations: -- **Zendesk API** (Customer Support) -- **Stripe Identity API** (Financial Services) -- **OpenAI** (Embeddings for vector search) -- **Pinecone** (Vector database) - ---- - -## ๐ Learning Path - -### Beginner: Start Here -1. **Hotel Booking Agent** - Simplest demo, basic CRUD operations -2. **Shopping Assistant** - Platform APIs, multi-tool workflows - -### Intermediate: Level Up -3. **Customer Support** - External APIs, webhooks, scheduled jobs, vector search - -### Advanced: Deep Dive -4. **Financial Services** - Complex multi-step flows, compliance, pre/post processors - ---- - -## ๐จ Customization Guide - -Each demo is designed to be easily customized: - -### Use As-Is -Deploy directly for quick prototyping - -### Modify for Your Domain -- Change tool descriptions -- Update data schemas -- Adjust persona and behavior -- Add/remove tools - -### Mix and Match -Combine tools from different demos: -```typescript -import { SearchProductsTool } from '../lua-shopping-assistant/tools/EcommerceTool'; -import { SearchKnowledgeBaseTool } from '../lua-customer-support/tools/SupportTools'; - -const hybridSkill = new LuaSkill({ - tools: [ - new SearchProductsTool(), - new SearchKnowledgeBaseTool() - ] -}); -``` - ---- - -## ๐ Repository Structure - -``` -lua-dev-examples/ -โโโ lua-shopping-assistant/ # E-commerce demo -โ โโโ src/ -โ โ โโโ index.ts # Agent configuration -โ โ โโโ tools/ -โ โ โโโ EcommerceTool.ts # 7 shopping tools -โ โโโ lua.skill.yaml -โ โโโ package.json -โ โโโ README.md -โ -โโโ lua-customer-support/ # Support automation demo -โ โโโ src/ -โ โ โโโ index.ts # Agent with webhooks & jobs -โ โ โโโ tools/ -โ โ โโโ SupportTools.ts # 4 support tools -โ โโโ lua.skill.yaml -โ โโโ README.md -โ -โโโ lua-financial-services/ # KYC onboarding demo -โ โโโ src/ -โ โ โโโ index.ts # Agent with pre/post processors -โ โ โโโ tools/ -โ โ โโโ FinancialOnboardingTools.ts # 7 onboarding tools -โ โโโ lua.skill.yaml -โ โโโ README.md -โ -โโโ lua-hotel-agent/ # Hotel booking demo -โ โโโ src/ -โ โ โโโ index.ts # Simple agent configuration -โ โ โโโ tools/ -โ โ โโโ HotelTool.ts # 5 hotel tools -โ โโโ lua.skill.yaml -โ โโโ README.md -โ -โโโ README.md # This file -``` - ---- - -## ๐งช Testing - -Each demo includes comprehensive testing: - -### Interactive Tool Testing -```bash -cd lua-shopping-assistant -lua test -``` -Test each tool individually with interactive prompts. - -### Chat Interface Testing -```bash -lua dev -``` -Opens browser-based chat interface at `http://localhost:3000` - -### Production Testing -```bash -lua push # Deploy to staging -# Test in production environment -lua deploy # Promote to production -``` - ---- - -## ๐ Environment Variables - -Some demos require API keys. Create a `.env` file: - -### Customer Support -```bash -ZENDESK_API_KEY=your_zendesk_key -ZENDESK_SUBDOMAIN=your_company -ZENDESK_EMAIL=support@yourcompany.com -``` - -### Financial Services -```bash -STRIPE_SECRET_KEY=sk_test_... -STRIPE_WEBHOOK_SECRET=whsec_... -BANKING_API_KEY=your_banking_api_key -``` - -**Security Note:** Never commit `.env` files to version control. All demos include `.env` in `.gitignore`. - ---- - -## ๐ Use Case Matrix - -| Industry | Recommended Demo | Why | -|----------|-----------------|-----| -| **E-commerce** | Shopping Assistant | Product catalog, cart, checkout flow | -| **SaaS** | Customer Support | Knowledge base, ticketing, automation | -| **Banking** | Financial Services | KYC compliance, identity verification | -| **Hospitality** | Hotel Agent | Reservations, bookings, guest services | -| **Healthcare** | Financial Services | Patient onboarding, compliance | -| **Insurance** | Financial Services | Policy application, risk assessment | -| **Real Estate** | Hotel Agent | Property viewing, bookings | -| **Education** | Customer Support | Student support, FAQ automation | - ---- - -## ๐ฏ Key Concepts Demonstrated - -### 1. Platform APIs -- **Products API** - Catalog management -- **Baskets API** - Shopping cart operations -- **Orders API** - Order processing -- **Data API** - Custom data with vector search -- **User API** - User management - -### 2. External Integrations -- **REST APIs** - Zendesk, Stripe Identity -- **Webhooks** - Real-time event handling -- **Authentication** - API key management -- **Error Handling** - Graceful degradation - -### 3. Advanced Patterns -- **Multi-step workflows** - Guided journeys -- **State management** - Application tracking -- **Vector search** - Semantic similarity -- **Scheduled automation** - Cron jobs -- **Message processing** - Pre/post processors - -### 4. Best Practices -- **Type safety** - Full TypeScript -- **Schema validation** - Zod schemas -- **Error handling** - Try/catch patterns -- **Security** - Environment variables -- **Documentation** - Comprehensive READMEs - ---- - -## ๐ก Tips & Best Practices - -### 1. Start Simple -Begin with Hotel or Shopping demos, then progress to more complex ones. - -### 2. Test Thoroughly -Use `lua test` and `lua dev` extensively before deploying. - -### 3. Customize Gradually -Make small changes, test frequently, iterate. - -### 4. Read the Code -All tools are well-commented and production-ready. Learn by reading! - -### 5. Use Vector Search -For any searchable content (FAQs, docs, products), use `Data.search()`. - -### 6. Handle Errors Gracefully -All demos show proper error handling patterns. - ---- - -## ๐ Deployment - -### Development -```bash -lua dev # Local development with hot reload -``` - -### Staging -```bash -lua push # Deploy to staging environment -``` - -### Production -```bash -lua deploy # Promote to production -``` - -### Monitoring -Check your Lua Platform dashboard for: -- Agent analytics -- Tool usage statistics -- Error logs -- User conversations - ---- - -## ๐ Additional Resources - -### Documentation -- [Lua Platform Docs](https://docs.heylua.ai) -- [API Reference](https://docs.heylua.ai/api) -- [CLI Guide](https://docs.heylua.ai/cli) - -### Support -- GitHub Issues: Report bugs or request features -- Email: support@lua.ai -- Community: [Discord Server](https://discord.gg/lua) - -### Video Tutorials -- Getting Started with Lua Platform -- Building Your First Agent -- Advanced Patterns & Best Practices - ---- - -## ๐ค Contributing - -Found a bug? Have an improvement? Contributions are welcome! - -1. Fork the repository -2. Create a feature branch -3. Make your changes -4. Test thoroughly -5. Submit a pull request - ---- - -## ๐ License - -All demos are provided as examples for learning and customization. Modify freely for your use case. - ---- - -## ๐ Get Started Now! - -Choose a demo that matches your use case: - -```bash -# E-commerce -cd lua-shopping-assistant && lua dev - -# Customer Support -cd lua-customer-support && lua dev - -# Financial Services -cd lua-financial-services && lua dev - -# Hotel Booking -cd lua-hotel-agent && lua dev -``` - -**Build something amazing with Lua Platform! ๐** - ---- - -
- Questions? Check the individual demo READMEs or visit docs.heylua.ai -
+## How to Test +1. Ask the agent: "Check the stock for SKU-990 in Odoo." +2. Ask the agent: "What is the status of invoice INV-5521?" +## Technical Details +- **Language:** Lua +- **Components:** `SKILL.md` (Agent Instructions) and `scripts/fetch_data.lua` (API Simulator). diff --git a/lua.skill.yaml b/lua.skill.yaml new file mode 100644 index 0000000..71142d9 --- /dev/null +++ b/lua.skill.yaml @@ -0,0 +1,5 @@ +skill: + name: zoho-crm-connector + version: 1.0.0 + description: Advanced Zoho CRM Skill + entryPoint: src/index.ts diff --git a/package.json b/package.json new file mode 100644 index 0000000..a6a3025 --- /dev/null +++ b/package.json @@ -0,0 +1,18 @@ +{ + "name": "zoho-crm-skill", + "version": "1.0.0", + "description": "Advanced Zoho CRM Skill for heylua.ai", + "main": "dist/index.js", + "scripts": { + "build": "tsc", + "typecheck": "tsc --noEmit" + }, + "dependencies": { + "lua-cli": "^3.5.0-alpha.1", + "zod": "^3.22.4" + }, + "devDependencies": { + "typescript": "^5.3.3", + "@types/node": "^20.11.16" + } +} diff --git a/src/database.ts b/src/database.ts new file mode 100644 index 0000000..cbedb04 --- /dev/null +++ b/src/database.ts @@ -0,0 +1,29 @@ +export interface Lead { + id: string; + name: string; + status: string; + notes: string[]; +} + +const mockDatabase: Record