Skip to main content

Overview

sgpctl is the command-line interface for managing Agentex cloud builds and deployments. It covers the same operations available through the SGP dashboard and the API/SDK, packaged for terminal workflows. The CLI is organized under sgpctl agentex-cloud with two subcommand groups:
  • build: submit cloud builds, list builds, stream build logs, and cancel running builds.
  • deploy: submit deployments, list deployments, stream deploy logs, and watch rollouts in real time.
Every command outputs structured data (JSON or Rich tables) that you can pipe into other tools or inspect directly.

Setup

Install sgpctl

Homebrew (macOS):
Binary download (Linux/Windows): Download the latest binary for your platform from the sgpctl GitHub releases. From the SGP monorepo: If you have the SGP repository cloned locally, you can build and install from source:

Configure environment variables

All sgpctl agentex-cloud commands require three environment variables:
All three environment variables are required. Commands will fail immediately if any of them is missing.
You can add these exports to your shell profile (~/.bashrc, ~/.zshrc) or load them from a .env file in your CI pipeline.

Build commands

Build commands live under sgpctl agentex-cloud build. They let you submit new image builds, query build status, stream logs, and cancel running builds.

Submit a build

Package your agent source code and submit it for a cloud build:
The submit command reads your manifest.yaml, packages the build context using prepare_cloud_build_context(), uploads the resulting tar.gz archive, and creates a build via POST /v5/builds. On success, the command prints the build details as JSON:
Options: You can pass multiple build arguments by repeating the flag:

Get build details

Retrieve the full details of a specific build:
Returns the build object as JSON, including status, image URL, timestamps, and associated metadata.

List builds

List recent builds, optionally filtered by agent name:
Example output: Options:

Stream build logs

Stream real-time build logs for a running or completed build:
Logs are delivered via Server-Sent Events (SSE) and print to stdout as they arrive:
The command exits when the build completes or the timeout is reached.

Cancel a build

Cancel a build that is queued or running:
The build transitions to cancelled status. Builds that have already completed cannot be cancelled.

Deploy commands

Deploy commands live under sgpctl agentex-cloud deploy. They let you submit deployments, check deployment status, stream logs, and watch rollouts.

Submit a deployment

Deploy an agent using a completed build:
The submit command reads manifest.yaml and environments.yaml from the directory specified by --agent-path, then creates a deployment via POST /v5/agentex/deployments. Alternatively, specify an image directly instead of a build ID:
Options:
You must provide either --build-id or both --image-name and --tag. The command will reject the request if neither or both are specified.

Watch a deployment roll out

Pass --watch to deploy submit to enter a fullscreen Rich dashboard immediately after the deployment is created:
The TUI dashboard shows three sections: a status header at the top (agent name, environment, deployment ID, current status), a Kubernetes events panel on the left, and a container logs panel on the right. Both panels update in real time as the deployment progresses. The dashboard auto-refreshes and exits automatically when the deployment reaches a terminal state (healthy or failed). Press q or Ctrl+C to exit early.

Get deployment details

Retrieve the full details and events for a specific deployment:
Returns the deployment object as JSON, including status, events timeline, and configuration.

List deployments

List recent deployments:
Example output: Options:

Streaming logs

Both build and deploy commands support log streaming, but they use different transport mechanisms.

Build logs (SSE)

Build logs stream via Server-Sent Events. The build logs command opens a persistent connection and prints each log line as it arrives:
The connection closes when the build completes or the timeout expires. This is useful for watching a build in progress from your terminal.

Deploy logs (cursor-paged polling)

Deploy logs use cursor-based polling. The deploy logs command fetches new log lines at a configurable interval:
By default, the output renders in a Rich Live TUI panel that updates in place. For CI environments or piping to a file, use the --plain flag:
In plain mode, each log line is written to stdout as a single line with no formatting, making it suitable for CI log capture or grep:
Options:

Common workflows

Ship from laptop

Build an image and deploy it in one sequence:
After the build completes, the deploy command with --watch gives you a live view of the rollout from start to finish.

Check what is deployed

List active deployments to see which builds are currently serving traffic:
To get full details on a specific deployment, including the image tag and environment configuration:

Roll back to a previous build

Redeploy a known-good build by referencing its build ID:
This creates a new deployment using the image from the previous build. The existing deployment is replaced when the new one becomes healthy.

Tail logs on a running deployment

Stream container logs from a deployment that is already running:
Use --plain to capture logs in a file:

Next steps