Skip to main content
gateway builds, publishes, seeds, serves and runs worlds from a terminal. One command talks to one project on your Surface Area host, so anything the CLI does is also visible in the dashboard and reachable over the REST API.

Install the command from npm

The CLI ships in the TypeScript SDK package, @withgateway/sdk. It needs Node.js 18 or newer.
To skip the global install, run npx @withgateway/sdk gateway <command>, or add the package as a dev dependency and call npx gateway.

Sign in once per machine

gateway auth login writes the host and key pair to ~/.gateway/config.json with owner-only permissions. Generate the key pair under Project Settings → API keys; the world, session or version you create lands in the project those keys belong to.
Pass the secret key through an environment variable or a secrets manager, as the example above does. A key typed on the command line lands in your shell history.

Credentials resolve in a fixed order

Every command looks for a host and a key pair in three places and stops at the first that answers. Use environment variables in CI, where no login step runs:
A missing host or key pair fails immediately and names which one is absent, instead of sending an unauthenticated request.

The schema runtime runs locally when Python is there

Compiling a world’s contract, serving its API and capturing from a vendor all run the schema runtime: stdlib-only Python that the npm package carries alongside dist/. Any python3 at version 3.12 or newer on your PATH runs those files exactly as the platform does, with no pip step and no PyPI download. Without such an interpreter, the same commands post the same request to the platform, which runs the identical code and returns the result. The difference is whether gateway worlds serve binds a local port or opens a hosted session.
GATEWAY_RUNTIME=local turns the fallback into an error. Use it in CI so a build fails when the local runtime is missing.

Output is JSON unless a command says otherwise

Most commands pretty-print the platform’s JSON response to standard output, ready to pipe into jq. A few print a human summary instead and take --json to switch: worlds create, worlds schema templates, worlds schema describe, worlds test, worlds session list, worlds sandbox list and release gate. Commands whose output is already JSON accept --json and ignore it. A flag value may start with a dash (--content "-- x"); a token is read as a flag only when it names one of that command’s flags. Four commands write a stream rather than a document. worlds session export prints JSONL, one call per line; worlds data extract prints tagged JSONL with a summary on standard error; traces export prints one trace per line; files cat prints a file’s bytes. Any command that takes a local file takes drive:<path> for a file in the project’s drive, and --to <path> on worlds data calls pull, worlds data extract and worlds session export lands the output there.

Exit codes tell CI what happened

Commands that treat 2 as “refused, not broken” say so in their own --help: worlds data import, worlds data check and worlds create --batch.

A request with no answer stops after two minutes

Every request to the platform — from the CLI and from the TypeScript and Python SDKs — gives up after 120 seconds without an answer. The command then exits 1 with one line naming the cause, such as connection refused, DNS lookup failed or a timeout, instead of hanging. Set GATEWAY_TIMEOUT_MS to change the budget, in whole milliseconds:
Any other value (zero, negative, not a number) is refused. worlds sandbox requests keep their own 660-second budget. Five agent-readable guides ship inside the package. gateway worlds skill <name> prints one to standard output; --install <repo> writes it, plus any agent it ships, into that repository’s .claude/ directory. gateway skill search <words> finds the guide for a topic by its description and section headings.
gateway worlds connector skill is an alias for the connector one. --force overwrites an installed copy whose content has drifted.

The command groups

gateway algorithm, gateway deploy and gateway init belong to the Python package — see the Python SDK overview.

Where to go next

  • worlds — every gateway worlds subcommand, grouped by workflow.
  • bench & versions — pushing bundles, and how slug@ref pins resolve.
  • files — the drive from the terminal, and drive:<path> in worlds data commands.
  • traces — reading and exporting traces, and importing OTLP.
  • dashboards — a design dashboard’s render code in a local directory: edit, push, render.
  • Getting started with worlds — the same steps as a narrative.