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

# Terminal Overview

> Run terminal workflows in Runtimes with run_cmd and optional SSH access

Runtimes support terminal-style workflows through `run_cmd` and optional SSH access.

## When to Use run\_cmd

* Install dependencies at runtime (needs a [network policy](/documentation/agentruntime/getting-started/network-policies) — see [Install Packages](/documentation/agentruntime/command-execution/run-command#install-packages))
* Run shell scripts and CLIs
* Inspect filesystem/process state
* Execute one-off operational commands

## Example

<CodeGroup>
  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  from gravixlayer import GravixLayer

  client = GravixLayer()  # defaults to cloud="aws", region="us-east-1"
  sandbox = client.runtime.create()  # defaults to template="base-small"

  check = sandbox.run_cmd(command="python", args=["--version"])
  print(check.stdout)

  listed = sandbox.run_cmd(command="ls", args=["-la", "/workspace"])
  print(listed.stdout)

  sandbox.kill()
  ```

  ```typescript TypeScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import { GravixLayer } from 'gravixlayer';

  const client = new GravixLayer(); // defaults to cloud="aws", region="us-east-1"
  const sandbox = await client.runtime.create(); // defaults to template="base-small"

  const check = await sandbox.runCmd('python', { args: ['--version'] });
  console.log(check.stdout);

  const listed = await sandbox.runCmd('ls', { args: ['-la', '/workspace'] });
  console.log(listed.stdout);

  await sandbox.kill();
  ```

  ```bash CLI theme={"theme":{"light":"github-light","dark":"github-dark"}}
  gravixlayer runtime exec "$RT" -- python --version
  gravixlayer runtime exec "$RT" -- ls -la /workspace
  ```

  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X POST "https://api.gravixlayer.ai/v1/agents/runtime/$RT/commands/run" \
    -H "Authorization: Bearer $GRAVIXLAYER_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "command": "ls",
      "args": ["-la", "/workspace"]
    }'
  ```
</CodeGroup>

## Terminal + SSH

* Use `run_cmd` for programmatic command execution.
* Use SSH for interactive operator access.
* Revoke SSH when interactive access is no longer required.

<CardGroup cols={2}>
  <Card title="Run Command" icon="play" href="/documentation/agentruntime/command-execution/run-command">
    Detailed run\_cmd usage and parameters
  </Card>

  <Card title="Access Runtime" icon="key" href="/documentation/agentruntime/ssh-access/overview">
    Enable, disable, and rotate SSH credentials
  </Card>
</CardGroup>
