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

# Run AutoRAG agent over all data

> Uses the AutoRAG agent to answer a question about any data that the user can access.



## OpenAPI

````yaml /api-reference/openapi.yml post /query/autorag
openapi: 3.0.3
info:
  title: DataLinks
  version: 2.22.1
servers:
  - url: https://api.datalinks.com/api/v1
    description: production server
security:
  - bearerAuth: []
  - openId:
      - implicit
paths:
  /query/autorag:
    post:
      tags:
        - autorag
      summary: Run AutoRAG agent over all data
      description: >-
        Uses the AutoRAG agent to answer a question about any data that the user
        can access.
      operationId: autorag
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AutoRagRequest'
        required: true
      responses:
        '200':
          $ref: '#/components/responses/AutoRagResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    AutoRagRequest:
      required:
        - namespace
        - query
        - username
      type: object
      properties:
        username:
          type: string
        namespace:
          type: string
        query:
          type: string
          example: What do llamas drink to cool themselves down?
        helperPrompt:
          type: string
          example: You're a prophet of the alpacalypse. Your task is to spit the word!
        model:
          type: string
        provider:
          type: string
        models:
          $ref: '#/components/schemas/AutoRagStageModels'
        conversationId:
          type: string
          description: >-
            Existing conversation to continue. Omit to start a new conversation;
            the id is returned on the run-started SSE event.
        webSearch:
          type: boolean
          description: >-
            Override web search for this request: false disables it; omit (or
            true) to use the deployment default.
        callerContext:
          $ref: '#/components/schemas/CallerContext'
    AutoRagStageModels:
      type: object
      properties:
        plan:
          $ref: '#/components/schemas/AutoRagStageModel'
        query:
          $ref: '#/components/schemas/AutoRagStageModel'
        answer:
          $ref: '#/components/schemas/AutoRagStageModel'
      description: Per-stage model overrides for the AutoRag pipeline.
    CallerContext:
      type: object
      properties:
        turns:
          type: array
          description: Prior exchange in the calling system, oldest first.
          items:
            $ref: '#/components/schemas/CallerContextTurn'
        facts:
          type: array
          description: >-
            Values the calling system asserts. Where a label repeats, the later
            entry supersedes the earlier one.
          items:
            $ref: '#/components/schemas/CallerContextFact'
      description: >-
        Context established outside this platform — typically by an agent the
        calling system ran before this one. It is rendered into the planning and
        answering prompts as caller-asserted background: it never overrides data
        retrieved from the datasets, and it never widens data access. Applies to
        the turn it is sent with.
    AutoRagResponseData:
      required:
        - response
        - steps
      type: object
      properties:
        response:
          type: string
          description: Final response generated for the user's question.
        steps:
          type: array
          description: List of steps executed during the AutoRAG process.
          items:
            required:
              - data
              - instruction
              - query
              - reasoning
            type: object
            properties:
              instruction:
                type: string
                description: The instruction generated and executed for this step.
              query:
                type: string
                description: The query derived from the instruction.
              reasoning:
                type: string
                description: >-
                  The reasoning produced by the LLM when generating the query
                  for this step.
              data:
                $ref: '#/components/schemas/DataArray'
    ErrorResponse:
      required:
        - error_code
        - message
      type: object
      properties:
        error_code:
          type: string
          example: UNAUTHORIZED
        error_message:
          type: string
          example: ''
        message:
          type: string
          example: Missing authentication token
        sub_errors:
          type: array
          items:
            required:
              - code
              - message
            type: object
            properties:
              code:
                type: string
              message:
                type: string
    AutoRagStageModel:
      type: object
      properties:
        model:
          type: string
        provider:
          type: string
      description: >-
        Model selection for a single agent stage, applied as a (model, provider)
        pair. Precedence is resolved per stage — this override, then the
        run-wide model/provider, then the configured stage default — and the
        highest-precedence level that sets either field wins as a whole: its
        unset field is not merged from a lower level but resolves to the
        provider default (default provider, then that provider's default model).
        So sending only the run-wide model with no provider routes every stage
        to the default provider.
    CallerContextTurn:
      required:
        - role
        - text
      type: object
      properties:
        role:
          type: string
          enum:
            - user
            - agent
        text:
          type: string
        agentName:
          type: string
          description: >-
            Which upstream agent produced this turn. Shown to the model in place
            of the bare role.
    CallerContextFact:
      required:
        - label
        - value
      type: object
      properties:
        label:
          type: string
          example: tenant
        value:
          type: string
          example: acme
        source:
          type: string
          description: Which upstream agent asserted this fact.
    DataArray:
      type: array
      description: Array of ontology data objects retrieved from queries.
      items:
        type: object
        additionalProperties: true
  responses:
    AutoRagResponse:
      description: >-
        Response containing step-by-step RAG execution results and the final
        answer.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AutoRagResponseData'
    Unauthorized:
      description: >-
        Unauthorized. This error occurs if the authentication token is missing
        or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      description: >
        Use a Bearer token for authentication. Submit the token using the
        `Authorization`

        header: `Authorization: Bearer <token>`.
      scheme: bearer
    openId:
      type: oauth2
      flows:
        implicit:
          authorizationUrl: >-
            https://login.datalinks.com/realms/datalinks-realm/protocol/openid-connect/auth
          scopes:
            openid: openid

````