# 闪盘

Canonical URL: https://developers.iagenify.com/zh/sdk/agent/tools/bash/
Language: zh

`bash({ command | commands, timeout_ms?, stop_on_error?, background?, port?, description? })`

在工作空间运行 shell 命令, 并获得退出代码和输出。 具有最广范围的工具, 并且每个模式都要求使用该工具, 但要求使用完整 。

Status: category: exec · 120 s, max 600 s · always asked outside full

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `command` | string |  | 只有一个命令。 |
| `commands` | string[] |  | 几个,按顺序跑 **一次呼叫**. |
| `timeout_ms` | integer | 120 000 | 命令最多600 000 |
| `stop_on_error` | boolean | true | 停止第一个非零退出代码的序列 。 |
| `background` | boolean | false | 在一个超过答案的终端运行。只有一个命令。 |
| `port` | integer |  | 与 `background`:服务器收听的端口。终端公布并返回 URL. |
| `description` | string |  | 向用户展示五字摘要。 |

## 一次调用数个命令 {#batching}

> **每一单独的呼叫费用**
>
> 命令 [“npm ci” 、 “npm run building” 是一个转弯; 两个调用是两个。批量指令在工具的描述中,在系统中是快速的,因为模型不独立操作。

序列被批准为顺序:用户看到三个命令按顺序排列,因此批准它们不会在日后单独批准其中任何一个。

## 哪个贝壳 {#shell}

| 何处 | 壳牌 |
| --- | --- |
| 计算机运行窗口 | 电电光板 |
| 其他地方一台计算机 | 闪盘 |
| A 提供 [贝壳桥](/zh/sdk/agent/bridges/shell) | 不论你们在什么桥上奔奔而奔而奔而奔而而奔而而奔而而奔而而奔而而奔而而奔而而奔而而而奔而而奔而而而奔而而奔而而奔而而奔而而奔而而而奔而而奔而而而奔而而而奔而而奔而而奔而而而奔而而奔而而而奔而而而奔而而奔而而奔而而而奔而而而奔而而而奔而而而奔而而而奔而而而奔而而奔而而而奔而奔而而而 |
| 一个云云工作空间 | bash, 提示语法明确 |

## 服务器进入背景 {#servers}

```javascript
bash({ command: "npm run dev -- --host", background: true, port: 5173 })
// → the terminal id, its first output, and a URL
```

- 前景中从来没有: 无法完成的服务器在超时时会死亡 。
- 从未分离 `nohup`, `&` 或工作——它会运行到用户看不到或无法阻止它的地方。
- 使服务器在所有界面上监听( )`--host`, `-H 0.0.0.0`) ,或 URL 没有任何答案。

## 退出密码是信号 {#exit}

代理商被要求检查和修正错误。 空壳桥总是返回零, 使每个失败都无法识别 。

## 并不总是有这种现象 {#absent}

手机或无 `shell` 桥梁,这一工具根本没有被宣布——没有任何东西会运行它。

- [终端终端](/zh/sdk/agent/tools/terminal): 遵循背景命令正在做的事情 。
- [exec](/zh/sdk/agent/permissions/categories/exec): 为什么汽车会问它。
- [智能体工具](/zh/sdk/agent/tools): The 35, by family.

```python
# The Python bash tool runs one command and returns when it ends:
#   bash {"command": "npm test", "timeout_ms": 120000}
#   → {"exitCode": 0, "stdout": "…", "stderr": ""}
# A server that must keep running goes through terminal {"action": "create", "command": "npm run dev"}
```
