> ## Documentation Index
> Fetch the complete documentation index at: https://blaxel-preview-openai-agents-api-tutorial.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete agent

> Permanently deletes an agent and all its deployment history. The agent's inference endpoint will immediately stop responding. This action cannot be undone.



## OpenAPI

````yaml /api-reference/controlplane.yml delete /agents/{agentName}
openapi: 3.0.3
info:
  title: Blaxel Control Plane
  version: 0.0.1
servers:
  - description: Blaxel Control Plane
    url: https://api.blaxel.ai/v0
  - description: Blaxel Inference
    url: https://run.blaxel.ai
security:
  - OAuth2:
      - admin
  - ApiKeyAuth: []
paths:
  /agents/{agentName}:
    parameters:
      - description: Unique name identifier of the agent
        in: path
        name: agentName
        required: true
        schema:
          type: string
    delete:
      tags:
        - agents
      summary: Delete agent
      description: >-
        Permanently deletes an agent and all its deployment history. The agent's
        inference endpoint will immediately stop responding. This action cannot
        be undone.
      operationId: DeleteAgent
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Agent'
          description: successful operation
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Unauthorized - Invalid or missing authentication credentials
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Forbidden - Insufficient permissions to delete this agent
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Not found - Agent does not exist
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: Internal server error
      security:
        - OAuth2:
            - agents:delete
        - ApiKeyAuth: []
components:
  schemas:
    Agent:
      type: object
      description: >-
        Serverless AI agent deployment that runs your custom agent code as an
        auto-scaling API endpoint. Agents are deployed from your code repository
        and expose a global inference URL for querying.
      properties:
        events:
          $ref: '#/components/schemas/CoreEvents'
        metadata:
          $ref: '#/components/schemas/Metadata'
        spec:
          $ref: '#/components/schemas/AgentSpec'
        status:
          $ref: '#/components/schemas/Status'
      required:
        - metadata
        - spec
    Error:
      type: object
      description: Standard error response returned by the API when a request fails
      properties:
        code:
          type: integer
          description: HTTP status code of the error
          example: 409
        error:
          type: string
          description: Error type or code identifying the kind of error
          example: Resource already exists
        message:
          type: string
          description: Human-readable error message describing what went wrong
          example: Invalid request body
      required:
        - error
    CoreEvents:
      type: array
      description: Events happening on a resource deployed on Blaxel
      items:
        $ref: '#/components/schemas/CoreEvent'
      readOnly: true
    Metadata:
      type: object
      description: >-
        Common metadata fields shared by all Blaxel resources including name,
        labels, timestamps, and ownership information
      allOf:
        - $ref: '#/components/schemas/TimeFields'
        - $ref: '#/components/schemas/OwnerFields'
        - properties:
            displayName:
              type: string
              description: >-
                Human-readable name for display in the UI. Can contain spaces
                and special characters, max 63 characters.
              example: My Resource
            externalId:
              type: string
              description: >-
                Caller-owned identifier for external lookups. Max 64 chars,
                alphanumeric + dash.
              example: my-session-123
            labels:
              $ref: '#/components/schemas/MetadataLabels'
            name:
              type: string
              description: >-
                Unique identifier for the resource within the workspace. Must be
                lowercase alphanumeric with hyphens, max 49 characters.
                Immutable after creation.
              example: my-resource
            plan:
              type: string
              description: >-
                Billing plan tier applied to this resource (inherited from
                workspace account)
              readOnly: true
            url:
              type: string
              description: >-
                Auto-generated endpoint URL for accessing this resource (for
                agents, functions, models, sandboxes)
              readOnly: true
            workspace:
              type: string
              description: >-
                Name of the workspace this resource belongs to (read-only, set
                automatically)
              readOnly: true
          required:
            - name
    AgentSpec:
      type: object
      description: >-
        Configuration for an AI agent including runtime settings, repository
        source, and deployment triggers
      properties:
        enabled:
          type: boolean
          description: >-
            When false, the agent is disabled and will not serve inference
            requests
          example: true
          default: true
        policies:
          $ref: '#/components/schemas/PoliciesList'
        public:
          type: boolean
          description: >-
            When true, the agent is publicly accessible without authentication.
            Only available for mk3 generation.
          example: false
          default: false
        region:
          type: string
          description: >-
            Region where the agent should be deployed (e.g. us-pdx-1, eu-lon-1).
            Required when volumes are attached.
          example: us-pdx-1
        repository:
          $ref: '#/components/schemas/Repository'
        revision:
          $ref: '#/components/schemas/RevisionConfiguration'
        runtime:
          $ref: '#/components/schemas/AgentRuntime'
        triggers:
          $ref: '#/components/schemas/Triggers'
        volumes:
          $ref: '#/components/schemas/VolumeAttachments'
    Status:
      type: string
      description: Deployment status of a resource deployed on Blaxel
      enum:
        - DELETING
        - TERMINATED
        - FAILED
        - DEACTIVATED
        - DEACTIVATING
        - UPLOADING
        - BUILDING
        - DEPLOYING
        - DEPLOYED
        - BUILT
      readOnly: true
    CoreEvent:
      type: object
      description: Core event
      properties:
        canaryRevision:
          type: string
          description: Canary revisionID link to the event
        message:
          type: string
          description: Event message
          example: Deployment successful
        revision:
          type: string
          description: RevisionID link to the event
          example: rev-abc123
        status:
          type: string
          description: Event status
          example: DEPLOYED
        time:
          type: string
          description: Event time
          example: '2025-01-15T10:30:00Z'
        type:
          type: string
          description: Event type
          example: deployment
      readOnly: true
    TimeFields:
      type: object
      description: Time fields for Persistence
      properties:
        createdAt:
          type: string
          description: The date and time when the resource was created
          readOnly: true
        updatedAt:
          type: string
          description: The date and time when the resource was updated
          readOnly: true
    OwnerFields:
      type: object
      description: Owner fields for Persistence
      properties:
        createdBy:
          type: string
          description: The user or service account who created the resource
          readOnly: true
        updatedBy:
          type: string
          description: The user or service account who updated the resource
          readOnly: true
    MetadataLabels:
      type: object
      description: >-
        Key-value pairs for organizing and filtering resources. Labels can be
        used to categorize resources by environment, project, team, or any
        custom taxonomy.
      additionalProperties:
        type: string
    PoliciesList:
      type: array
      items:
        type: string
        description: Policy name
    Repository:
      type: object
      description: Repository
      properties:
        type:
          type: string
          description: Repository type
          example: github
        url:
          type: string
          description: Repository URL
          example: https://github.com/my-org/my-agent
    RevisionConfiguration:
      type: object
      description: Revision configuration
      properties:
        active:
          type: string
          description: Active revision id
          example: rev-abc123
        canary:
          type: string
          description: Canary revision id
        canaryPercent:
          type: integer
          description: Canary revision percent
          example: 10
        stickySessionTtl:
          type: integer
          description: Sticky session TTL in seconds (0 = disabled)
          example: 0
        traffic:
          type: integer
          description: Traffic percentage
          example: 100
    AgentRuntime:
      type: object
      description: >-
        Runtime configuration defining how the AI agent is deployed and scaled
        globally
      properties:
        envs:
          type: array
          description: >-
            Environment variables injected into the agent. Supports Kubernetes
            EnvVar format with valueFrom references.
          items:
            $ref: '#/components/schemas/Env'
        generation:
          type: string
          description: >-
            Infrastructure generation: mk2 (containers, 2-10s cold starts, 15+
            global regions) or mk3 (microVMs, sub-25ms cold starts)
          enum:
            - mk2
            - mk3
          example: mk3
        image:
          type: string
          description: >-
            Container image built by Blaxel when deploying with 'bl deploy'.
            This field is auto-populated during deployment.
        maxScale:
          type: integer
          description: >-
            Maximum number of concurrent agent instances for auto-scaling under
            load
          example: 10
        memory:
          type: integer
          description: >-
            Memory allocation in megabytes. Also determines CPU allocation (CPU
            cores = memory in MB / 2048, e.g., 4096MB = 2 CPUs).
          example: 2048
        minScale:
          type: integer
          description: >-
            Minimum instances to keep warm. Set to 1+ to eliminate cold starts,
            0 for scale-to-zero.
          example: 0
    Triggers:
      type: array
      description: Triggers to use your agent
      items:
        $ref: '#/components/schemas/Trigger'
    VolumeAttachments:
      type: array
      items:
        $ref: '#/components/schemas/VolumeAttachment'
    Env:
      type: object
      description: Environment variable with name and value
      properties:
        name:
          type: string
          description: Name of the environment variable
          example: MY_ENV_VAR
        secret:
          type: boolean
          description: Whether the value is a secret
          example: true
        value:
          type: string
          description: Value of the environment variable
          example: my-value
    Trigger:
      type: object
      description: Trigger configuration
      properties:
        configuration:
          $ref: '#/components/schemas/TriggerConfiguration'
        enabled:
          type: boolean
          description: 'Enable or disable the trigger (default: true)'
          example: true
        id:
          type: string
          description: >-
            Identifier of the trigger. Optional — the server auto-generates a
            unique id when one is not provided, and disambiguates duplicates
            within a resource.
          example: trigger-1
        type:
          type: string
          description: The type of trigger, can be http or http-async
          enum:
            - http
            - http-async
            - cron
          example: http
    VolumeAttachment:
      type: object
      description: >-
        Configuration for attaching a volume to a sandbox at a specific
        filesystem path. Defaults to a persistent volume; set type to
        "ephemeral" for disk-backed scratch space created with the sandbox and
        destroyed when it stops.
      properties:
        mountPath:
          type: string
          description: >-
            Absolute filesystem path where the volume will be mounted inside the
            sandbox
          example: /mnt/data
        name:
          type: string
          description: >-
            For persistent volumes, the name of the volume resource to attach
            (must exist in the same workspace and region). For ephemeral
            volumes, an identifier used to reference the volume internally.
          example: my-volume
        readOnly:
          type: boolean
          description: >-
            If true, the volume is mounted read-only and cannot be modified by
            the sandbox
          example: false
        sizeMb:
          type: integer
          description: >-
            Storage capacity in megabytes. Required for ephemeral volumes,
            ignored for persistent volumes.
          example: 102400
        type:
          type: string
          description: >-
            Type of volume. Defaults to "persistent" (an existing volume
            resource). Use "ephemeral" for temporary disk-backed storage created
            with the sandbox.
          enum:
            - persistent
            - ephemeral
          example: persistent
    TriggerConfiguration:
      type: object
      description: Trigger configuration
      properties:
        authenticationType:
          type: string
          description: The authentication type of the trigger
          example: blaxel
        callbackSecret:
          type: string
          description: The callback secret for async triggers (auto-generated, encrypted)
          readOnly: true
        callbackUrl:
          type: string
          description: The callback URL for async triggers (optional)
          example: https://myapp.com/webhook
        path:
          type: string
          description: The path of the trigger
          example: /invoke
        retry:
          type: integer
          description: The retry of the trigger
          example: 3
        schedule:
          type: string
          description: The schedule of the trigger, cron expression * * * * *
          example: 0 * * * *
        tasks:
          type: array
          description: The tasks configuration of the cronjob
          items:
            $ref: '#/components/schemas/TriggerConfigurationTask'
        timeout:
          type: integer
          description: The timeout in seconds for async triggers (max 900s, MK3 only)
          example: 300
    TriggerConfigurationTask:
      type: object
      description: The tasks configuration of the cronjob
  securitySchemes:
    OAuth2:
      description: OAuth2 authentication with JWT tokens
      flows:
        authorizationCode:
          authorizationUrl: /oauth/authorize
          scopes:
            admin: Administrative access
            agents:create: Create agents
            agents:delete: Delete agents
            agents:get: Get agent details
            agents:list: List agents
            agents:update: Update agents
            apiKey:list: List API keys
            apiKey:write: Create and delete API keys
            applications:create: Create applications
            applications:delete: Delete applications
            applications:get: Get application details
            applications:list: List applications
            applications:update: Update applications
            configurations:list: List configurations
            customdomains:create: Create custom domains
            customdomains:delete: Delete custom domains
            customdomains:get: Get custom domain details
            customdomains:list: List custom domains
            customdomains:update: Update custom domains
            functions:create: Create functions
            functions:delete: Delete functions
            functions:get: Get function details
            functions:list: List functions
            functions:update: Update functions
            integrations:create: Create integrations
            integrations:list: List integrations
            invitations:list: List invitations
            jobs:create: Create jobs
            jobs:delete: Delete jobs
            jobs:get: Get job details
            jobs:list: List jobs
            jobs:update: Update jobs
            locations:list: List locations
            mcphub:list: List MCP hub resources
            models:create: Create models
            models:delete: Delete models
            models:get: Get model details
            models:list: List models
            models:update: Update models
            policies:create: Create policies
            policies:delete: Delete policies
            policies:get: Get policy details
            policies:list: List policies
            policies:update: Update policies
            sandboxes:control: Control sandbox operations
            sandboxes:create: Create sandboxes
            sandboxes:delete: Delete sandboxes
            sandboxes:get: Get sandbox details
            sandboxes:list: List sandboxes
            sandboxes:update: Update sandboxes
            sandboxhub:list: List sandbox hub resources
            templates:get: Get template details
            templates:list: List templates
            volumeTemplates:create: Create volume templates
            volumeTemplates:delete: Delete volume templates
            volumeTemplates:get: Get volume template details
            volumeTemplates:list: List volume templates
            volumeTemplates:upsert: Create or update volume templates
            volumes:create: Create volumes
            volumes:delete: Delete volumes
            volumes:get: Get volume details
            volumes:list: List volumes
            workspaces:accept: Accept workspace invitation
            workspaces:create: Create workspaces
            workspaces:decline: Decline workspace invitation
            workspaces:delete: Delete workspaces
            workspaces:get: Get workspace details
            workspaces:invite: Invite users to workspace
            workspaces:leave: Leave workspace
            workspaces:list: List workspaces
            workspaces:remove: Remove users from workspace
            workspaces:update: Update workspaces
          tokenUrl: /oauth/token
        clientCredentials:
          scopes:
            admin: Administrative access
            agents:create: Create agents
            agents:delete: Delete agents
            agents:get: Get agent details
            agents:list: List agents
            agents:update: Update agents
            apiKey:list: List API keys
            apiKey:write: Create and delete API keys
            applications:create: Create applications
            applications:delete: Delete applications
            applications:get: Get application details
            applications:list: List applications
            applications:update: Update applications
            configurations:list: List configurations
            customdomains:create: Create custom domains
            customdomains:delete: Delete custom domains
            customdomains:get: Get custom domain details
            customdomains:list: List custom domains
            customdomains:update: Update custom domains
            functions:create: Create functions
            functions:delete: Delete functions
            functions:get: Get function details
            functions:list: List functions
            functions:update: Update functions
            integrations:create: Create integrations
            integrations:list: List integrations
            invitations:list: List invitations
            jobs:create: Create jobs
            jobs:delete: Delete jobs
            jobs:get: Get job details
            jobs:list: List jobs
            jobs:update: Update jobs
            locations:list: List locations
            mcphub:list: List MCP hub resources
            models:create: Create models
            models:delete: Delete models
            models:get: Get model details
            models:list: List models
            models:update: Update models
            policies:create: Create policies
            policies:delete: Delete policies
            policies:get: Get policy details
            policies:list: List policies
            policies:update: Update policies
            sandboxes:control: Control sandbox operations
            sandboxes:create: Create sandboxes
            sandboxes:delete: Delete sandboxes
            sandboxes:get: Get sandbox details
            sandboxes:list: List sandboxes
            sandboxes:update: Update sandboxes
            sandboxhub:list: List sandbox hub resources
            templates:get: Get template details
            templates:list: List templates
            volumeTemplates:create: Create volume templates
            volumeTemplates:delete: Delete volume templates
            volumeTemplates:get: Get volume template details
            volumeTemplates:list: List volume templates
            volumeTemplates:upsert: Create or update volume templates
            volumes:create: Create volumes
            volumes:delete: Delete volumes
            volumes:get: Get volume details
            volumes:list: List volumes
            workspaces:accept: Accept workspace invitation
            workspaces:create: Create workspaces
            workspaces:decline: Decline workspace invitation
            workspaces:delete: Delete workspaces
            workspaces:get: Get workspace details
            workspaces:invite: Invite users to workspace
            workspaces:leave: Leave workspace
            workspaces:list: List workspaces
            workspaces:remove: Remove users from workspace
            workspaces:update: Update workspaces
          tokenUrl: /oauth/token
      type: oauth2
    ApiKeyAuth:
      bearerFormat: API Key
      description: Long-lived API key for programmatic access
      scheme: bearer
      type: http

````