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

# Agent Result Check

> Poll this endpoint to check the status of an Agent request and retrieve the results.



## OpenAPI

````yaml https://www.datalab.to/openapi.json get /api/v1/agent/{request_id}
openapi: 3.1.0
info:
  title: Datalab API
  version: 0.0.1
servers:
  - url: https://www.datalab.to
    description: Datalab API
security: []
paths:
  /api/v1/agent/{request_id}:
    get:
      summary: Agent Result Check
      description: >-
        Poll this endpoint to check the status of an Agent request and retrieve
        the results.
      operationId: result_response_api_v1_agent__request_id__get
      parameters:
        - name: request_id
          in: path
          required: true
          schema:
            type: string
            title: Request Id
        - name: wos-session
          in: cookie
          required: false
          schema:
            type: string
            title: Wos-Session
        - name: datalab_active_team
          in: cookie
          required: false
          schema:
            type: string
            title: Datalab Active Team
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentFinalResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    AgentFinalResponse:
      properties:
        status:
          type: string
          title: Status
          description: >-
            The status of the request. Should be 'complete' when the request is
            done.
        result_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Result Url
          description: >-
            Signed URL for downloading the completed result JSON when direct
            result download is required.
        expires_in:
          anyOf:
            - type: integer
            - type: 'null'
          title: Expires In
          description: Number of seconds until result_url expires.
        success:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Success
          description: Whether the agent run succeeded.
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: If the run was not successful, this will contain an error message.
        output_shape:
          anyOf:
            - type: string
            - type: 'null'
          title: Output Shape
          description: >-
            The output shape requested for this run: 'parse', 'json', 'wcag',
            'jats', or 'segment'.
        finished:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Finished
          description: Whether the agent finished its task before hitting max_turns.
        turns:
          anyOf:
            - type: integer
            - type: 'null'
          title: Turns
          description: The number of turns the agent took.
        markdown:
          anyOf:
            - type: string
            - type: 'null'
          title: Markdown
          description: The markdown output of the run, when applicable.
        html:
          anyOf:
            - type: string
            - type: 'null'
          title: Html
          description: The HTML output of the run, when applicable.
        json:
          anyOf:
            - additionalProperties: true
              type: object
            - type: string
            - type: 'null'
          title: Json
          description: The structured JSON output of the run, when applicable.
        chunks:
          anyOf:
            - additionalProperties: true
              type: object
            - type: string
            - type: 'null'
          title: Chunks
          description: The output in chunks format, when applicable.
        extraction_schema_json:
          anyOf:
            - additionalProperties: true
              type: object
            - type: string
            - type: 'null'
          title: Extraction Schema Json
          description: The filled-in extraction schema, when applicable.
        segments:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Segments
          description: >-
            Segment records for the 'segment' output shape (production /segment
            sense): {name, pages (0-indexed), confidence}.
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: A dictionary of metadata about the document and the run.
        verdict:
          anyOf:
            - type: string
            - type: 'null'
          title: Verdict
          description: >-
            The agent's final verdict for generic output shapes, when
            applicable.
        jats_xml:
          anyOf:
            - type: string
            - type: 'null'
          title: Jats Xml
          description: >-
            The JATS 1.2 Journal-Publishing article XML, for the 'jats' output
            shape.
        accessible_pdf:
          anyOf:
            - type: string
            - type: 'null'
          title: Accessible Pdf
          description: >-
            The tagged, accessible PDF (PDF/UA-1) as a base64 string, for the
            'wcag' output shape.
        images:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Images
          description: >-
            Images produced by the run as base64 strings, keyed by the name the
            output references them by. Only populated when return_images was set
            on the request.
        verifier_metrics:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Verifier Metrics
          description: Verification results emitted as metrics (not a gate).
        page_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Page Count
          description: The number of pages that were processed.
        total_cost:
          anyOf:
            - type: integer
            - type: 'null'
          title: Total Cost
          description: The total cost of the run.
          deprecated: true
        cost_breakdown:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Cost Breakdown
          description: A dictionary of the cost breakdown of this request.
        parse_quality_score:
          anyOf:
            - type: number
            - type: 'null'
          title: Parse Quality Score
          description: The parse quality score of the output, if available.
        runtime:
          anyOf:
            - type: number
            - type: 'null'
          title: Runtime
          description: The runtime of the run.
        versions:
          anyOf:
            - additionalProperties: true
              type: object
            - type: string
            - type: 'null'
          title: Versions
          description: A dictionary of the versions of the libraries used in the request.
      type: object
      required:
        - status
      title: AgentFinalResponse
      description: Response model for the /agent endpoint.
    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
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key

````