> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dados.rio/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete Last System Prompt

> Deleta apenas o último system prompt do histórico e reativa o anterior.

Este endpoint é útil quando você quer desfazer a última atualização de prompt
sem perder todo o histórico.

Args:
    agent_type: Tipo do agente
    db: Sessão do banco de dados

Returns:
    SystemPromptDeleteResponse: Resposta contendo o resultado da operação
    
Raises:
    HTTPException 400: Se não houver prompts suficientes para deletar
    HTTPException 500: Se houver erro durante a operação



## OpenAPI

````yaml https://services.staging.app.dados.rio/eai-agent/openapi.json delete /api/v1/system-prompt/last
openapi: 3.1.0
info:
  title: Agentic Search API
  description: >-
    API que gerencia os fluxos e ferramentas dos agentes de IA da Prefeitura do
    Rio de Janeiro
  version: 0.1.0
servers:
  - url: https://services.staging.app.dados.rio/eai-agent
    description: Staging
security: []
paths:
  /api/v1/system-prompt/last:
    delete:
      tags:
        - System Prompt
      summary: Delete Last System Prompt
      description: >-
        Deleta apenas o último system prompt do histórico e reativa o anterior.


        Este endpoint é útil quando você quer desfazer a última atualização de
        prompt

        sem perder todo o histórico.


        Args:
            agent_type: Tipo do agente
            db: Sessão do banco de dados

        Returns:
            SystemPromptDeleteResponse: Resposta contendo o resultado da operação
            
        Raises:
            HTTPException 400: Se não houver prompts suficientes para deletar
            HTTPException 500: Se houver erro durante a operação
      operationId: delete_last_system_prompt_api_v1_system_prompt_last_delete
      parameters:
        - name: agent_type
          in: query
          required: false
          schema:
            type: string
            title: Agent Type
            description: Tipo do agente
            default: agentic_search
          description: Tipo do agente
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SystemPromptDeleteResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    SystemPromptDeleteResponse:
      properties:
        success:
          type: boolean
          title: Success
          description: Status geral da operação
        agent_type:
          type: string
          title: Agent Type
          description: Tipo de agente
        deleted_version:
          anyOf:
            - type: integer
            - type: 'null'
          title: Deleted Version
          description: Versão do prompt que foi deletado
        active_version:
          anyOf:
            - type: integer
            - type: 'null'
          title: Active Version
          description: Versão do prompt que ficou ativo
        previous_prompt_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Previous Prompt Id
          description: ID do prompt que foi reativado
        message:
          type: string
          title: Message
          description: Mensagem adicional sobre a operação
          default: ''
      type: object
      required:
        - success
        - agent_type
      title: SystemPromptDeleteResponse
      description: Schema para resposta da deleção do último system prompt.
      example:
        active_version: 4
        agent_type: agentic_search
        deleted_version: 5
        message: Última versão do system prompt deletada com sucesso.
        previous_prompt_id: f47ac10b-58cc-4372-a567-0e02b2c3d479
        success: true
    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:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````