Bash Command Tool
This feature is supported in the Professional Edition.
The Bash Command Execution Tool is a tool designed for command execution. It helps users automatically execute various command operations in a controlled, secure environment.
Core Featuresโ
- Automatic Command Execution: Users only need to input a command, and the system will execute it automatically without requiring manual interaction with the terminal interface.
- Real-Time Result Streaming: Terminal output during execution is returned in real-time, allowing users to instantly view the output and quickly verify the command's effect.
- Secure Environment Execution: All commands are executed in an isolated sandbox environment, effectively preventing risks to the real system environment and ensuring data and operation safety.
- Integration with Task Workflows: This tool can be used standalone or integrated into larger task workflows, working alongside other tools to complete complex operations.
Applicable Scenariosโ
Scenario | Application Example |
---|---|
๐งช Data Analysis | Automatically generate files or logs required for data analysis |
๐ File Management | Quickly list, search, or process file directories |
๐ Script Execution | Execute a script task and retrieve the output results |
๐ค Agent Tasks | Serve as a step in an intelligent assistant's process to complete specific tasks |
Usageโ
Users only need to provide a single command, such as:
- List files
- Check the current system time
- Download a specific file
- Unzip a compressed package
The system will execute the command in the background and return the results to you without any additional operations required.
Best Practicesโ
Example Prompt:
You have two powerful sets of tools:
1. A set of tools for editing and creating files (used for generating Python scripts, etc.).
2. A set of tools for executing Bash commands (used for running command-line tasks).
When a user requests tasks involving document conversion, content generation, format export, or other automation needs (e.g., "Convert Markdown to PDF," "Generate a PPT presentation," "Batch process Excel data," etc.), follow these steps:
---
**Workflow:**
1. **Understand the task requirements and determine if they are suitable for Python implementation.**
2. **Use the "file editing tool" to create a Python script with a clear name (e.g., `generate_pdf.py`, `create_ppt.py`, etc.).**
3. **Execute the following command using the Bash tool to use [`uv`](https://github.com/astral-sh/uv) to create a virtual environment and run the script:**
> ```bash
> [ -d .venv ] || uv venv .venv --python=python3.11 && source .venv/bin/activate && python -m ensurepip --upgrade && python -m pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple && python your_script.py
> ```
4. **Ensure that the required dependencies are listed in `requirements.txt`.**
---
**Python Script Requirements:**
- Must be independently executable with clear, configurable input and output paths.
- Prioritize commonly used libraries such as: `python-pptx`, `reportlab`, `fpdf`, `pandas`, `matplotlib`, etc.
- If required dependencies are not installed in the system, generate a `requirements.txt` file for installation.
---
**Goal:** Always prioritize using Python + uv environment to complete tasks, ensuring the final result aligns with the userโs intent and is reusable.
If a file is generated, use `list_files` to retrieve the file list, find the fileโs name and URL, and inform the user that they can download the file in the format `[name](url)`.
Frequently Asked Questionsโ
Q1: Can any command be executed?
A: The tool supports common, safe commands. Dangerous commands (e.g., deleting critical files) are automatically blocked or restricted.
Q2: Are the execution results reliable?
A: The tool returns the complete output of the command execution, ensuring transparent information.
Q3: Who is this tool suitable for?
A: It is suitable for analysts, product managers, operations personnel, and other roles looking to improve operational efficiency.