# 贝壳

Canonical URL: https://developers.iagenify.com/zh/sdk/agent/bridges/shell/
Language: zh

`shell: { run(command, { timeoutMs, signal }) }`

一种功能, 并且撞击存在于除此机器以外的其他地方。 它可以取代电脑的外壳, 不论您在哪里提供 。

Status: one function · exit code matters · always asked

## 形状 {#shape}

```javascript
const shell = {
  async run(command, { timeoutMs, signal } = {}) {
    // …run it somewhere…
    return { stdout: "", stderr: "", exitCode: 0 };
  },
};
```

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `command` | string |  | 跑什么跑啊 跑什么跑啊 跑什么跑啊 |
| `timeoutMs` | integer |  | 尊重它 永不结束的命令 就能维持运行 |
| `signal` | AbortSignal |  | 运行停止后开火, 停止进程 。 |
| `returns` | object |  | `{ stdout, stderr, exitCode }`。在创建时拒绝其他任何内容 `invalid_shell`. |

## 退出代码是合同 {#exitcode}

> **代理指示检查并纠正错误**
>
> 总是返回 0 的桥让每一个失败都看不见: 代理读取输出, 看不到失败, 继续。 返回真实代码 — — 保持指令循环诚实的唯一信号 。

## 仍有人问它 {#permission}

`bash` is [exec](/zh/sdk/agent/permissions/categories/exec) whatever runs it, so it is asked in every mode but full. One difference: an « always » on a supplied shell lasts for the session only — it is never written to this computer's permanent list, because the command did not run on this computer.

## 说说贝壳是什么 {#prompt}

系统提示描述机器的外壳: 手机得到“ 沙箱式的碎箱式外壳” 其限制有名; 云工作空间被告知, 外壳是Linux, 路径是 POSIX错误是昂贵的——一个代理人认为,另一个平台上写着命令,但所有命令都因一个原因而失败。

## 没有它 {#no-shell}

手机或云工作空间,没有 `shell` 表示无 `bash` 完全没有声明工具, 操作命令的指示也随之消失。 在计算机上, 机器自己的外壳被使用 。

## 背景命令需要终端 {#background}

`bash { background: true }` 开始的东西 超越答案, 需要 [终端终端](/zh/sdk/agent/bridges/terminals)光靠一个外壳,一个长运行的服务器就从前台开始运行, 超时会杀死它。

- [闪盘](/zh/sdk/agent/tools/bash): 工具。
- [终端终端](/zh/sdk/agent/bridges/terminals): 任何必须持续运行的东西

```python
# The Python engine runs bash itself, on a LocalFiles workspace (subprocess in the
# workspace folder). A machine without a local workspace gets no bash tool.
pc = api.storage.get()
api.agents.create(runtime="local", machine=pc, model=model, tools=["read", "list", "bash"])
```
