bash (Anthropic, côté client)
Tool : A precise action the AI can call · requires anthropic-api
Claude requests shell commands that your code executes.
Essential for code agents; your code must handle filtering and confinement.
Security reflects where data goes, requested permissions and incidents on record at the verification date. It is not a guarantee of zero risk: check the deployment mode and the connections you enable.
What it does, concretely
Automating command-line tasks from an AI agent raises a concrete question: who actually runs the commands, and in which environment? The bash tool addresses this by clearly separating responsibilities: Claude formulates the command, and your application executes it in a bash process it fully controls.
In practice, when you include the tool in a request, Claude responds with a tool_use block containing the command to run. Your code executes that command in a persistent bash session, then returns stdout and stderr in a tool_result block. The session stays alive between calls: the working directory, environment variables, and any files created are preserved from one call to the next.
This tool is aimed at developers building code agents, automation pipelines, or data analysis tools via the Anthropic API. It covers use cases such as running tests, installing packages, processing files, or configuring an environment.
It is not suitable for use without isolation: every command runs on your infrastructure with your permissions. Without a container or virtual machine and without an allowlist of permitted commands, the risk of unintended execution is real.
What it offers
- ·Persistent bash session: the working directory, environment variables, and created files are preserved between calls.
- ·Client-side execution: Claude proposes the command, your code runs it and returns the result, without Claude accessing your system directly.
- ·Parallel tool calls: Claude can return multiple tool_use blocks in a single response, to be run in order within the same session.
- ·Session restart: the restart parameter kills the bash process and starts a fresh one.
- ·Structured error reporting: the is_error field in tool_result signals to Claude that a command failed, along with the corresponding message.
- ·Timeout handling: your code can enforce a time limit per command and restart the session if it hangs.
- ·Compatible with all current Claude models via version bash_20250124, with no beta header required.
In practice
- Price
- Free
- Commercial use
- Commercial use: yes
- Available on
- api
- Host
- anthropic-api
- FR interface
- No
Security and data
- Rating
- Security: serious reservations
- Capabilities
- readswritesexecutesnetwork
- Your data
- Data stays local
- Maintenance
- Active
Links and repository checked on 25 October 2026 · added on 1 January 2025
How to install bash (Anthropic, côté client)
pip install anthropic