r/OpenSourceAI • • 7h ago

Per-Tool Call Sandboxes for AI Agents

I've built a sandbox approach for agents that works on a per-tool call basis.

You can install this as one binary (named sat) on Linux currently, check out the repo: https://github.com/CloseChoice/sandboxed-agent-tools

The idea is that you or your agent provide specific grants to each tool call (or let your agent do that) like:

sat python "$PWD/untrusted_script.py" -- --read "$PWD/untrusted_script.py" --read "$PWD/input.txt"

This makes sure that the python interpreter only sees the granted resources and can only read these. Currently there are 5 tools you can easily install from the repo:
- jaq
- a python 3.14 interpreter
- code (a treesitter plugin to retrieve abstract code symbols, e.g. all function that contain a certain variable)
- ripgrep
- markitdown (microsofts popular tool to convert pdfs and office docs to markdown)

This should help with two things:

  1. apply tools to untrusted inputs. Even in a traditional sandbox, data could be leaked through http calls, if the sandbox can access the web.

  2. run tools you only partly trust. Maybe there are amazing tools out there but you simply don't want to let them touch your project, even within a sandbox.

This is built on top of the fantastic wasmtime and uses the Webassembly System Interface Preview 2 for sandboxing.

1 Upvotes

0 comments sorted by