In-memory sandbox (VFS + Lua) for LLM tool calls.
Add jido_sandbox to your list of dependencies in mix.exs:
def deps do
[
{:jido_sandbox, "~> 0.1.0"}
]
end# Create a new sandbox
sandbox = JidoSandbox.new()
# Write a file
{:ok, sandbox} = JidoSandbox.write(sandbox, "/hello.txt", "Hello, World!")
# Read it back
{:ok, content} = JidoSandbox.read(sandbox, "/hello.txt")
# => "Hello, World!"
# List directory
{:ok, files} = JidoSandbox.list(sandbox, "/")
# => ["hello.txt"]
# Create a snapshot
{:ok, snapshot_id, sandbox} = JidoSandbox.snapshot(sandbox)
# Make changes and restore
{:ok, sandbox} = JidoSandbox.delete(sandbox, "/hello.txt")
{:ok, sandbox} = JidoSandbox.restore(sandbox, snapshot_id)
# File is back!
# Execute Lua (with VFS access)
{:ok, result, sandbox} = JidoSandbox.eval_lua(sandbox, """
local content = vfs.read("/hello.txt")
return string.upper(content)
""")
# => "HELLO, WORLD!"- Pure in-memory VFS - No real filesystem access
- Sandboxed Lua execution - Safe scripting with VFS bindings
- Snapshot/restore - Save and restore VFS state
- Path validation - Blocks traversal attacks
- Zero external dependencies at runtime (except Lua NIF)
See HexDocs for full documentation.
Apache-2.0