> ## Documentation Index
> Fetch the complete documentation index at: https://ppio.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 在沙箱中执行命令

> 查阅 PPIO Agent 沙箱命令执行的归档指南，了解该版本的终端任务运行方式，为维护既有自动化执行流程提供参考。

您可以使用 `commands.run()` 方法在沙箱内运行终端命令。

```js JavaScript & TypeScript icon="js" theme={null}
import { Sandbox } from 'ppio-sandbox/code-interpreter'

const sandbox = await Sandbox.create()

const result = await sandbox.commands.run('ls -al')
console.log(result)

await sandbox.kill()
```

```python Python icon="python" theme={null}
from ppio_sandbox.code_interpreter import Sandbox

sandbox = Sandbox.create()

result = sandbox.commands.run('ls -al')
print(result)

sandbox.kill()
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.