On this page
Sommatic Docs
Open portal

Local Shell Command

Execute shell command on the host machine.

View as Markdown
Open in
Input and output Available io.local.shell Version 1.0.0 Execution: async

Runs a command line through the system shell of the host that runs the worker and returns its trimmed stdout and stderr.

How it works

  1. Resolves the config. command, cwd and timeout (default 10000 ms) fall back to the same keys of the incoming payload.
  2. Fails through error when command is empty.
  3. Runs command in a shell, in cwd (default: the working directory of the orchestrator process), and stops it after timeout ms.
  4. Exit code 0 leaves through out with { stdout, stderr } trimmed; a non-zero exit, a timeout or a launch failure leaves through error with the untrimmed output.

In a workflow

The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.

{
  "node_id": "node-list-exports",
  "label": "List exports",
  "operator_slug": "io.local.shell",
  "operator_version": "1.0.0",
  "config": {
    "command": "ls /data/exports | grep orders",
    "cwd": "/data",
    "timeout": 10000
  }
}

Configuration

command string Required

Command to execute

cwd string Optional

Current Working Directory

timeout number Optional

Default: 10000

Behaviour in the code

What the implementation does with these keys beyond what the schema says.

command
Interpreted by the shell: pipes, redirections and && work, and values inserted with expressions become part of the command line. To pass data from upstream nodes as arguments, prefer code.shell, which runs a program with an argument list and no shell.

Output ports

out default

The command exited with code 0.

Data
{
  "stdout": "orders-2026-11-25.csv\norders-2026-11-26.csv",
  "stderr": ""
}
error

The command exited non-zero, timed out, exceeded the output buffer or could not start. Data is { error, stderr, stdout }; for a missing command, only { error }.

Data
{
  "error": "Command failed: ls /data/missing\nls: /data/missing: No such file or directory\n",
  "stderr": "ls: /data/missing: No such file or directory\n",
  "stdout": ""
}

In expressions

What a later node can read from this node's output with $("Local Shell Command").item.json.<path> (write your node's label instead of Local Shell Command). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through out, from the output shown in Ports.

ExpressionEditorWorker
$("Local Shell Command").item.json.stdoutstring= "orders-2026-11-25.csv\norders-2026-11-26.csv"
$("Local Shell Command").item.json.stderrstring= ""

Errors

Message Port Cause and fix
command is required error No command in the config nor in the incoming payload.
Command failed: <command> <stderr> error The command exited non-zero or was stopped after timeout ms. Read stderr for the reason; raise timeout for long commands.
stdout maxBuffer length exceeded error The command wrote more than about 1 MB to stdout or stderr. Write large output to a file and read it with io.local.file.

Input contract

command string Required
cwd string Optional
timeout number Optional

Output contract

stdout string Optional
stderr string Optional

Contracts (JSON Schema)

The definition exactly as the orchestrator declares it. All is the whole *.definition.js; compare it with the sections above to spot differences between the documentation and the schema. Use it to validate a node before you publish.

{
  "slug": "io.local.shell",
  "name": "Local Shell Command",
  "category": "io",
  "version": "1.0.0",
  "description": "Execute shell command on the host machine.",
  "capabilities": [
    "shell",
    "local",
    "terminal"
  ],
  "config_schema": {
    "type": "object",
    "properties": {
      "command": {
        "type": "string",
        "description": "Command to execute"
      },
      "cwd": {
        "type": "string",
        "description": "Current Working Directory"
      },
      "timeout": {
        "type": "number",
        "default": 10000
      }
    },
    "required": [
      "command"
    ]
  },
  "input_contract_schema": {
    "type": "object",
    "properties": {
      "command": {
        "type": "string"
      },
      "cwd": {
        "type": "string"
      },
      "timeout": {
        "type": "number"
      }
    },
    "required": [
      "command"
    ]
  },
  "output_contract_schema": {
    "type": "object",
    "properties": {
      "stdout": {
        "type": "string"
      },
      "stderr": {
        "type": "string"
      }
    }
  },
  "ports": [
    {
      "port_id": "out",
      "label": "Output",
      "description": "Command executed successfully",
      "is_default": true,
      "supports_condition": true
    },
    {
      "port_id": "error",
      "label": "Error",
      "description": "Command returned non-zero exit code or failed",
      "is_default": false,
      "supports_condition": false
    }
  ],
  "execution_mode": "async",
  "required_resources": [],
  "compatible_worker_pools": [
    "desktop-agent",
    "local-agent"
  ],
  "tags": [
    "local",
    "terminal"
  ],
  "is_stateful": false,
  "publisher": {
    "identity": "org_link_loom",
    "profile": {
      "name": "Link Loom",
      "verified": true,
      "url": "https://me.veripass.com/link-loom",
      "logo_url": null
    }
  }
}

Execution

Execution
async
Stateful
No
Capabilities
shelllocalterminal
Tags
localterminal

Notes and limits

  • The exit code is not included in the output; out means exit code 0.
  • The command runs on the host or container of the orchestrator worker, with that process's user and permissions.

Reviewed against the orchestrator code · 31e874b · 2026-11-26

Install agent tools

Give your coding agent the official Sommatic AI docs: skills, the docs MCP server and Markdown pages, so it never has to scrape the site.

Skills only. They do not update by themselves; run it again to refresh.

npx skills add https://docs.sommatic.ai
How agents read these docs