LuaAgent is the recommended way to configure your AI agent in v3.0.0+. It provides a single, intuitive configuration object that combines skills, webhooks, jobs, and message processors.
Copy
import { LuaAgent } from 'lua-cli';export const agent = new LuaAgent({ name: 'my-agent', persona: 'You are a helpful assistant...', skills: [skill1, skill2]});
New in v3.0.0: LuaAgent replaces the need to export individual skills, webhooks, and jobs separately.
import { LuaAgent, LuaSkill } from 'lua-cli';import GetWeatherTool from './tools/GetWeatherTool';const weatherSkill = new LuaSkill({ name: 'weather-skill', description: 'Weather information', context: 'Use these tools to get weather data', tools: [new GetWeatherTool()]});export const agent = new LuaAgent({ name: 'weather-assistant', persona: 'You are a friendly weather assistant. Provide weather information when asked.', skills: [weatherSkill]});
persona: `You are Dr. Smith, a medical information assistant.Role: Provide general health information and wellness tips.Guidelines:- Always clarify you're not a licensed doctor- Recommend seeing professionals for serious concerns- Use clear, non-technical language- Be empathetic and supportiveTone: Professional, caring, informative`
// Too vaguepersona: `You are helpful`// Too roboticpersona: `I am an AI assistant that answers questions.`// Missing boundariespersona: `You can do anything the user asks.`
Persona is stored in your LuaAgent code definition (in src/index.ts). The lua.skill.yaml file is state-only and tracks IDs and versions, not persona content.When you edit persona using lua persona, it updates the persona field in your LuaAgent code directly.
import { LuaAgent, LuaSkill } from 'lua-cli';// Organize tools by domainconst weatherSkill = new LuaSkill({ name: 'weather-skill', description: 'Weather tools', context: 'Use for weather queries', tools: [getWeatherTool, getForecastTool]});const calculatorSkill = new LuaSkill({ name: 'calculator-skill', description: 'Math tools', context: 'Use for calculations', tools: [addTool, multiplyTool, advancedMathTool]});const dataSkill = new LuaSkill({ name: 'data-skill', description: 'Data management', context: 'Use for storing and retrieving user data', tools: [saveDataTool, queryDataTool]});export const agent = new LuaAgent({ name: 'multi-purpose-assistant', persona: 'You are a versatile assistant that helps with weather, calculations, and data management.', skills: [weatherSkill, calculatorSkill, dataSkill]});
import { LuaAgent } from 'lua-cli';import { skills } from './skills';import { webhooks } from './webhooks';import { jobs } from './jobs';import { preProcessors } from './preprocessors';import { postProcessors } from './postprocessors';import { mcpServers } from './mcp';export const agent = new LuaAgent({ name: 'enterprise-assistant', persona: `You are an enterprise-grade AI assistant. - Professional and efficient - Data-driven and accurate - Proactive with insights - Security and privacy conscious`, skills: skills, webhooks: webhooks, jobs: jobs, preProcessors: preProcessors, postProcessors: postProcessors, mcpServers: mcpServers});