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

# Infer Round

> Classify an assistant turn and, when it is an inference, persist it.

Mirrors ``ingest_round`` for auth, quota, ownership, and RLS. The
assistant turn's provenance is decided by the pure classifier
``classify_turn_provenance`` (no LLM):

- AI_INFERRED: the assistant turn directly answers a prior user factual
  question. A single MemoryRecord is written through the writer chokepoint
  with ``provenance=AI_INFERRED`` (record_type FACTUAL, role assistant).
  ``records_written=1`` and the new uid is returned. The SIP builder marks
  AI_INFERRED ``inference_only`` on the read side, so it is never presented
  as established fact.

- AI_GENERATED: no qualifying prior user question. AI_GENERATED has NO live
  write path until PR-3, so nothing is written here. The response carries
  ``records_written=0`` and ``provenance=AI_GENERATED``; no record is
  created.

# IDOR AUDIT PASS - session_id and user_id are attributed to the
# authenticated principal, never the request body.



## OpenAPI

````yaml post /api/v1/memory/infer
openapi: 3.1.0
info:
  title: EDN Memory Engine
  version: 0.1.0
servers:
  - description: EDN evaluation endpoint
    url: https://api.tensorpro.ai
security:
  - EDNApiKey: []
paths:
  /api/v1/memory/infer:
    post:
      summary: Infer Round
      description: >-
        Classify an assistant turn and, when it is an inference, persist it.


        Mirrors ``ingest_round`` for auth, quota, ownership, and RLS. The

        assistant turn's provenance is decided by the pure classifier

        ``classify_turn_provenance`` (no LLM):


        - AI_INFERRED: the assistant turn directly answers a prior user factual
          question. A single MemoryRecord is written through the writer chokepoint
          with ``provenance=AI_INFERRED`` (record_type FACTUAL, role assistant).
          ``records_written=1`` and the new uid is returned. The SIP builder marks
          AI_INFERRED ``inference_only`` on the read side, so it is never presented
          as established fact.

        - AI_GENERATED: no qualifying prior user question. AI_GENERATED has NO
        live
          write path until PR-3, so nothing is written here. The response carries
          ``records_written=0`` and ``provenance=AI_GENERATED``; no record is
          created.

        # IDOR AUDIT PASS - session_id and user_id are attributed to the

        # authenticated principal, never the request body.
      operationId: infer_round_api_v1_memory_infer_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InferRoundRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InferResponse'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
components:
  schemas:
    InferRoundRequest:
      properties:
        assistant_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Assistant Message
        session_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Session Id
        user_message:
          anyOf:
            - type: string
            - type: 'null'
          title: User Message
      title: InferRoundRequest
      type: object
    InferResponse:
      properties:
        provenance:
          title: Provenance
          type: string
        record_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Record Id
        records_written:
          title: Records Written
          type: integer
        status:
          title: Status
          type: string
      required:
        - status
        - records_written
        - provenance
      title: InferResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    EDNApiKey:
      description: >-
        EDN API key presented as 'Bearer <key>' in the Authorization header.
        Create and manage keys from the Console.
      in: header
      name: Authorization
      type: apiKey

````