chroot ./agent
Give the Agent a Padded Room.
Local ai agent sandboxing best practices come down to one assumption: the agent will do something strange, and when it does the damage must stay inside a box you can throw away.

Assume It Will Do Something Strange

Not malicious. Strange. An agent asked to tidy a folder will, sooner or later, decide that deleting is tidying. A sandbox is the agreement that when it does, the damage stays inside a box you can discard. This builds on the page on building local ai agents, which covers the loop and the tools; here we talk only about the walls around them.
Filesystem First
Give the agent a working directory that is a copy, never the original share. Mount it read-only where you can. Writes go to a scratch area that a human reviews before anything is moved back. On the Tavaka appliance the batch folder works like this: input is read, output lands in a separate tree, and the original is never opened for writing by the model side.
Path handling deserves its own paragraph. Normalise every path the model produces, reject anything that climbs out of the working directory, and treat symbolic links as hostile.
Network Off by Default

A local agent has no business reaching the Internet unless a specific tool needs it, and then only that tool, only to that host. Block egress at the container or firewall level, not in application code the model could talk its way around. Many of the criteria in best local ai agent frameworks 2026, explained come back to this one point: can you prove nothing left the building?
Budgets and Kill Switches
- A maximum number of steps per task, after which the agent stops and reports rather than retrying.
- A wall-clock timeout per tool call and another per task.
- A token budget, so a looping model cannot run the machine all night.
- A log of every tool call with its arguments, written before the call runs, not after it returns.
The log written before the call is the one that survives when the call takes the process down.
Smaller Models, Smaller Blast Radius

A narrow model that only knows how to extract fields from an invoice cannot be talked into running a shell command, because it has no such tool and no notion of one. That is a real safety property, not a marketing line, and it is part of why we favour the approach in small language model agents, explained. The sandbox is still required. It just has less to catch.
Prove it on your documents.
Every engagement starts the same way: we run the system on a sample of your own files, under NDA/DPA, and hand you a written report with the scores, misses included. No commitment.