Skip to main content
Build AI Agents That Do Anything
Vibe Code Your AI Agent - Lua is built for AI-assisted development. Use Cursor, Windsurf, GitHub Copilot, or any AI coding IDE to build, test, and deploy agents fast.

Connect Your AI IDE to Lua Docs

Get instant access to Lua documentation directly in your coding environment via MCP (Model Context Protocol).
Add this to your MCP configuration:
{
  "mcpServers": {
    "lua-docs": {
      "url": "https://docs.heylua.ai/mcp"
    }
  }
}
MCP Server URL: https://docs.heylua.ai/mcpWorks with: Cursor, VS Code, Claude, Windsurf, and any MCP-compatible tool.

AI Agent Building Guide

Complete workflow for AI IDEs - Authentication, testing strategies, sandbox vs production, common gotchas, and the full build-test-deploy cycle optimized for Cursor, Windsurf, and GitHub Copilot.

What is Lua?

Lua is a developer platform for building AI agents that integrate with your entire business. Write TypeScript functions that connect to any API - your CRM, payment processor, inventory system, or any third-party service - and Lua transforms them into conversational AI capabilities. Your customers chat naturally (β€œWhere’s my order?” or β€œBook me a table”), and your AI agent takes real actions by calling the functions you wrote.

Vibe Coding Ready

Built for AI IDEs - Cursor, Windsurf, GitHub CopilotAll commands are non-interactive. Let AI write your agent.

Integrate With ANY API

Your Backend - CRM, ERP, databasesExternal Services - Stripe, Shopify, SendGrid

TypeScript-Native

Full type safety with Zod validationLive reload, testing, instant deployment

Two Powerful Products

Build AI agents with custom capabilities using TypeScriptThe development framework for creating AI skills that connect to your APIs.

What You Get

  • TypeScript framework for building tools
  • Live reload development environment
  • Optional Platform APIs (Products, Baskets, Orders, Vector Search, Templates)
  • 30+ working examples
  • One-command deployment

Quick Start

npm install -g lua-cli
lua auth configure
lua init
lua chat

Explore Lua CLI

Build your first AI agent in 5 minutes

How It Works

1

Write TypeScript Functions

Create tools that integrate with your APIs
class OrderLookupTool implements LuaTool {
  async execute(input: { orderId: string }) {
    // Call YOUR API
    const response = await fetch(`https://your-api.com/orders/${input.orderId}`);
    return await response.json();
  }
}
2

Bundle Into Skills

Group related tools together
const customerService = new LuaSkill({
  name: "customer-service",
  tools: [new OrderLookupTool(), new CreateTicketTool()]
});
3

Configure Your Agent

New in v3.0.0 - Use LuaAgent to configure everything
export const agent = new LuaAgent({
  name: "support-assistant",
  persona: "You are a helpful customer support agent...",
  skills: [customerService]
});
4

Test with Interactive Chat

Chat with your agent to test everything works
lua chat
Select sandbox mode to test with your local skills
5

Deploy Your Agent

Push to production with one command
lua push && lua deploy
6

Users Chat, AI Takes Actions

Your users interact naturally, AI calls your toolsUser: β€œWhat’s the status of order #12345?”AI: Calls OrderLookupTool with your API β†’ β€œYour order shipped yesterday and will arrive tomorrow!”
Testing Individual Tools: Need to test a specific tool with exact inputs? Use lua test to test tools one at a time. For most development, lua chat is faster for testing complete workflows.

v3.0.0: Beyond Skills and Tools

The v3.0.0 release adds powerful new capabilities beyond basic skills and tools:

LuaAgent

Unified Configuration - Configure your entire agent in one placeCombines persona, skills, webhooks, jobs, and processors

LuaWebhook

HTTP Endpoints - Receive events from external servicesStripe payments, Shopify orders, GitHub deployments, etc.

LuaJob

Scheduled Tasks - Automate recurring operationsDaily reports, cleanup jobs, monitoring with cron patterns

Jobs API

Dynamic Scheduling - Create jobs from tools at runtimeUser reminders, follow-ups, deferred work

PreProcessor

Message Filtering - Process messages before your agentSpam detection, profanity filters, routing, validation

PostProcessor

Response Formatting - Enhance responses after generationDisclaimers, branding, translation, formatting

Complete v3.0.0 Example

import { 
  LuaAgent, 
  LuaSkill, 
  LuaWebhook, 
  LuaJob,
  PreProcessor,
  PostProcessor 
} from 'lua-cli';

// Skills
import { customerServiceSkill } from './skills/customer-service';
import { productSkill } from './skills/products';

// Webhooks
const paymentWebhook = new LuaWebhook({
  name: 'stripe-payment',
  execute: async (event) => {
    if (event.type === 'payment.succeeded') {
      // Handle payment confirmation
      await notifyCustomer(event.data);
    }
  }
});

// Scheduled Jobs
const dailyReportJob = new LuaJob({
  name: 'daily-report',
  schedule: { type: 'cron', pattern: '0 9 * * *' },
  execute: async (job) => {
    const user = await job.user();
    await user.send([{ type: 'text', text: 'Daily report ready!' }]);
  }
});

// Message Processing
const profanityFilter = new PreProcessor({
  name: 'profanity-filter',
  execute: async (message, user) => {
    if (containsProfanity(message.content)) {
      return { block: true, response: "Please keep it respectful." };
    }
    return { block: false };
  }
});

const addDisclaimer = new PostProcessor({
  name: 'add-disclaimer',
  execute: async (user, message, response, channel) => {
    return {
      modifiedResponse: response + "\n\n_AI-generated content for informational purposes._"
    };
  }
});

// Complete Agent Configuration
export const agent = new LuaAgent({
  name: "enterprise-assistant",
  
  persona: `You are a professional enterprise assistant.
  
Your role:
- Help with customer inquiries
- Process orders and payments
- Provide product information

Communication:
- Professional and efficient
- Clear and accurate
- Proactive and helpful`,

  
  skills: [customerServiceSkill, productSkill],
  webhooks: [paymentWebhook],
  jobs: [dailyReportJob],
  preProcessors: [profanityFilter],
  postProcessors: [addDisclaimer]
});
Learn more about v3.0.0:

Complete Flexibility: Choose Your Integration Approach

One of Lua’s core strengths is flexibility. You can integrate with your existing systems, use our optional Platform APIs, or mix both approaches. Here’s how each approach works:

100% Custom Integration

Connect directly to your existing backend, databases, and third-party services. This gives you complete control over your business logic, data, and infrastructure.
import { LuaTool, env } from 'lua-cli';
import { z } from 'zod';

// Connect to YOUR systems
class YourCustomTool implements LuaTool {
  name = "your_custom_action";
  description = "Performs actions specific to your business";
  inputSchema = z.object({ param: z.string() });
  
  async execute(input) {
    // YOUR API
    const apiKey = env('YOUR_API_KEY');
    const response = await fetch('https://your-backend.com/api/endpoint', {
      headers: { 'Authorization': `Bearer ${apiKey}` }
    });
    
    // YOUR business logic
    const data = await response.json();
    return processYourData(data);
  }
}
Perfect for:
  • Existing infrastructure and systems
  • Custom business requirements
  • Enterprise integrations
  • Any industry or use case
  • Complete control over data and logic
Real Examples:
  • CRM: Salesforce, HubSpot, your custom CRM
  • E-commerce: Shopify, WooCommerce, Magento, your custom store
  • ERP: SAP, Oracle, your internal systems
  • Payments: Stripe, PayPal, Square, your payment gateway
  • Databases: PostgreSQL, MongoDB, MySQL, your data warehouse

Detailed Integration Examples

Example 1: Pure Custom - CRM Integration

Connect to your existing CRM system (Salesforce, HubSpot, or custom):
import { LuaTool, LuaSkill, env } from 'lua-cli';
import { z } from 'zod';

class GetCustomerTool implements LuaTool {
  name = "get_customer";
  description = "Look up customer in your CRM";
  inputSchema = z.object({ 
    email: z.string().email() 
  });

  async execute(input: { email: string }) {
    // Call YOUR CRM API
    const response = await fetch(
      `https://your-crm.com/api/customers/${input.email}`,
      {
        headers: { 
          'X-API-Key': env('YOUR_CRM_API_KEY'),
          'Content-Type': 'application/json'
        }
      }
    );
    
    if (!response.ok) {
      throw new Error('Customer not found');
    }
    
    return await response.json();
  }
}

class CreateTicketTool implements LuaTool {
  name = "create_ticket";
  description = "Create support ticket in your system";
  inputSchema = z.object({
    customerId: z.string(),
    subject: z.string(),
    description: z.string()
  });

  async execute(input) {
    const response = await fetch('https://your-crm.com/api/tickets', {
      method: 'POST',
      headers: {
        'X-API-Key': env('YOUR_CRM_API_KEY'),
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(input)
    });
    
    return await response.json();
  }
}

const crmSkill = new LuaSkill({
  name: "crm-integration",
  description: "Access our CRM system for customer support",
  tools: [new GetCustomerTool(), new CreateTicketTool()]
});

// Configure agent (v3.0.0)
export const agent = new LuaAgent({
  name: "crm-support-agent",
  persona: "You are a customer support specialist. Help users by looking up their information and creating support tickets when needed.",
  skills: [crmSkill]
});

Example 2: Platform APIs - Quick E-commerce

Build an e-commerce assistant using Platform APIs:
import { LuaAgent, LuaTool, LuaSkill, Products, Baskets } from 'lua-cli';
import { z } from 'zod';

class ShopAssistantTool implements LuaTool {
  name = "add_to_cart";
  description = "Add product to shopping cart";
  inputSchema = z.object({
    productId: z.string(),
    quantity: z.number().min(1)
  });
  
  async execute(input: { productId: string; quantity: number }) {
    // Use Platform APIs
    const product = await Products.getById(input.productId);
    const basket = await Baskets.create({ currency: 'USD' });
    
    await Baskets.addItem(basket.id, {
      id: input.productId,
      price: product.price,
      quantity: input.quantity
    });
    
    return { 
      basketId: basket.id,
      product: product.name,
      quantity: input.quantity,
      total: product.price * input.quantity
    };
  }
}

const shopSkill = new LuaSkill({
  name: "shop-assistant",
  description: "Help users shop and add items to cart",
  tools: [new ShopAssistantTool()]
});

// Configure agent (v3.0.0)
export const agent = new LuaAgent({
  name: "shop-assistant",
  persona: "You are a friendly shopping assistant. Help users find products and add them to their cart.",
  skills: [shopSkill]
});

Example 3: Hybrid - Real Business Solution

Combine your systems with Platform helpers:
import { LuaAgent, LuaSkill, LuaTool, Data, env } from 'lua-cli';
import { z } from 'zod';

class CompleteSearchTool implements LuaTool {
  name = "smart_search";
  description = "Search across all data sources intelligently";
  inputSchema = z.object({
    query: z.string(),
    userId: z.string().optional()
  });
  
  async execute(input: { query: string; userId?: string }) {
    // 1. Search YOUR product API/database
    const yourProducts = await fetch('https://your-api.com/search', {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${env('YOUR_API_KEY')}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({ query: input.query })
    }).then(r => r.json());
    
    // 2. Use Platform vector search for FAQs and documentation
    const faqResults = await Data.search('faqs', input.query, 5, 0.7);
    
    // 3. If user provided, get their purchase history from YOUR system
    let userHistory = null;
    if (input.userId) {
      userHistory = await fetch(
        `https://your-api.com/users/${input.userId}/purchases`,
        {
          headers: { 'Authorization': `Bearer ${env('YOUR_API_KEY')}` }
        }
      ).then(r => r.json());
    }
    
    // 4. Combine and return all results
    return {
      products: yourProducts,
      faqs: faqResults.data,
      userHistory,
      message: `Found ${yourProducts.length} products and ${faqResults.count} help articles`
    };
  }
}

const hybridSkill = new LuaSkill({
  name: "hybrid-search",
  description: "Search across all your systems and our platform",
  tools: [new CompleteSearchTool()]
});

// Configure agent (v3.0.0)
export const agent = new LuaAgent({
  name: "hybrid-assistant",
  persona: "You are a comprehensive search assistant. Help users find information across products, FAQs, and their history.",
  skills: [hybridSkill]
});

Real-World Use Cases

Lua can power AI agents for virtually any industry or use case. Here are some common scenarios:

E-commerce

Shopping Assistant
  • Product search and recommendations
  • Cart management and checkout
  • Order tracking and updates
  • Customer support and FAQs
Integrate with: Shopify, WooCommerce, Magento, your custom store, or Platform APIs

Customer Support

24/7 AI Support Agent
  • Ticket creation and management
  • Knowledge base search
  • Order lookups and status updates
  • Escalation to human agents
Integrate with: Zendesk, Freshdesk, Intercom, your ticketing system

SaaS Products

In-App AI Assistant
  • User onboarding and tutorials
  • Feature guidance and help
  • Account management
  • Usage analytics and insights
Integrate with: Your product APIs, analytics platforms, auth systems

Internal Tools

AI-Powered Operations
  • Access ERP, CRM, and databases
  • Generate reports and analytics
  • Automate workflows
  • Data lookups and updates
Integrate with: Your internal systems, SAP, Oracle, Salesforce

Finance & Banking

Account Management
  • Balance inquiries and transfers
  • Transaction history
  • Payment processing
  • Report generation
Integrate with: Your banking APIs, Stripe, Plaid, accounting systems

Healthcare

Patient Portal Assistant
  • Appointment scheduling
  • Prescription lookups
  • Doctor directory search
  • Health record access
Integrate with: Your EMR, appointment systems, patient databases

HR & Recruiting

Employee Assistant
  • Policy and benefits search
  • Leave requests and approvals
  • Onboarding support
  • Document access
Integrate with: BambooHR, Workday, your HR systems

Logistics

Shipping & Tracking
  • Multi-carrier tracking
  • Shipping quotes and labels
  • Delivery status updates
  • Route optimization
Integrate with: UPS, FedEx, USPS APIs, your logistics system

Why Developers Love Lua

Built for AI-assisted development. All CLI commands are non-interactive, meaning Cursor, Windsurf, GitHub Copilot, and other AI coding tools can execute commands directly. Connect docs via MCP for instant context. Build agents faster with AI helping you code.
Build on your own infrastructure. Integrate with any API you choose. Not tied to our Platform APIs - they’re completely optional. Your data stays with your systems, your authentication remains yours.
Live reload during development means instant feedback. TypeScript autocomplete guides you. Test your agent with lua chat immediately. Deploy with one command. Build in minutes what would take days with other platforms.
Your code, your logic, your data. Complete control over authentication, business rules, error handling, and integrations. Not limited by platform constraints - if you can code it in TypeScript, you can build it.
Version management built-in. Sandbox for testing before production. Environment variables for secrets. One-command deployment. Monitoring and logs. Everything you need for enterprise production use.
Actual TypeScript code, not YAML configs or no-code builders. Zod validation for type-safe inputs. Proper testing with lua test and lua chat. Modern dev workflow you already know.
Platform APIs available when you need quick e-commerce or vector search. But they’re completely optional - use them or don’t, it’s your choice. Most developers use a hybrid approach.

Platform Architecture

Understanding how Lua works helps you build better agents:

Skills and Tools

Tools are TypeScript classes that implement LuaTool:
  • Each tool performs one specific action
  • Tools have names, descriptions, and input schemas
  • The AI decides when to call each tool based on context
Skills are bundles of related tools:
  • Group tools that work together
  • Each skill can have multiple tools
  • Skills can be versioned and deployed independently

Development Workflow

# Local development with live reload
lua chat

# Test specific tools with exact inputs
lua test

# Push your code to the cloud
lua push

# Deploy to production
lua deploy

# Or combine push and deploy
lua push && lua deploy

Testing Strategies

Interactive Testing (lua chat):
  • Best for testing complete workflows
  • Chat naturally and see tools called in real-time
  • Choose sandbox mode to test local code before deploying
  • Fast iteration during development
Individual Tool Testing (lua test):
  • Test specific tools with exact inputs
  • Useful for debugging edge cases
  • Validates schemas and error handling
  • Good for automated testing

Security and Best Practices

Environment Variables

Always use environment variables for API keys and secrets:
import { env } from 'lua-cli';

const apiKey = env('YOUR_API_KEY');
const dbPassword = env('DATABASE_PASSWORD');
Set environment variables with:
lua env set YOUR_API_KEY "your-key-here"

Error Handling

Implement proper error handling in your tools:
class SafeTool implements LuaTool {
  async execute(input) {
    try {
      const response = await fetch('https://api.example.com/data');
      
      if (!response.ok) {
        throw new Error(`API error: ${response.status}`);
      }
      
      return await response.json();
    } catch (error) {
      // Log error for debugging
      console.error('Tool execution failed:', error);
      
      // Return user-friendly message
      return {
        error: true,
        message: 'Sorry, I encountered an issue. Please try again.'
      };
    }
  }
}

Input Validation

Use Zod schemas for type-safe validation:
import { z } from 'zod';

class ValidatedTool implements LuaTool {
  inputSchema = z.object({
    email: z.string().email(),
    amount: z.number().positive(),
    date: z.string().datetime()
  });
  
  async execute(input) {
    // Input is guaranteed to match schema
    // TypeScript knows the types
  }
}

Feature Highlights

Any API

REST, GraphQL, WebSockets - integrate with anything callable from TypeScript

TypeScript

Full type safety with autocomplete and IntelliSense

Live Reload

Instant feedback during development with auto-recompilation

Optional Platform APIs

Ready-to-use helpers for e-commerce and vector search

Voice Chat

Voice interactions built into LuaPop widget

One-Command Deploy

Production deployment in seconds

Get Started

Learning Path

1

Understand Core Concepts

Learn how Lua enables AI agents to take real actions through your code

Skills and Tools

2

Build Your First Agent

Follow a complete tutorial from installation to deployment

First Skill Tutorial

3

Explore Integration Options

See examples of external APIs, Platform APIs, and hybrid approaches

API Integration Guide

4

Deploy to Production

Add the chat widget to your website and go live

Chat Widget Setup

See complete, production-ready implementations:

Enterprise Features

Security

Token-based auth, HTTPS only, secure environment variables, session isolation

Scalability

Auto-scaling infrastructure, CDN delivery, WebSocket optimization

Compliance

GDPR ready, SOC 2 compliant, data residency options, audit logs

Support

Technical support, migration assistance, dedicated success team

Need Help?


Ready to Build Your First Agent?

Complete quick start tutorial with step-by-step instructions β†’