All Products
Search
Document Center

Function Compute:Run Commands

Last Updated:Jul 13, 2026

Commands is the basic capability for running commands or processes in FC Agent Sandbox. It underpins agent tool calls, code execution, and environment checks.

Run a command

Run a command and read stdout:

result = sandbox.commands.run("ls -lh /")
print(result.stdout.strip())

TypeScript example:

const result = await sandbox.commands.run("ls -lh /");
console.log(result.stdout.trim());

Compatible methods

  • sandbox.commands.run(): Start a process and wait for the result.

  • sandbox.commands.list(): List running processes.

  • sandbox.commands.connect(): Connect to an existing process.

  • sandbox.commands.sendStdin(): Send standard input.

  • sandbox.commands.kill(): Stop a process.

Interactive terminals and tasks that depend on TTY should use the dedicated sandbox.pty API. For details, see PTY.

Further reading