Run tools in a sandbox
Note: OS-level sandbox for the coding agent needs PRAISON_SHELL=sandboxed on your machine. The University sandbox does not run shell containment.
Agent without shell tools
Sandboxing applies when shell tools exist. Try it Yourself uses an agent with no shell tools listed.
Example
from praisonai import Agent
agent = Agent(
instructions="Answer without claiming you ran shell commands.",
tools=[],
)
print(agent.start("List one reason to sandbox shell tools."))When to sandbox
Use a sandbox when the agent can run shell commands or touch the filesystem and you want limits on paths, time, or network.
Approval asks a human yes or no. Sandbox adds isolation so a yes does less damage.
Coding agent with OS containment
The praisonai code command can run under OS-level containment when you set PRAISON_SHELL=sandboxed.
This is separate from the display-only –sandbox flag on plain praisonai prompts — follow the docs for the command you use.
Example
PRAISON_SHELL=sandboxed praisonai codeExample explained
- PRAISON_SHELL=sandboxed — Routes shell work through the contained coding-agent path documented for your OS.
Policy executor from Python
For scripts you control, SandboxExecutorHandler runs a command under basic, strict, or network-isolated modes.
Example
from praisonai.cli.features import SandboxExecutorHandler
handler = SandboxExecutorHandler()
handler.initialize(mode="basic")
print(handler.execute("echo hello").stdout)Reference: documentation