Skip to main content

Development Lifecycle

1

Configure Environment

Set up environment variables
lua env
Add API keys and configuration for sandbox
2

Configure Persona

Define your agent’s personality
lua persona
Edit persona in sandbox mode
3

Local Development

Build and test your skills locally
lua chat
Use sandbox mode for testing
4

Testing

Test conversational flows and individual tools
lua chat  # Primary testing
lua test  # Optional: Test specific tools
5

Push to Server

Upload your skill version to the server
lua push
6

Sandbox Testing

Test in sandbox environment before production
lua chat
Choose sandbox mode when prompted
7

Deploy to Production

Make your skill available to all users
lua deploy

Local Development Workflow

Starting Development

Start by syncing with the server to get any remote changes:
# Check for drift between server and local code
lua sync

# Test individual tools
lua test

# Test conversational flows
lua chat
lua test - Test tools one at a time with specific inputs lua chat - Interactive conversation testing in sandbox or production

The Development Loop

Edit files in src/tools/:
// src/tools/MyTool.ts
export default class MyTool implements LuaTool {
  name = "my_tool";
  description = "Updated description";
  
  async execute(input: any) {
    // Your changes here
  }
}

Testing Features

Tool Testing

Test individual tools with specific inputs

Chat Testing

Test conversational flows and tool selection

Sandbox Mode

Test with local changes before deploying

Production Validation

Verify deployed changes work correctly

Testing Workflow

Interactive Tool Testing

Test individual tools with specific inputs:
lua test
1

Select Tool

Choose from list of available tools
2

Enter Inputs

Provide values based on tool’s schema
3

View Results

See execution results or errors
4

Iterate

Fix issues and test again

Conversational Testing

Test how the AI uses your tools in natural conversation:
lua chat
Select Sandbox mode to test with your local changes. Test Scenarios:
Test the ideal user journey
  • “Show me products”
  • “Add laptop to cart”
  • “Checkout”
Test unusual but valid inputs
  • Empty results
  • Maximum values
  • Optional parameters
Test invalid inputs
  • Missing required fields
  • Invalid data types
  • Out of range values
Test complex workflows
  • Create → Add → Update → Delete
  • Search → Select → Checkout

Version Management

Semantic Versioning

Use semantic versioning: MAJOR.MINOR.PATCH
# lua.skill.yaml (version is the ONLY field you should manually edit)
skills:
  - name: my-skill
    version: 1.2.3
The lua.skill.yaml file is auto-managed by the CLI. The version number is the only field you should manually edit when preparing a new release. All other fields are managed automatically.
When to increment:
Bug fixes and minor improvements
  • Fixed error handling
  • Updated descriptions
  • Performance improvements

Pushing Versions

# Increment version in lua.skill.yaml (only field you should edit):
# skills:
#   - name: my-skill
#     version: 1.1.0

# Push to server
lua push
Each push creates a new version that can be deployed independently.

Advanced Agent Features (v3.0.0)

Beyond skills and tools, v3.0.0 adds support for webhooks, jobs, and message processing:

LuaAgent Configuration

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

export const agent = new LuaAgent({
  name: "my-agent",
  persona: "You are a helpful assistant...",
  
  // Skills with tools
  skills: [skill1, skill2],
  
  // HTTP endpoints for external events
  webhooks: [stripeWebhook, shopifyWebhook],
  
  // Scheduled tasks
  jobs: [dailyReportJob, cleanupJob],
  
  // Message filtering before agent
  preProcessors: [profanityFilter, rateLimiter],
  
  // Response formatting after agent
  postProcessors: [addDisclaimer, addBranding]
});

Webhooks

Receive events from external services:
import { LuaWebhook } from 'lua-cli';

const paymentWebhook = new LuaWebhook({
  name: 'payment-webhook',
  execute: async (event) => {
    if (event.type === 'payment.succeeded') {
      // Handle payment confirmation
    }
  }
});
Test webhooks:
lua test
# Select: Webhook → payment-webhook

Jobs

Schedule automated tasks:
import { LuaJob } from 'lua-cli';

const dailyReportJob = new LuaJob({
  name: 'daily-report',
  schedule: {
    type: 'cron',
    pattern: '0 9 * * *'  // Every day at 9 AM
  },
  execute: async (jobInstance) => {
    const user = await jobInstance.user();
    await user.send([{
      type: 'text',
      text: 'Your daily report is ready!'
    }]);
  }
});

PreProcessors

Filter messages before they reach your agent:
import { PreProcessor } from 'lua-cli';

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

PostProcessors

Format responses after agent generation:
import { PostProcessor } from 'lua-cli';

const addDisclaimer = new PostProcessor({
  name: 'add-disclaimer',
  execute: async (user, message, response, channel) => {
    return {
      modifiedResponse: response + "\n\n_This is AI-generated content._"
    };
  }
});
Learn more:

Deployment Workflow

Sandbox Testing

Before deploying to production, test in sandbox:
# Push latest version
lua push

# Test in sandbox
lua chat

# Select sandbox mode when prompted
# Verify everything works

Deploying to Production

When ready, deploy to all users:
lua deploy
1

Select Version

Choose which version to deploy from list
2

Confirm

Confirm the deployment (shows warning)
3

Deploy

Version is deployed to production
4

Verify

Test with real users or in production chat
Deployment is immediate! All users will get the new version right away.

Best Practices

Development

Build one tool at a time
  • Create basic version
  • Test thoroughly
  • Add complexity gradually

Version Control

# Always ignore
.env
.env.local
node_modules/
dist/
.lua/

# Keep these
.env.example
lua.skill.yaml
src/

Testing

Always test locally before pushing:
lua test  # Test tools
lua chat  # Test conversations (sandbox mode)
lua push  # Then push
Test pushed versions in sandbox before deploying:
lua push
lua chat  # Choose sandbox mode
# If good, then deploy
lua deploy
Keep a list of test scenarios:
  • Happy path flows
  • Edge cases to verify
  • Known issues to watch for

Deployment

Pre-Deployment Checklist:
  • ✅ Synced with server: lua sync
  • ✅ Tested all tools with lua test
  • ✅ Tested conversational flows with lua chat
  • ✅ Updated version number
  • ✅ Updated tool descriptions
  • ✅ Checked error messages
  • ✅ Tested in sandbox mode
  • ✅ Verified environment variables

Common Workflows

Quick Fix Workflow

# 1. Make the fix
vim src/tools/MyTool.ts

# 2. Test locally
lua test

# 3. Push and deploy
lua push
lua deploy

Feature Development Workflow

# 1. Create feature branch
git checkout -b feature/new-tool

# 2. Develop and test
lua test  # Test tool logic
lua chat  # Test in conversation

# 3. Test thoroughly
lua test  # All tools
lua chat  # All scenarios

# 4. Commit changes
git add .
git commit -m "feat: add new tool"

# 5. Push to server
lua push

# 6. Merge to main
git checkout main
git merge feature/new-tool

# 7. Deploy to production
lua deploy

Multi-Developer Workflow

# Developer 1: Working on Skill A
cd skill-a
lua sync  # Get any changes from teammates
lua test
lua chat  # Independent sandbox

# Developer 2: Working on Skill B
cd skill-b
lua sync  # Get any changes from teammates
lua test
lua chat  # Independent sandbox

# Each developer has independent sandbox
# Sync helps prevent conflicts when deploying

Troubleshooting

Problem: Cannot start chat sessionSolutions:
  1. Run lua auth configure to set up API key
  2. Ensure lua.skill.yaml exists (run lua init)
  3. Deploy skills with lua push before using sandbox
  4. Check network connection
Problem: Local changes not reflectedSolutions:
  1. Ensure you selected “Sandbox” mode
  2. Check compilation succeeded
  3. Verify skills pushed to sandbox successfully
  4. Try running lua push first
Problem: Deployed but still seeing old behaviorSolutions:
  1. Verify correct version was deployed
  2. Check lua.skill.yaml version number
  3. Test in production mode with lua chat
  4. Check if deploy actually succeeded
Problem: Version already pushed to serverSolution: Increment version number:
skills:
  - name: my-skill
    version: 1.0.1  # Increment this
Problem: Server has different persona/name than local codeSolutions:
  1. Run lua sync to see the diff and choose action
  2. Use lua compile --force-sync to auto-update from server
  3. Use lua compile --no-sync to skip check and keep local
This happens when someone updated the agent from the admin dashboard.

Next Steps