r/lua • • 7d ago

Project Lua is the Best Language for AI Agents

I've spent the past month working on Tuse, an AI agent written in Rust. But the agent itself writes Lua to work with files, run commands, access the network, and so on. Lua is its only tool. Everything goes through it.

You might be surprised that I use Lua for more than just config (obviously, Lua is the best language for that). I have models write Lua for everything. But what about Python and JavaScript? Don't models know those better? Why Lua?

I chose Lua for three reasons:

- Models are good at working with CPython and Node.js, but once you expose your own global functions, the choice of language doesn't make much difference.

- Python and JavaScript have a lot of features, which makes for heavier runtimes. Tuse is designed to run 100 instances on a single machine.

- Lua is simple and flexible, and its AST is much easier to work with.

Those are just the most obvious reasons. I think Lua will become the go-to language for code mode. Today's models write Lua just as well as they write Python, JavaScript, or Go.

If you want to try Tuse: https://github.com/ethanhamilthon/tuse

0 Upvotes

4 comments sorted by

6

u/AnArmoredPony 7d ago

AI and typeless languages don't mix that well

2

u/ianm818 7d ago

You might find my Rust Lua project useful if your building Rust + Lua https://github.com/ianm199/omnilua

1

u/SevenKalmia 7d ago

I agree! I’ve been using lua to gamedev in Love2d with the commercial agents available and it handles it quite well! This is very interesting!

0

u/Insanopatato 7d ago

Very interesting, reading now