Skip to main content

Available APIs

Lua CLI provides a comprehensive set of APIs for building AI agents:

Core Classes

LuaAgent, LuaSkill, LuaTool - Agent configuration and building blocks

Automation

LuaJob, LuaWebhook - Scheduled tasks and HTTP endpoints

Message Processing

PreProcessor, PostProcessor - Filter and format messages

External Tools

LuaMCPServer - Connect MCP servers for external tool integrations

Platform APIs

AI, Agents, User, Data, CDN, Products, Baskets, Orders, Jobs, Templates, Channels - Built-in services

Environment

env() - Secure configuration management
LuaAgent, LuaJob, LuaWebhook, PreProcessor, PostProcessor, and Jobs API for comprehensive agent development.

Installation

zod is a peer dependency required for schema validation

Quick Start

Import APIs

Create an Agent

Core Classes

Agent Configuration

LuaAgent

Unified agent configuration

Building Blocks

LuaSkill

Collection of related tools

LuaTool

Individual function the AI can call

Automation

LuaWebhook

HTTP endpoints for external events

LuaJob

Scheduled tasks

Message Processing

PreProcessor

Filter messages before agent

PostProcessor

Format responses after agent

Platform APIs

AI API

New! Generate AI responses with custom context in your tools:
Use cases:
  • Product descriptions
  • Image analysis
  • Content summarization
  • Translation
  • Recommendations
  • Document Q&A

Full Documentation

Agents API

New! Invoke another agent from within your tool, webhook, job, or processor:
Use cases:
  • Route requests to specialist agents
  • Build multi-agent pipelines
  • Delegate from webhooks/jobs to conversational agents

Full Documentation

User API

Access user information:
Use cases:
  • Get current user in tools
  • Get specific user in webhooks (payment notifications)
  • Send messages to specific users in jobs
  • Update user profiles

Full Documentation

Data API

Custom data storage with vector search:

Full Documentation

CDN API

Upload and retrieve files from the CDN:
Use cases:
  • Store user uploads
  • Image storage for AI analysis
  • Document management
  • Asset management

Full Documentation

Products API

E-commerce product catalog:

Full Documentation

Baskets API

Shopping cart management:

Full Documentation

Orders API

Order processing and tracking:

Full Documentation

Jobs API

Dynamically create scheduled tasks from tools:

Full Documentation

Templates API

Send template messages across different channels:
Supported template types:
  • Templates.whatsapp - WhatsApp Business templates

Full Documentation

Channels API

Send outbound messages on any connected channel — from tools, jobs, webhooks, and triggers:
Use cases:
  • Proactive notifications and reminders (with Jobs)
  • Confirmations from webhooks
  • Agent-initiated follow-ups

Full Documentation

Environment Variables

Secure configuration management:

Full Documentation

Type Definitions

All APIs are fully typed for TypeScript:

Common Patterns

External API Integration

Using Platform APIs

API Reference Pages

Core Classes

LuaAgent

Agent configuration

LuaSkill

Skill class API

LuaTool

Tool interface

LuaWebhook

HTTP webhooks

LuaJob

Scheduled tasks

LuaMCPServer

MCP external tools

PreProcessor

Message filtering

PostProcessor

Response formatting

defineDevice

Server-side device + trigger definitions

LuaVoice

Voice agent definition

Runtime APIs

Lua

Request context API

AI

AI generation API

Agents

Agent invocation API

User

User data API

Data

Custom data API

CDN

File storage API

Products

Products API

Baskets

Baskets API

Orders

Orders API

Jobs

Jobs API

Templates

Template messaging

Channels

Outbound messaging

Voice

LuaVoice

Define voices in code — STT, TTS, LLM, plus plugin & realtime engines

Utilities

Environment

Environment utilities

Best Practices

All APIs are fully typed. Use TypeScript for:
  • Autocomplete
  • Type checking
  • Better IDE support
Always use Zod schemas for input validation:
Implement proper error handling:
Never hardcode secrets:

Next Steps

1

Explore Core Classes

Learn about LuaSkill and LuaTool
2

Study Platform APIs

Explore User, Data, Products, etc.
3

See Examples

Check out Tool Examples for working code
4

Build Something