Documentation Index
Fetch the complete documentation index at: https://docs.gp.scale.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Build and Deploy API and SDKs give you programmatic control over Agentex cloud builds and deployments. You can create builds, poll for status, stream logs, create deployments, and tear them down through REST endpoints under/v5/builds and /v5/agentex/deployments, or through the equivalent Python and TypeScript SDK methods.
The API and SDKs expose the same underlying resources as the UI, CLI, and CI/CD interfaces, so anything you create or modify programmatically is visible everywhere else. Use them when you need to integrate builds and deployments into custom automation or tooling.
For full SDK documentation, see the Python SDK reference and TypeScript SDK reference.
Authentication
Every request to the Build and Deploy API requires two headers:| Header | Description |
|---|---|
x-api-key | Your SGP API key. Found in the IAM or admin section of the SGP dashboard. |
x-selected-account-id | Your SGP account ID. Found in the admin section of the SGP dashboard. |
The Python and TypeScript SDKs handle authentication headers automatically once you initialize the client. The examples in the rest of this page assume you have already created a
client instance as shown above.Build lifecycle
A build packages your agent source code into a container image. The lifecycle is: create the build, poll its status until it reaches a terminal state, and optionally stream logs or cancel it. See the build status lifecycle for the full state diagram.Create a build
To create a build, send a multipart form request with your build context archive (a.tar.gz of your agent source code), the target image name and tag, and the agent name.
queued. Use the build ID to poll for status updates and retrieve logs.
Optional parameters:
| Parameter | Description |
|---|---|
build_args | Key-value pairs passed as Docker build arguments |
platform | Target platform for the image build (e.g., linux/amd64) |
Get build status
PollGET /v5/builds/{build_id} to check the current status of a build.
Cancel a build
You can cancel a build that is inqueued or running state.
Deploy lifecycle
A deployment takes a successfully built container image and rolls it out to a Kubernetes cluster. The lifecycle is: create the deployment, poll its status until it becomeshealthy or failed, and inspect logs for debugging. See the deployment status lifecycle for the full state diagram.
Create a deployment
To create a deployment, provide themanifest_file (your manifest.yaml content as a string), the environment_config (your environments.yaml content as a string), and a build_id referencing a successful build.
build_id, you can supply image_name and image_tag directly to deploy a pre-existing image.
To create a preview deployment (ephemeral, with automatic teardown), add the following optional parameters:
| Parameter | Description |
|---|---|
preview | Set to true to create a preview deployment |
preview_label | A label for the preview (e.g., pr-482). Maximum 30 characters. |
expires_at | ISO 8601 timestamp for when the preview should be torn down |
Get deployment status
PollGET /v5/agentex/deployments/{deployment_id} to check the current status and view deployment events.
Delete a deployment
To tear down a deployment and release its cluster resources:Polling pattern
Builds and deployments are asynchronous operations. After creating either resource, poll the status endpoint until the resource reaches a terminal state. Build statuses:queued → running → success | failed | cancelled | timed_out | error
Deploy statuses: pending → in_progress → healthy | failed | cancelled
A polling interval of 5 seconds is a reasonable default. Builds typically take 2-10 minutes depending on image complexity. Deployments typically take 1-5 minutes depending on image size and cluster capacity.
Log streaming
Build logs and deployment logs use different retrieval mechanisms.Build logs (SSE)
Build logs are streamed via Server-Sent Events (SSE) fromGET /v5/builds/{build_id}/logs. Each event contains a log line from the image build process.
text/event-stream data. Each line is a log entry from the build. The stream closes when the build completes.
Deployment logs (cursor-based pagination)
Deployment logs are retrieved with cursor-based pagination fromGET /v5/agentex/deployments/{deployment_id}/logs. Each response includes a page of log lines, a next_cursor for fetching the next page, and a has_more flag.
Listing and filtering
Use the list endpoints to retrieve builds and deployments for an agent, filtered by common criteria.List builds
Retrieve builds filtered by agent name, with control over result count and sort order.List deployments
Retrieve deployments, optionally filtered by preview label to find the latest deployment for a specific branch or PR.Undeployed builds
To find agents that have completed builds but no healthy deployment, use the undeployed builds endpoint:API and SDK reference
For full request and response schemas, see the generated API reference and SDK documentation: API reference:- Agentex Cloud Build: endpoints for creating, listing, polling, and cancelling builds
- Agentex Cloud Deploy: endpoints for creating, listing, inspecting, and deleting deployments
- SGP Cloud Secrets: endpoints for managing account-level secrets
- Python SDK:
scale_gp_betapackage (client.build,client.deploy,client.secrets) - TypeScript SDK:
scale-gppackage (client.build,client.deploy,client.secrets)
The Build and Deploy API does not support webhooks or push notifications. You must poll the status endpoints to track build and deployment progress. There is no callback mechanism to notify your system when a build completes or a deployment becomes healthy.
Next steps
- sgpctl CLI: the same operations from the terminal with a simpler interface
- CI/CD with Gitea Actions: automate builds triggered by git push
- Secrets: manage credentials via API/SDK or the dashboard
- Preview Deployments: ephemeral deployments for branch and PR testing

