WardrikLua

Copy Markdown

Lua 5.3 for agents. The run_lua tool runs code an agent writes in a sealed sandbox and returns the value. Agents use it for work no other tool covers: arithmetic, reshaping data, loops, or the current time.

def deps do
  [
    {:wardrik_lua, "~> 0.1.0-rc.1"}
  ]
end

Usage

Give agents the capability:

WardrikCore.start_agent(
  agent_id: "acme/triage",
  model: "anthropic:claude-haiku-4-5",
  capabilities: [WardrikLua]
)

In Wardrik, offer it by name. A definition then names it in its tools:

config :my_app, MyApp.AgentRuntime, capabilities: [run_lua: WardrikLua]

The daemon already offers it as run_lua.

The sandbox

The VM is lua, written in Elixir. It can't reach anything outside itself.

  • Available: string, table, math, utf8, os.time, os.date and the rest of os that touches nothing outside.
  • Raise when called: io, file, os.execute, os.exit, os.getenv, package, require, load, dofile, print and debug.

Each run is evaluated in a task of its own, under WardrikLua.Sandbox.Limits:

LimitDefault
:timeout_ms30 seconds
:max_heap_bytes64 MB
:max_steps10 million
:max_depth200 nested calls

Pass :limits to change them:

{WardrikLua, limits: [timeout_ms: :timer.seconds(5)]}