Exec
exec is one of the core runtime tools in MushroomAgent. It runs shell commands locally and can either return immediately or hand off long-running work to process.
What it does
- run one-off commands
- support
workdirand environment overrides - support timeouts and output truncation
- support
backgroundfor long-running tasks - share background sessions with
process
Parameters
| Parameter | Description |
|---|---|
command | command to execute, required |
workdir | working directory, supports relative paths |
env | JSON object of environment overrides |
timeout | timeout in seconds, defaults to tools.exec.default_timeout |
max_output_chars | maximum returned output length |
background | run command in the background and return a session id immediately |
Execution model
- without shell operators, the command is parsed directly as argv
- with pipes, redirects, or variable expansion, falls back to
/bin/sh -lc allowlistmatches by command name or basename by default- when
privileged=false, commands not in the allowlist returncapability_limited
Config
tools:
exec:
enabled: true
cwd: /absolute/path/to/workspace
cwd_root: /absolute/path/to/workspace
allowlist:
- curl
- python3
- ls
- rg
- cat
- pwd
privileged: false
default_timeout: 1800
max_output_chars: 200000
mushroom-agent init enables exec by default with a baseline allowlist.
Examples
Foreground execution:
{ "tool": "exec", "command": "rg TODO ." }
Background execution:
{ "tool": "exec", "command": "npm run dev", "background": true }
Related
- Process for viewing and controlling background sessions
- Read & Write for file operations
- CLI Reference for
mushroom-agent admin tools list