Overview
Theexec tool gives your agent the ability to run bash commands on the host system. This is one of the most powerful tools available, enabling the agent to install software, manage files, run scripts, query APIs, and automate system tasks.
Usage
The agent calls theexec tool with a command string:
Parameters
Security
Sandbox Modes
Tool Policies
You can configure per-command policies inargent.json:
Approval Flow
In sandboxed mode, when the agent attempts a command that requires approval:1
Command displayed
The command is shown to the user in the dashboard or channel.
2
User decides
The user approves or rejects the command.
3
Execution or fallback
If approved, the command executes. If rejected, the agent is informed and can try an alternative.
Working Directory
By default, commands run in the agent’s workspace directory (configured inargent.json). The agent can specify a different cwd per command.
Timeouts
Commands that exceed the timeout are killed. The default timeout is 120 seconds (2 minutes). Long-running tasks should be broken into smaller steps or run in the background.
Output Handling
- stdout is returned as the tool result
- stderr is included in the result with an error flag if the exit code is non-zero
- Large outputs may be truncated to fit within token limits
