Skip to content

Remote execution and runbooks

Sencai gives you two ways to act on a fleet agent remotely: one-off commands from a fixed template, and multi-step runbooks you define once and trigger repeatedly. Both are dispatched over the agent’s existing connection - no inbound port, no separate SSH session - and both are capability-gated per agent, so nothing runs on a host that hasn’t explicitly been allowed to accept it.

Fleet → Remote Exec (/gravity/fleet/remote-exec) dispatches a pre-defined command template to one or more connected agents.

  1. Open Fleet → Remote Exec.
  2. Choose one or more Target Agents (only currently connected agents are listed).
  3. Choose a Command Template - only templates your organization has marked allowed appear here, and the template’s exact command is previewed before you run it.
  4. Optionally supply arguments as JSON.
  5. Click Execute.

Where dispatch is enabled, the target agent also needs the remote-exec capability granted (an organization Owner or Admin grants it per agent from Fleet → Agents → Grant Capability); without it, the dispatch is recorded as blocked rather than run.

The Execution Results table shows every dispatch: agent, command, status (pending / running / completed / failed / blocked), exit code, and duration. Click into any row for the rendered command, stdout, and stderr.

Runbooks (/gravity/runbooks) are named, reusable action sequences you define once and trigger repeatedly - closer to a saved script than a one-off command.

  1. Open Runbooks and click New Runbook.
  2. Give it a name and a trigger type: manual (you trigger it yourself) or alert (triggered by the platform’s own alerting, covered in Operations → Auto-remediation).
  3. Define its actions as a JSON list. Supported action types are restart_service, clear_disk_space, kill_process, and run_approved_script - the last one is restricted to scripts already staged on the target agent, it can’t run arbitrary paths.
  4. Approval is required by default - turn Require approval off if you want a trigger to execute immediately - and set a cooldown so the same runbook can’t be re-triggered too soon after itself.

Open a runbook and click Trigger. You must specify which agent the run targets - there’s no organization-wide “run everywhere” option. You can also run a dry run first, which reports what would happen without actually executing anything.

If the runbook requires approval, triggering it creates a pending execution - nothing runs on the host until an admin approves it.

Creating, editing, and triggering runbooks - like triggering remote commands - requires an organization Owner or Admin role, given the direct access to a host either capability provides.

Every command dispatch and every runbook trigger - who initiated it, on which agent, with what result - is recorded in your organization’s audit trail. See Audit log.

  • Fleet agent - the capability model this all runs on top of
  • Agent policies - autonomy levels, freeze windows, secret injection and custom probes (capabilities are granted on Fleet → Agents)
  • Runbooks - authoring, dry runs, approval, and versioning
  • Auto-remediation - runbooks triggered by alerts, not by you
  • Quarantine - isolating a host instead of running a command on it