agent-zero/plugins/_code_execution
Alessandro daf95ec3ab Normalize tool contracts and slim prompt surface
Standardize multi-action tools around tool_args.action while keeping parser compatibility for older tool/args, tool_name:action, and method-shaped requests. This keeps new prompts clean without breaking agents that learned the previous dialect.

Move A0 connector remote execution/file tools into stable standard prompts, make remote targeting independent of the active chat context, and skill-gate beta computer-use remote so it no longer weighs down the always-on tool list.

Align text editor, scheduler, skills, office artifact, memory, notify, and browser prompts/tools around the canonical action contract. Add scheduler update/timezone handling, skills_tool read_file, text editor patch coverage, and fixes for memory_forget, behaviour_adjustment, and code execution progress warnings.

Reduce default prompt pressure by compacting browser and scheduler prompts into skill-backed manifests, shortening skill catalog descriptions, and pruning noisy framework knowledge. Remove obsolete connector prompt stubs and root tool-call knowledge examples.

Tests: conda run -n a0 pytest tests/test_a0_connector_prompt_gating.py tests/test_tool_action_contracts.py tests/test_task_scheduler_timezone.py tests/test_text_editor_context_patch.py tests/test_tool_request_normalization.py tests/test_office_document_store.py::test_odf_is_advertised_and_docx_remains_explicit_compatibility tests/test_office_document_store.py::test_document_artifact_accepts_method_alias_for_ods_create tests/test_skills_runtime.py tests/test_default_prompt_budget.py::test_a0_small_profile_removed_and_prompt_text_generic -q
2026-05-09 21:54:43 +02:00
..
extensions refactor: split system prompt into per-concern extensions with extensibility hooks 2026-03-20 12:12:47 +08:00
helpers fix(code_execution): handle closed PTYs while reading output 2026-05-02 21:33:08 +00:00
prompts prompts: restore legacy, plugins, agent0 profile 2026-04-03 06:49:25 +02:00
tools Normalize tool contracts and slim prompt surface 2026-05-09 21:54:43 +02:00
webui generated logos for builtin plugins 2026-03-19 17:35:03 +01:00
default_config.yaml refactor - plugin names and builtin plugins 2026-03-10 22:20:53 +01:00
plugin.yaml refactor - plugin names and builtin plugins 2026-03-10 22:20:53 +01:00
README.md refactor: normalize plugin paths, add README viewer to plugin info modal, and update plugin hub filters 2026-03-22 08:05:32 +01:00

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.
  • Multiple runtimes
    • Dispatches requests based on runtime: terminal, python, nodejs, output, or reset.
  • 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.
  • 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.py contains runtime dispatch, session lifecycle, and streaming output logic.
  • Helpers
    • helpers/shell_local.py provides the local interactive shell implementation.
    • helpers/shell_ssh.py provides the SSH-backed interactive shell implementation.
  • Configuration
    • default_config.yaml defines 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.