Select sandbox mode. Your agent works out of the box!
3
Create Your First Tool
Create src/skills/tools/GreetingTool.ts:
Copy
import { LuaTool } from "lua-cli";import { z } from "zod";export default class GreetingTool implements LuaTool { name = "greet_user"; description = "Generate a personalized greeting"; inputSchema = z.object({ name: z.string() }); async execute(input: z.infer<typeof this.inputSchema>) { return { greeting: `Hello, ${input.name}!` }; }}
4
Create a Skill
Create src/skills/greeting.skill.ts:
Copy
import { LuaSkill } from "lua-cli";import GreetingTool from "./tools/GreetingTool";export default new LuaSkill({ name: "greeting-skill", description: "Greeting tools", context: "Use when users want greetings", tools: [new GreetingTool()],});
5
Add to Your Agent
Update src/index.ts:
Copy
import { LuaAgent } from "lua-cli";import greetingSkill from "./skills/greeting.skill";const agent = new LuaAgent({ name: `My Agent`, persona: `You are a friendly assistant.`, skills: [greetingSkill],});
6
Test & Deploy
Copy
lua test # Test your toollua chat # Chat with your agentlua push all --force --auto-deploy # Deploy
# Initialize with exampleslua init --with-examples# Copy a tool to your srccp examples/skills/tools/GetWeatherTool.ts src/skills/tools/# Import and use it