> ## 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.

# Delete Agent

> Delete an agent and reclaim its deployments and builds.

The agent record is deleted synchronously; its deployments (previews included) and builds
are then torn down asynchronously by a durable Temporal workflow. Returns the deleted agent.
Single-deployment removal already exists at `DELETE /v5/agentex/deployments/{deployment_id}`;
this is the agent-level teardown.



## OpenAPI

````yaml https://api.sgp.scale.com/openapi-versions/v5/openapi.json delete /v5/agentex/agents/{agent_id}
openapi: 3.1.0
info:
  title: EGP API V5
  description: >-
    This is the parent API for all EGP APIs. If you are looking for the EGP API,
    please go to https://api.egp.scale.com/docs.
  contact:
    name: Scale Generative AI Platform
    url: https://scale.com/genai-platform
  version: 0.1.0
servers:
  - url: https://api.egp.scale.com
security: []
paths:
  /v5/agentex/agents/{agent_id}:
    delete:
      tags:
        - Agentex Agent
      summary: Delete Agent
      description: >-
        Delete an agent and reclaim its deployments and builds.


        The agent record is deleted synchronously; its deployments (previews
        included) and builds

        are then torn down asynchronously by a durable Temporal workflow.
        Returns the deleted agent.

        Single-deployment removal already exists at `DELETE
        /v5/agentex/deployments/{deployment_id}`;

        this is the agent-level teardown.
      operationId: DELETE-V5-/agentex/agents/agent_id
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            type: string
            title: Agent Id
        - name: x-selected-account-id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Account ID Header
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentexDeleteAgentResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    AgentexDeleteAgentResponse:
      properties:
        object:
          type: string
          const: agentex_delete_agent
          title: Object
          default: agentex_delete_agent
        agent_id:
          type: string
          title: Agent Id
          description: The agent that was deleted.
        agent_name:
          type: string
          title: Agent Name
          description: Resolved agent name.
      type: object
      required:
        - agent_id
        - agent_name
      title: AgentexDeleteAgentResponse
      description: >-
        Response for ``DELETE /agentex/agents/{agent_id}``.


        The agent record is deleted synchronously (in-request, with the caller's
        credentials), so

        the request returns ``200`` once the agent is gone. Its deployments and
        builds are then

        reclaimed asynchronously by a durable Temporal workflow (the workflow id
        is logged

        server-side for traceability, not surfaced to the caller).
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          title: Error Type
          type: string
        input:
          title: Input
        ctx:
          type: object
          title: Context
          additionalProperties: true
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-api-key

````