Quick Start
1
Isolate an explicit execute_code() call
Agent(sandbox=…) gives you the caller-invoked execute_code() API. It adds no tools and does not isolate tools= callables.2
Isolate everything the model runs
AgentFlow(run_on="docker") puts the whole workflow inside a real container boundary, so model-driven shell and file tools route through the shared sandbox.Guarantee Matrix
Each surface below isolates a different thing — read the row before you rely on it.Why sandbox= is not a capability grant
Agent(sandbox=…) is a restriction flag, not a way to hand the model an execution tool.
praisonai-sandbox must be installed to run any sandbox backend — pip install praisonaiagents alone is not enough. Install a backend, e.g. pip install "praisonai-sandbox[docker]".Common Patterns
- Explicit code execution
- Give the model a sandbox tool
- Whole-workflow container
Best Practices
Treat sandbox= as a restriction, not a grant
Treat sandbox= as a restriction, not a grant
Agent(sandbox=…) configures the explicit execute_code() API. It never hands the model a tool — add one yourself only when you intend the model to run code.Use a real container for untrusted or model-driven code
Use a real container for untrusted or model-driven code
The default subprocess backend is for trusted development only. For untrusted or model-driven execution, use
AgentFlow(run_on="docker"), LocalAgent(compute="docker"), or a docker / e2b sandbox backend.Remember autonomy= injects a host tool
Remember autonomy= injects a host tool
With
autonomy=True, the agent still carries the host execute_command tool. sandbox= does not protect that path — isolate the whole workflow with AgentFlow(run_on=…) instead.Install a sandbox backend first
Install a sandbox backend first
pip install praisonaiagents cannot execute any sandbox. Install praisonai-sandbox with the backend you need before relying on isolation.Related
Sandbox
Configure the explicit
execute_code() API and choose a backendShared Sandbox
Share one container across every agent with
run_on=
