Skip to content
sarr-io edited this page Sep 14, 2026 · 12 revisions

Portable Agents

Portable Agents compiles Lua and Markdown into an Image and invokes one entry module in an isolated Lua 5.5 runtime. An Agent owns that Image, its HTTP client, and per-state limits.

Only byte strings cross package, Eval, Import, and embedder boundaries. The package owns the meaning of input and config; Portable Agents does not parse either.

Model

  • Image: compiled .lua and .md modules.
  • Agent: an Image plus its entry module, client, and limits.
  • Entry: a callable table with direct callable members.
  • Eval: fresh restricted Lua states with selected entry members as self.
  • Import: another configured Agent exposed by name.
  • Host: trusted filesystem, HTTP, and process operations.

Start here

package/
  entry.lua
  src/
local entry = {
    echo = function(input, config)
        return input
    end,
}

return setmetatable(entry, {
    __call = function(_, input, config)
        return input
    end,
    __metatable = false,
})

Build an Agent with sourceDir pointing at package/ and entryModule set to entry. Then read Package language, Host operations, and Eval and Imports.

Clone this wiki locally