Skip to content

Delete and tear down a deployment

DELETE/v5/agentex/deployments/{deployment_id}

Delete an agent deployment and tear down its Kubernetes resources.

Deletes the deployment’s Kubernetes resources first, then marks the record as DELETED; the underlying Helm release is subsequently uninstalled asynchronously by FluxCD once the resource is removed. If the Kubernetes teardown fails, the record is left unchanged and the call errors, so the delete can be safely retried. Rejects the call with a client error if the deployment is already in a terminal state (DELETED, CANCELLED, or SUPERSEDED) — a SUPERSEDED record shares its Helm release with the deployment that replaced it, so deleting it would tear down the live release. Returns 404 if no deployment with this ID exists for the caller’s account. This removes a running deployment, not the image build behind it, which is managed separately through the agentex builds API.

Path ParametersExpand Collapse
deployment_id: string
ReturnsExpand Collapse
AgentexCloudDeploy object { id, account_id, created_at, 11 more }
id: string

The unique identifier of the deployment.

account_id: string

The ID of the account that owns the given entity.

created_at: string

The date and time when the entity was created in ISO format.

formatdate-time
created_by: Identity { id, type, object }

The identity that created the entity.

id: string
type: "user" or "service_account"
One of the following:
"user"
"service_account"
object: optional "identity"
environment_config: string

YAML content of environment configuration from the environment config file.

manifest_file: string

YAML content of manifest configuration.

namespace: string

Kubernetes namespace where the deployment is deployed.

status: string

Deployment status: pending, running, completed, failed, or cancelled.

build_id: optional string

The build_id of the cloud build that produced the deployed image.

deploy_events: optional array of AgentexCloudDeployEvent { message, reason, timestamp, type }

Kubernetes events for this deployment.

message: optional string

Full event message.

reason: optional string

Short reason, e.g. ‘Pulling’, ‘Scheduled’.

timestamp: optional string

When the event was observed.

formatdate-time
type: optional string

Event type, e.g. ‘Normal’ or ‘Warning’.

expires_at: optional string

When this deployment will be cleaned up. Always set on preview deployments (defaults to 8 hours from creation if the request omits it). Null on non-preview deployments — they have no TTL.

formatdate-time
helm_release_name: optional string

Helm release name after successful deployment.

object: optional "agentex_cloud_deploy"
preview_label: optional string

Non-unique grouping label for preview deployments. Filter ?preview_label=X&limit=1 returns the latest deploy for the label. Sanitized (lowercase alphanumeric + hyphens) and capped at 30 characters.

Delete and tear down a deployment

curl https://api.egp.scale.com/v5/agentex/deployments/$DEPLOYMENT_ID \
    -X DELETE \
    -H "x-api-key: $SGP_API_KEY"
{
  "id": "id",
  "account_id": "account_id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "created_by": {
    "id": "id",
    "type": "user",
    "object": "identity"
  },
  "environment_config": "environment_config",
  "manifest_file": "manifest_file",
  "namespace": "namespace",
  "status": "status",
  "build_id": "build_id",
  "deploy_events": [
    {
      "message": "message",
      "reason": "reason",
      "timestamp": "2019-12-27T18:11:19.117Z",
      "type": "type"
    }
  ],
  "expires_at": "2019-12-27T18:11:19.117Z",
  "helm_release_name": "helm_release_name",
  "object": "agentex_cloud_deploy",
  "preview_label": "preview_label"
}
Returns Examples
{
  "id": "id",
  "account_id": "account_id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "created_by": {
    "id": "id",
    "type": "user",
    "object": "identity"
  },
  "environment_config": "environment_config",
  "manifest_file": "manifest_file",
  "namespace": "namespace",
  "status": "status",
  "build_id": "build_id",
  "deploy_events": [
    {
      "message": "message",
      "reason": "reason",
      "timestamp": "2019-12-27T18:11:19.117Z",
      "type": "type"
    }
  ],
  "expires_at": "2019-12-27T18:11:19.117Z",
  "helm_release_name": "helm_release_name",
  "object": "agentex_cloud_deploy",
  "preview_label": "preview_label"
}