Skip to main content

Overview

The lua chat command provides an interactive command-line interface for conversing with your Lua AI agent in both sandbox and production environments.
Want to test on real channels? You can also test your agent on WhatsApp, Facebook, Instagram, Email, and Slack without setting up your own channels. See Quick Testing Channels for instant testing on any platform.

Features

Sandbox Mode

Test with local skill overrides and persona customizations

Production Mode

Chat with your live production agent

Interactive Loop

Continuous conversation until exit

Multi-Skill Support

All skills automatically included in sandbox

Prerequisites

1

Configure API Key

2

Initialize Project

Ensures lua.skill.yaml exists
3

Deploy Skills

Required for sandbox testing

How It Works

1

Authentication

Validates your API key and retrieves user data
2

Environment Selection

Choose between sandbox (testing) or production (live)
3

Sandbox Setup (if Sandbox)

Compiles and deploys your local skills to sandbox
4

Chat Interface

Interactive conversation begins

Sandbox vs Production

For Development & Testing
Features:
  • βœ… Local skill overrides
  • βœ… Persona customization
  • βœ… Environment variables from .env
  • βœ… Test before deploying
Setup time: ~10-30 seconds (includes compilation)Use when:
  • Developing new features
  • Testing skill changes
  • Iterating on persona
  • Before pushing to production

Example Session

Sandbox Mode

Persona Override

Configuration

In lua.skill.yaml:
In Sandbox Mode:
  • Persona is automatically loaded and sent with each request
  • Test different persona variations
  • Iterate quickly
In Production Mode:
  • Uses production persona (from server)
  • No local override

Skill Override

How It Works

Sandbox mode automatically:
  1. Compiles all skills in your project
  2. Pushes to sandbox environment
  3. Gets sandbox IDs for each skill
  4. Includes all sandbox IDs in chat requests
Example override:
The AI uses your local sandbox versions instead of production versions.

Thread Isolation

By default, lua chat uses your agent’s shared conversation context. Use the --thread flag to scope a session to an isolated thread β€” useful for running consecutive tests without state leaking between runs.

Usage

Flags

Clearing a Thread Manually

Testing Workflow Example

Run 10 isolated test cases against your agent, each with a clean slate:

File Attachments

You can attach files to any message using @<path> syntax β€” in both interactive and non-interactive mode.
The @ must appear at the start of your message or after a space. Email addresses ([email protected]) are never treated as attachments.

Supported File Types

Sent natively to vision-capable models.
Files with unsupported extensions are left as plain text in your message β€” they are never silently stripped.
Model support required. Attachment support depends on the model configured for your agent. If the model doesn’t support vision or file inputs, attachments won’t be processed β€” even if the CLI sends them successfully. Check your agent’s model configuration if attachments aren’t being picked up.

Limits

  • Maximum file size: 10 MB per attachment
  • Multiple attachments per message are supported

Non-Interactive Mode

The same @<path> syntax works in -m / --message flags:

Batch Mode

Test how your agent handles concurrent or rapid-fire messages with the -b/--batch flag. Useful for stress-testing skills that share state or for reproducing race conditions reported in production.
Batch mode is not a way to scriptably hold a multi-turn conversation β€” each batched message is a separate turn. For ordered scripted conversations, use repeated lua chat -m "..." calls with -t <thread-id> instead.

Keyboard Shortcuts

Best Practices

  1. Make changes to your skills
  2. Run lua chat in sandbox mode
  3. Test changes interactively
  4. Iterate until satisfied
  5. Run lua push to deploy
  6. Test again in production mode
  7. Deploy with lua deploy
Start with sandbox:
  • Test happy paths
  • Test error cases
  • Test edge cases
  • Test multi-step flows
Validate with production:
  • Verify deployed changes work
  • Test with production data
  • Confirm no regressions
  1. Update persona in your LuaAgent code (src/index.ts)
  2. Run lua chat in sandbox
  3. Test conversation style
  4. Refine persona
  5. Repeat until satisfied
  6. Deploy to production with lua push persona

Active log probe (agent_error after every turn)

After every lua chat turn β€” interactive or -m non-interactive β€” the CLI runs a quiet lua logs --type agent_error probe scoped to the current session. The probe checks for server-side pipeline errors that don’t always surface in the chat response itself (billing failures, schema validation failures, LLM provider errors, post-processor errors). When the probe is silent, no agent errors fired during your turn β€” you’re clean. When new errors fire, the CLI prints a one-line warning at the end of the turn:
Empty response: If the agent returns no text (empty stream), the CLI warns: ⚠️ The agent returned an empty response and points you at agent_error and runtime logs so you can see what failed on the server. Run the suggested command verbatim to inspect the errors. To opt out (for example in CI that captures only command output), set LUA_NO_HINTS=1:

Debugging recipe

See Debugging your agent β€” the post-deploy loop for the complete flow.

Troubleshooting

Debugging after a failed chat: If a chat turn returns a wrong, empty, or error response, the CLI now automatically surfaces a count of agent_error logs that fired during that turn. To inspect them, run the suggested lua logs --type agent_error --limit N command. See Debugging your agent β€” the post-deploy loop for the canonical loop.
Error:
Solution:
Error:
Solution:
Error:
Solution:
  • Fix TypeScript errors in your code
  • Check src/index.ts for syntax errors
  • Verify all imports are correct
Error:
Solution:
Issue: Long wait times in sandboxCauses:
  • First request after compilation
  • Large skill bundles
  • Network latency
Solution: Subsequent messages will be faster
Issue: Persona override not being appliedCheck:
  • Using sandbox mode (not production)
  • agent.persona exists in lua.skill.yaml
  • Persona is properly formatted YAML

Debugging Loop

Canonical push β†’ test β†’ check flow + the active log probe

lua logs

Inspect agent_error and tool execution logs

lua test

Test individual tools with specific inputs

lua push

Deploy skills to server

Next Steps

Test Individual Tools

Test tools one at a time

Deploy to Production

Push your skills live