Skip to main content
Early access. GitHub and Slack runs start in a cloud sandbox operated by Mutagent, and cloud sandboxes are not open to every account yet: we are letting accounts in gradually while we test. There is nothing to host, and nobody has to be at a terminal.
The gateway starts a Helix run when an event arrives or a schedule comes due. These commands connect the providers, choose the repositories, and manage the triggers, routines and runs. See Gateway overview for the concepts.

Before you start

  1. Install the CLI and sign in. A coding agent signs in with MUTAGENT_API_KEY=<key> mutagent login --json, or runs mutagent login --browser --json and shows the printed URL to the person.
  2. Select the workspace: mutagent workspaces use <workspace-name>.
  3. Run mutagent gateway --json and do what next says. Connecting GitHub or Slack needs a person at a browser who is signed in to Mutagent.

JSON output and exit codes

Every command takes --json and prints one object:
  • Success: { "success": true, "ok": true, "data": …, "next": [ … ] }. next names the command to run next.
  • Failure: { "success": false, "ok": false, "error", "code", "suggestedAction", "_agentGuidance" }. Branch on code, not on the text. _agentGuidance.fix holds command lines to run; replace any <placeholder> in them first. _agentGuidance.notes is prose to read, not run. _agentGuidance.escalate is present when a person has to act, and says who.
The exit codes are the same as every other command: 0 success, 1 failure (usage errors included), 2 key expired or invalid, 3 not signed in or no workspace. See CLI errors. Never retry a failed command blind: run what _agentGuidance.fix says, or tell the person what escalate says.

mutagent gateway

With no arguments, print what is connected, what is missing, and the next command to run.

mutagent gateway status

Show the workspace’s connections and configuration.

mutagent gateway doctor

Run an end-to-end check and report each failure with the command that fixes it.
It checks that GitHub is connected, that the GitHub App reaches at least one repository, and that every linked repository is still reachable. When a check fails, the command exits 1 with code GATEWAY_CHECKS_FAILED; data.checks lists each check and _agentGuidance.fix lists the fixes in order. An empty list of linked repositories with every check passing is healthy: you do not need to link anything.

mutagent gateway connect

Connect GitHub or Slack for your organization. Prints a sign-in URL and a consent URL; open the sign-in URL first and the consent URL in that same browser. See Connecting GitHub and Slack. For a coding agent:
The first command prints data.signInUrl, data.url and data.attempt, and exits 0. Show both URLs to the person. The second waits for the attempt to finish. If GitHub or Slack is already connected, connect exits 0 and does nothing, so it is safe to run again.

mutagent gateway reconnect

Start a re-authorization attempt for a provider. Finish it with connect <provider> --wait --attempt <id>. It is also the fix for RUN_PRINCIPAL_UNAVAILABLE.

mutagent gateway disconnect

Remove a provider connection.

mutagent gateway repos

List repositories. With no flag or --available, every repository the Mutagent GitHub App can reach: the ones you gave it access to on GitHub. With --linked, the ones linked to this workspace, whether by repos link or automatically by use (a web session, a trigger or routine created with --repo, or a Slack mention), each with the number of triggers and routines that depend on it.
An empty list without --linked, with GitHub connected, means the app can reach no repository. Run mutagent gateway repos grant-more. Link one or more repositories to the workspace, up to 25 at a time, by owner/name or GitHub repository id. This is optional: a repository the app can reach is linked automatically the first time you use it. A repository the app cannot reach is refused, and none of the others are linked.
Unlink a repository. The triggers and routines that depend on it are paused, visibly, rather than deleted, and the repository stays out of the ones a Slack mention chooses from.

mutagent gateway repos grant-more

Print the GitHub page where you change which repositories the Mutagent GitHub App can reach.

mutagent gateway triggers

List the workspace’s triggers: yours first, then the built-in mention triggers, marked built-in. Built-in triggers are always on and cannot be updated, enabled, disabled or deleted.

mutagent gateway triggers create

Create a trigger: an event kind, a repository (or none) and an instruction. See Trigger kinds.
A retry with the same --key or --name and the same request returns the same trigger. A different request under the same key or name is refused with KEY_CONFLICT or NAME_TAKEN. With --json, data is the trigger with repo and repoSource. Next, check it with triggers test.

mutagent gateway triggers show

Show one trigger.

mutagent gateway triggers update

Change a trigger. Only the flags you pass change; everything else stays as it is. The kind and the repository cannot be changed: create a new trigger for those, then delete this one.

mutagent gateway triggers enable

Enable a disabled trigger.

mutagent gateway triggers disable

Stop a trigger firing without deleting it.

mutagent gateway triggers delete

Delete a trigger.

mutagent gateway triggers test

Report whether a sample event would match the trigger, and why not if it would not. No side effects, and no run is started.
sample.json looks like { "source": "github", "kind": "github.issues.opened", "repositoryId": "123" }. With --json, data.matches and data.wouldRun give the answer, and data.checks lists each check with passed and detail.

mutagent gateway routines

List the workspace’s routines with their next fire times.

mutagent gateway routines create

Create a routine: a schedule, a timezone, a repository (or none) and an instruction. Give exactly one of --every or --cron.
The output shows the normalized cron, the timezone and the next three fire times. With --json, read them from data.schedule.

mutagent gateway routines show

Show one routine, including why it is paused if it is.

mutagent gateway routines update

Change a routine. Only the flags you pass change. The repository cannot be changed: create a new routine for that, then delete this one.

mutagent gateway routines pause

Stop a routine firing without deleting it.

mutagent gateway routines resume

Start a paused routine again.

mutagent gateway routines run-now

Run a routine once, now, outside its schedule.
Without --wait, --json returns data.eventId. data.created is false when this key already ran; the event ID is then that run’s. Follow the run with mutagent gateway runs show <event-id> --json.

mutagent gateway routines delete

Delete a routine.

mutagent gateway test-run

Start a real run of the built-in test agent on a repository to prove the whole path works.
Success: exit code 0, with the run’s status in data. A run that ends in the failed phase fails the command (exit 1): read code, error and _agentGuidance. Without --wait, the command returns data.eventId at once; follow it with mutagent gateway runs show <event-id> --json.

mutagent gateway runs

List runs from triggers, routines, test runs and emit.
The states are queued, allocating, checkout_ready, grant_ready, running, succeeded, failed, cancelled and unknown.

mutagent gateway runs show

Show one run, by run id (from runs) or event id (from test-run, emit or events list).
An event ID returns data.phase; a run ID returns data.state. Branch on whichever is present. An event that started no run has phase no-match, and data.error says why. filed_as_triage is not a failure: a Slack mention filed a triage item instead of starting a run.

mutagent gateway runs logs

Read a run’s logs, by run id or event id.

mutagent gateway runs cancel

Stop a run that is still going, and its Helix session.
A run that already finished is refused with RUN_NOT_ACTIVE. A run that is still starting has no session to stop yet and is refused with RUN_STARTING: run the same cancel again in a few seconds. Cancelling a run that is already cancelled succeeds.

mutagent gateway emit

Send an event of your own kind. An emit:<kind> trigger fires on it.
The payload is always a file reference (@file.json), never inline JSON. With --json, data.eventIds lists the events created; it can be empty when no emit:<kind> trigger matches, which is not an error. The kinds routine.*, onboarding.*, trace.threshold and github.ci-failed are reserved and refused. To run a routine now, use routines run-now.

mutagent gateway events list

Every event that reached the workspace, newest first, with its outcome.

mutagent gateway notices list

Each time a Slack or GitHub mention of the app started no run: why, and the reply the gateway sent.

If it fails

All of these exit 1 unless the table says otherwise.