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

# Obter AI Insight

> Retorna a análise completa da IA para um insight específico, incluindo todos os contextos de enriquecimento e ações sugeridas

<ParamField path="name" type="string" required>
  Nome único do AI insight (ex.: `insight-inc-20260319-001`)
</ParamField>

<ParamField query="namespace" type="string" default="default">
  Namespace Kubernetes
</ParamField>

## Campos da Resposta

| Campo                   | Descrição                                                      |
| ----------------------- | -------------------------------------------------------------- |
| `analysis`              | Texto de análise de causa raiz gerado pela IA                  |
| `confidence`            | Score de confiança de 0.0 a 1.0                                |
| `recommendations`       | Sugestões legíveis por humanos                                 |
| `suggestedActions`      | Ações concretas com tipo e parâmetros                          |
| `logAnalysis`           | Achados estruturados da análise de logs dos pods               |
| `metricsContext`        | Dados de métricas Prometheus correlacionados com o incidente   |
| `sourceCodeContext`     | Trechos relevantes do código-fonte do repositório da aplicação |
| `gitOpsContext`         | Status do Helm/ArgoCD/Flux no momento da análise               |
| `cascadeAnalysis`       | Análise de falha em cascata entre serviços                     |
| `blastRadiusPrediction` | Impacto previsto das ações de remediação sugeridas             |

<ResponseExample>
  ```json Response 200 theme={"system"}
  {
    "apiVersion": "v1",
    "kind": "AIInsight",
    "resourceMeta": {
      "name": "insight-inc-20260319-001",
      "namespace": "production",
      "creationTimestamp": "2026-03-19T14:31:00Z"
    },
    "spec": {
      "issueRef": "INC-20260319-001",
      "provider": "anthropic",
      "model": "claude-sonnet-4-20250514"
    },
    "status": {
      "analysis": "The payment-service deployment is experiencing OOMKill events due to a memory leak in the webhook handler...",
      "confidence": 0.91,
      "recommendations": [
        "Increase memory limit from 512Mi to 1Gi",
        "Restart pods to reclaim leaked memory",
        "Review webhook handler for unclosed response bodies"
      ],
      "suggestedActions": [
        {
          "name": "Increase memory limit",
          "action": "AdjustResources",
          "description": "Prevent further OOMKills",
          "params": {"memoryLimit": "1Gi"}
        }
      ],
      "logAnalysis": "1 Go panic stack trace; 12 critical patterns...",
      "metricsContext": "CPU: 0.45 cores (stable), Memory: 498Mi/512Mi (98% - critical), Restarts: 5 in last 30min",
      "gitOpsContext": "Helm release 'payment' revision=42 deployed 2h ago",
      "cascadeAnalysis": "payment-service(root) -> api-gateway(victim)",
      "blastRadiusPrediction": "Low risk: 3 pods, 1 service affected",
      "generatedAt": "2026-03-19T14:32:00Z"
    }
  }
  ```
</ResponseExample>

<ResponseExample>
  ```json Response 404 theme={"system"}
  {
    "apiVersion": "v1",
    "kind": "Error",
    "error": {
      "code": 404,
      "message": "AI insight not found: insight-inc-20260319-999"
    }
  }
  ```
</ResponseExample>


## OpenAPI

````yaml GET /aiinsights/{name}
openapi: 3.1.0
info:
  title: ChatCLI AIOps Platform API
  description: >-
    REST API for the ChatCLI AIOps Platform — incidents, SLOs, runbooks,
    approvals, postmortems, analytics, audit, federation and health.


    The playground below uses **editable server variables** so you can point
    requests at your own self-hosted instance. Adjust `host`, `port` and
    `basePath` to match your deployment, then click **Try it**.
  version: 1.0.0
  contact:
    name: ChatCLI
    url: https://github.com/diillson/chatcli
  license:
    name: Apache-2.0
    identifier: Apache-2.0
servers:
  - url: http://{host}:{port}/{basePath}
    description: >-
      Self-hosted ChatCLI AIOps Platform — adjust host, port and basePath to
      match your deployment.
    variables:
      host:
        default: localhost
        description: >-
          Hostname or IP of your ChatCLI operator. For Kubernetes, use the
          Service DNS (e.g. chatcli-api.chatcli-system.svc) or your Ingress
          host.
      port:
        default: '8090'
        description: >-
          Port the API listens on. Default is 8090; configurable via Helm value
          `apiPort` or env var CHATCLI_API_PORT.
      basePath:
        default: api/v1
        description: >-
          API base path. Always `api/v1` unless you have a custom proxy rewrite
          in front of the operator.
security:
  - ApiKeyAuth: []
tags:
  - name: Incidents
    description: >-
      Incident lifecycle: list, fetch, acknowledge, resolve, snooze, timeline
      and remediation views.
  - name: Runbooks
    description: Remediation runbooks (list, create, update, delete).
  - name: SLOs
    description: Service Level Objectives and error budgets.
  - name: Approvals
    description: Approval workflow for risky remediations.
  - name: Postmortems
    description: Auto-generated postmortems with review, feedback and close.
  - name: Remediations
    description: Remediation plans and agentic execution history.
  - name: AI Insights
    description: AI root-cause analysis and recommendations per incident.
  - name: Analytics
    description: 'Operational analytics: MTTD, MTTR, trends, capacity, compliance.'
  - name: Audit
    description: Immutable audit log and exports.
  - name: Federation
    description: 'Multi-cluster federation: clusters, status and cross-cluster correlations.'
  - name: Health
    description: Liveness and readiness probes.
paths:
  /aiinsights/{name}:
    get:
      tags:
        - AI Insights
      summary: Get AI Insight
      description: >-
        Returns the full AI analysis for a specific insight, including all
        enrichment contexts and suggested actions.
      operationId: getAIInsight
      parameters:
        - name: name
          in: path
          required: true
          description: Unique AI insight name.
          schema:
            type: string
            example: insight-inc-20260319-001
        - name: namespace
          in: query
          required: false
          description: Kubernetes namespace.
          schema:
            type: string
            default: default
      responses:
        '200':
          description: AI insight details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AIInsight'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    AIInsight:
      type: object
      properties:
        apiVersion:
          type: string
          example: v1
        kind:
          type: string
          example: AIInsight
        resourceMeta:
          type: object
          properties:
            name:
              type: string
            namespace:
              type: string
            creationTimestamp:
              type: string
              format: date-time
        spec:
          type: object
          properties:
            issueRef:
              type: string
            provider:
              type: string
            model:
              type: string
        status:
          type: object
          properties:
            analysis:
              type: string
            confidence:
              type: number
            recommendations:
              type: array
              items:
                type: string
            suggestedActions:
              type: array
              items:
                $ref: '#/components/schemas/AIInsightAction'
            logAnalysis:
              type: string
            metricsContext:
              type: string
            sourceCodeContext:
              type: string
            gitOpsContext:
              type: string
            cascadeAnalysis:
              type: string
            blastRadiusPrediction:
              type: string
            generatedAt:
              type: string
              format: date-time
    AIInsightAction:
      type: object
      properties:
        name:
          type: string
        action:
          type: string
        description:
          type: string
        params:
          type: object
          additionalProperties: true
    Error:
      type: object
      required:
        - apiVersion
        - kind
        - error
      properties:
        apiVersion:
          type: string
          example: v1
        kind:
          type: string
          example: Error
        error:
          oneOf:
            - type: object
              required:
                - code
                - message
              properties:
                code:
                  type: integer
                  example: 404
                message:
                  type: string
                  example: Resource not found
                details:
                  type: string
            - type: string
        code:
          type: integer
          description: Top-level code (only used by some endpoints).
          example: 400
  responses:
    Unauthorized:
      description: Missing or invalid API token
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: Rate limit exceeded for this token's role
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Bearer token issued by the operator. Format: `Authorization: Bearer
        <token>`.

````