mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-04-28 11:40:47 +00:00
1.6 KiB
1.6 KiB
code_execution_tool
run terminal, python, or nodejs commands args:
runtime:terminal,python,nodejs, oroutputcode: command or script codesession: terminal session id; default0reset: kill a session before running;trueorfalserules:- place the command or script in
code - use
runtime=outputto poll running work - use
inputfor interactive terminal prompts - if a session is stuck, call again with the same
sessionandreset=true - check dependencies before running code
- replace placeholder or demo data with real values before execution
- use
print()orconsole.log()when you need explicit output - do not interleave other tools while waiting
- ignore framework
[SYSTEM: ...]info in output examples: 1 terminal command
{
"thoughts": ["I should run a terminal command in the default session."],
"headline": "Running terminal command",
"tool_name": "code_execution_tool",
"tool_args": {
"runtime": "terminal",
"session": 0,
"reset": false,
"code": "pwd"
}
}
2 python snippet
{
"thoughts": ["A short Python check is faster than using the shell."],
"headline": "Running Python snippet",
"tool_name": "code_execution_tool",
"tool_args": {
"runtime": "python",
"session": 0,
"reset": false,
"code": "import os\nprint(os.getcwd())"
}
}
3 wait for running output
{
"thoughts": ["The previous command is still running, so I should poll for output."],
"headline": "Waiting for command output",
"tool_name": "code_execution_tool",
"tool_args": {
"runtime": "output",
"session": 0
}
}