mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-12-04 09:28:56 +00:00
Run guests under separate Linux UIDs while retaining PRoot fake-root for installers. Share immutable image files through hardlinks and copy each file before mutation. Preserve existing disk roots during migration, maintain worker bindings and lifecycle behavior, and remove gVisor sidecars and the Compose seccomp override. Build the pinned runtime in a disposable stage, bootstrap source updates, and keep Unix socket scratch paths short. Preserve worker request ACLs and translate fake-root Unix credentials for browser audio. Validation: 3,398 unit tests and six real runtime checks passed. Verified default Docker seccomp, missing-bundle image build, source bootstrap, persistent PTY, worker RPC, browser render/input/audio/downloads/profile restart, and WebUI HTTP startup. Fresh base is about 71 MiB smaller; a clean default sandbox uses about 9.7 MiB private disk. Ubuntu AppArmor and ARM64 were not available to test.
Code Execution
Run terminal commands and execute Python or Node.js code through Agent Zero using persistent shell sessions.
What It Does
This plugin provides the code execution tool used by agents for development tasks. It supports:
- Terminal commands in interactive shell sessions
- Python execution through
ipython -c - Node.js execution through
node /exe/node_eval.js - Persistent sessions keyed by session number
- Session reset and output retrieval
- Local or SSH-backed execution depending on plugin configuration
Main Behavior
- Persistent shells
- Maintains per-session shell state in agent data so subsequent calls can reuse the same terminal session.
- Groups multi-line terminal input in the current shell so only the final prompt marks the command complete.
- Multiple runtimes
- Dispatches requests based on
runtime:terminal,python,nodejs,output, orreset.
- Dispatches requests based on
- Remote execution support
- Can open SSH interactive sessions instead of local shells when configured.
- Streaming output
- Continuously reads shell output, updates the current log item, and detects progress while commands are running.
- Detects local shell exit and SSH channel termination when strict mode,
exit, or a lost connection prevents a final prompt from appearing.
- Long-running work
- Keeps normal command execution responsive while giving the
outputruntime longer polling windows for builds, installs, servers, tests, and training jobs.
- Keeps normal command execution responsive while giving the
- Safety around running sessions
- Tracks whether a shell is currently busy and can prevent overlapping commands unless explicitly allowed.
Key Files
- Tool
tools/code_execution_tool.pycontains runtime dispatch, session lifecycle, and streaming output logic.
- Helpers
helpers/shell_local.pyprovides the local interactive shell implementation.helpers/shell_ssh.pyprovides the SSH-backed interactive shell implementation.
- Configuration
default_config.yamldefines execution, prompt, and timeout settings.
- Prompts
prompts/contains the response templates shown to the agent.
Configuration Scope
- Settings section:
agent - Per-project config:
true - Per-agent config:
true - Always enabled:
false
Plugin Metadata
- Name:
_code_execution - Title:
Code Execution - Description: Code execution tool supporting terminal, Python, and Node.js runtimes via local TTY or SSH.