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

# Trigger analysis of an agent's conversations

> Analyzes conversations of an agent against its evaluation criteria.

- **`batch`** (default): the request is queued and each conversation
  is marked `pending`. Follow progress with
  `GET /v1/insights/status`.
- **`realtime`**: each conversation in `conversation_ids` is analyzed
  synchronously, and the response reports how many succeeded. Without
  `conversation_ids`, the request runs in batch mode.

Returns 404 when Agent Factory cannot return the agent to the caller
(unknown agent or no access to it).

Requires `ai-insights-v2:conversations` (`write`). Rate limit: 10
requests per minute.




## OpenAPI

````yaml /api-reference/ai-insights-v2/swagger.yml post /v1/agents/{agent_id}/analyze
openapi: 3.0.3
info:
  version: 1.0.0
  title: AI Insights API
  description: |
    Public REST API for the Prisme.ai AI Insights workspace - analyzed
    conversations, analysis triggering and status, evaluation criteria,
    message feedback, organization analytics, LLM consumption, memory
    analytics, and the agent relationship graph.

    **Organization scope.** Every endpoint reads and writes the data of the
    caller's organization, taken from the session (or from the org API key).
    No parameter lets a caller target another organization.

    **Permissions.** Each endpoint checks an organization IAM permission
    `ai-insights-v2:<resource>` with the action `read` or `write`
    (`manage` grants both). The resources are `conversations`, `feedback`,
    `analytics`, and `queue`; each operation states the one it requires.
    Platform admins and workspace admins are always allowed.

    **Rate limits.** Limits are counted per caller (user, or org API key)
    and per endpoint, over a sliding window. Depending on the endpoint, an
    exceeded limit returns one of two 429 bodies; both are documented on
    each operation.
  contact:
    name: Prisme.ai
    url: https://prisme.ai
servers:
  - url: https://{host}/v2/workspaces/slug:ai-insights-v2/webhooks
    description: Prisme.ai workspace webhooks
    variables:
      host:
        default: api.studio.prisme.ai
        description: API host (override for self-hosted or sandbox)
security:
  - BearerAuth: []
  - OrgApiKeyAuth: []
tags:
  - name: Insights
    description: Per-conversation analysis results and analysis status.
  - name: Agents
    description: >-
      Analysis triggering, evaluation criteria, conversations, and users of one
      agent.
  - name: Feedback
    description: Like / dislike feedback on agent messages.
  - name: Analytics
    description: Organization-wide usage, quality, latency, and adoption metrics.
  - name: Consumption
    description: LLM requests, tokens, cost, and carbon footprint, per user and over time.
  - name: Queue
    description: State of the conversation analysis queue.
  - name: Memories
    description: Analytics built from the memories users accumulate with agents.
  - name: Graph
    description: >-
      Agent relationship graph - tools, categories, delegations, similarity, and
      clusters.
paths:
  /v1/agents/{agent_id}/analyze:
    post:
      tags:
        - Agents
      summary: Trigger analysis of an agent's conversations
      description: |
        Analyzes conversations of an agent against its evaluation criteria.

        - **`batch`** (default): the request is queued and each conversation
          is marked `pending`. Follow progress with
          `GET /v1/insights/status`.
        - **`realtime`**: each conversation in `conversation_ids` is analyzed
          synchronously, and the response reports how many succeeded. Without
          `conversation_ids`, the request runs in batch mode.

        Returns 404 when Agent Factory cannot return the agent to the caller
        (unknown agent or no access to it).

        Requires `ai-insights-v2:conversations` (`write`). Rate limit: 10
        requests per minute.
      operationId: analyzeAgentConversations
      parameters:
        - $ref: '#/components/parameters/AgentId'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnalyzeInput'
            examples:
              batch:
                summary: Queue two conversations
                value:
                  conversation_ids:
                    - conv_123
                    - conv_456
              realtime:
                summary: Analyze now, re-running existing analyses
                value:
                  mode: realtime
                  conversation_ids:
                    - conv_123
                  force: true
      responses:
        '200':
          description: Analysis queued (batch) or completed (realtime).
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/AnalyzeQueuedResponse'
                  - $ref: '#/components/schemas/AnalyzeCompletedResponse'
        '400':
          $ref: '#/components/responses/InvalidArguments'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: Agent not found, or not accessible to the caller.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Agent not found or access denied
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  parameters:
    AgentId:
      in: path
      name: agent_id
      required: true
      schema:
        type: string
        maxLength: 64
        pattern: ^[a-zA-Z0-9_-]+$
      description: Agent ID (as returned by the Agent Creator API).
  schemas:
    AnalyzeInput:
      type: object
      properties:
        mode:
          type: string
          enum:
            - batch
            - realtime
          default: batch
          maxLength: 16
        conversation_ids:
          type: array
          items:
            type: string
          description: Conversations to analyze. Required for `realtime`.
        model:
          type: string
          maxLength: 64
          description: LLM used for the analysis. Defaults to the agent's model.
        force:
          type: boolean
          description: >-
            Realtime only - re-analyze conversations that already have an
            insight.
    AnalyzeQueuedResponse:
      type: object
      properties:
        status:
          type: string
          enum:
            - queued
        queue_id:
          type: string
          example: aq_8f2c1e
        mode:
          type: string
          enum:
            - batch
        message:
          type: string
          example: Analysis queued for processing
    AnalyzeCompletedResponse:
      type: object
      properties:
        status:
          type: string
          enum:
            - completed
        analyzed_count:
          type: integer
          description: Number of conversations analyzed successfully.
        mode:
          type: string
          enum:
            - realtime
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: >-
            Error code (e.g. `FORBIDDEN`), or error message on some validation
            errors.
        message:
          type: string
          description: Human-readable message.
    RuntimeError:
      type: object
      description: Error raised by the Prisme.ai runtime before the endpoint logic runs.
      required:
        - error
        - message
      properties:
        error:
          type: string
        message:
          type: string
        details:
          type: object
          additionalProperties: true
  responses:
    InvalidArguments:
      description: >-
        A parameter does not match its schema (length, pattern, type, or
        required field).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RuntimeError'
          example:
            error: InvalidArgumentsError
            message: Invalid arguments
            details:
              errors: []
    Unauthenticated:
      description: Missing or invalid credentials, or no organization context.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: UNAUTHORIZED
            message: Authentication required
    Forbidden:
      description: The caller lacks the permission required by the endpoint.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: FORBIDDEN
            message: 'Access denied: missing permission ''ai-insights-v2:analytics:read'''
    TooManyRequests:
      description: >-
        Rate limit exceeded. Retry after the number of seconds given in the
        `Retry-After` header.
      headers:
        Retry-After:
          schema:
            type: integer
          description: Seconds to wait before retrying.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RuntimeError'
          example:
            error: TooManyRequests
            message: Too many requests for 'Insights'
            details:
              name: Insights
              ok: false
              retryAfter: 42.5
              limit: 100
              window: 60
              remaining: 0
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: |
        User-bound credential carrying an identity: either a session JWT
        or a user access token (`at:*`) generated from the user settings UI.
        Send as `Authorization: Bearer <token>`. The organization and the
        permissions applied are those of this user.
    OrgApiKeyAuth:
      type: apiKey
      in: header
      name: x-prismeai-api-key
      description: |
        Organization API key (`iak_{orgSlug}_{uuid}`), managed from the
        AI Governance UI. It is not tied to a user: its access is defined by
        the permissions attached to it, and all keys of an organization share
        the same rate-limit counters. Endpoints that describe "your own"
        data, such as `GET /v1/users/{user_id}`, need a user credential.
        Send as `x-prismeai-api-key: iak_...`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.