Skip to content

agentjido/jido_sandbox

Repository files navigation

Jido Sandbox

Hex.pm Documentation

In-memory sandbox (VFS + Lua) for LLM tool calls.

Installation

Add jido_sandbox to your list of dependencies in mix.exs:

def deps do
  [
    {:jido_sandbox, "~> 0.1.0"}
  ]
end

Quick Start

# 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!"

Key Features

  • 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)

Documentation

See HexDocs for full documentation.

License

Apache-2.0

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages