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

# Ingest Task For Diagnostics

> Register one task as a private benchmark and return its ingestion result. Call buildBenchmarkImages, poll every page of listBenchmarkImages until each image is ready, then call startTaskDiagnostics with the returned bench_id.



## OpenAPI

````yaml /openapi.json post /api/v1/diagnostics/task/ingest
openapi: 3.1.0
info:
  title: Trajectory API
  version: 0.1.0
  x-trajectory-api-version: '2026-10-14'
  description: >-
    This contract is API version 2026-10-14. The optional Trajectory-API-Version
    header pins it, and tmp-contract is accepted as an alias. Requests without
    the header get this version. Version 2026-10-07 and the pre-launch legacy
    response formats are retired.
servers:
  - url: https://api.trajectory.ai
security: []
tags:
  - name: agents
    x-group: Agents
  - name: benchmarks
    x-group: Specs (benchmarks)
  - name: diagnostics
    x-group: Diagnostics
  - name: benchmark-ingestion
    x-group: Spec (benchmark) submissions
  - name: eval
    x-group: Evaluations
  - name: training
    x-group: Training
  - name: deployments
    x-group: Deployments
  - name: model-endpoints
    x-group: Model endpoints
  - name: inference
    x-group: Inference
  - name: trajectories
    x-group: Trajectories
  - name: artifacts
    x-group: Artifacts
  - name: telemetry
    x-group: Telemetry
  - name: supported-models
    x-group: Supported models
  - name: organizations
    x-group: Organizations
  - name: secrets
    x-group: Secrets
paths:
  /api/v1/diagnostics/task/ingest:
    post:
      tags:
        - diagnostics
      summary: Ingest Task For Diagnostics
      description: >-
        Register one task as a private benchmark and return its ingestion
        result. Call buildBenchmarkImages, poll every page of
        listBenchmarkImages until each image is ready, then call
        startTaskDiagnostics with the returned bench_id.
      operationId: ingestTaskForDiagnostics
      parameters:
        - name: agent_id
          in: query
          required: true
          schema:
            type: string
            maxLength: 64
            pattern: ^agt_[a-z0-9]+$
            title: Agent Id
        - name: bench_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                pattern: ^bm_[a-z0-9]+$
              - type: 'null'
            title: Bench Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskSpec'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IngestBenchmarkResponse'
        default:
          $ref: '#/components/responses/ApiErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    TaskSpec:
      properties:
        name:
          type: string
          title: Name
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        split:
          anyOf:
            - $ref: '#/components/schemas/TaskSplit'
            - type: 'null'
        input_messages:
          items:
            $ref: '#/components/schemas/BenchmarkMessage'
          type: array
          title: Input Messages
          description: >-
            Messages stored on the task. For SDK evaluation and training, your
            agent script must pass messages to the model; this field does not do
            that automatically.
        reference_trajectory_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Reference Trajectory Id
        image:
          type: 'null'
          title: Image
        runtime:
          anyOf:
            - $ref: '#/components/schemas/RuntimeSpec'
            - type: 'null'
        run_command:
          type: string
          title: Run Command
          description: >-
            For SDK evaluation and training, the command to run your agent in
            the sandbox, e.g. `python /app/agent.py`; include the executable,
            not only its arguments. Your script must call the model, run any
            tools, log a reward, and finalize the trajectory before exiting.
        env_vars:
          additionalProperties:
            anyOf:
              - type: string
              - $ref: '#/components/schemas/SecretRef'
          type: object
          title: Env Vars
          description: >-
            Keys must match [A-Za-z_][A-Za-z0-9_]* and cannot start with
            TRAJECTORY_ or use MODEL_ENDPOINT_ID, MODEL_ENDPOINT_ACCESS_TOKEN,
            or MODEL_ENDPOINT_URL.
        env_resources:
          $ref: '#/components/schemas/EnvResources'
        spec:
          additionalProperties: true
          type: object
          title: Spec
        task_spec_uri:
          anyOf:
            - type: string
            - type: 'null'
          title: Task Spec Uri
        tags:
          items:
            type: string
          type: array
          title: Tags
          description: >-
            Up to 20 distinct, non-empty task tags of at most 64 characters
            each.
      additionalProperties: false
      type: object
      required:
        - name
        - run_command
      title: TaskSpec
    IngestBenchmarkResponse:
      properties:
        bench_id:
          type: string
          title: Bench Id
        name:
          type: string
          title: Name
        task_count:
          type: integer
          title: Task Count
        failed_tasks:
          items:
            $ref: '#/components/schemas/BenchmarkTaskWriteFailure'
          type: array
          title: Failed Tasks
        warnings:
          items:
            type: string
          type: array
          title: Warnings
          description: Provider resource adjustments made before ingestion.
      type: object
      required:
        - bench_id
        - name
        - task_count
      title: IngestBenchmarkResponse
    TaskSplit:
      type: string
      enum:
        - train
        - test
      title: TaskSplit
    BenchmarkMessage:
      properties:
        role:
          type: string
          title: Role
        content:
          anyOf:
            - type: string
            - type: 'null'
          title: Content
        tool_calls:
          items:
            $ref: '#/components/schemas/ToolCall'
          type: array
          title: Tool Calls
        tool_response:
          anyOf:
            - $ref: '#/components/schemas/ToolResponse'
            - type: 'null'
        tool_definitions:
          items:
            $ref: '#/components/schemas/ToolDefinition'
          type: array
          title: Tool Definitions
        usage:
          anyOf:
            - $ref: '#/components/schemas/MessageUsage'
            - type: 'null'
        finish_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Finish Reason
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
        reasoning:
          anyOf:
            - type: string
            - type: 'null'
          title: Reasoning
        reasoning_details:
          title: Reasoning Details
        tokens:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          title: Tokens
        token_masks:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          title: Token Masks
        logprobs:
          anyOf:
            - items:
                type: number
              type: array
            - type: 'null'
          title: Logprobs
        trainable_status:
          type: string
          enum:
            - trainable
            - not_trainable
            - superseded
            - summarization_boundary
          title: Trainable Status
          default: not_trainable
      additionalProperties: false
      type: object
      required:
        - role
      title: BenchmarkMessage
    RuntimeSpec:
      properties:
        runtime_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Runtime Id
        source:
          anyOf:
            - $ref: '#/components/schemas/ImageSpec'
            - type: 'null'
      additionalProperties: false
      type: object
      title: RuntimeSpec
    SecretRef:
      properties:
        secret_ref:
          type: string
          title: Secret Ref
          description: >-
            Organization secret name. The containing env_vars key names the
            runtime variable.
      additionalProperties: false
      type: object
      required:
        - secret_ref
      title: SecretRef
    EnvResources:
      properties:
        docker_engine:
          type: boolean
          title: Docker Engine
          description: >-
            Require a Docker-capable sandbox. The user image must provide Docker
            and the harness; the harness owns nested containers and grading.
          default: false
        cpus:
          anyOf:
            - type: number
            - type: 'null'
          title: Cpus
        memory_mb:
          anyOf:
            - type: integer
            - type: 'null'
          title: Memory Mb
        gpus:
          type: integer
          title: Gpus
          default: 0
        network_mode:
          $ref: '#/components/schemas/NetworkMode'
          default: no-network
        allowed_hosts:
          items:
            type: string
          type: array
          title: Allowed Hosts
        agent_user:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent User
        env:
          additionalProperties:
            type: string
          type: object
          title: Env
        setup_commands:
          items:
            items:
              type: string
            type: array
          type: array
          title: Setup Commands
        mcp_servers:
          items:
            $ref: '#/components/schemas/McpServerSpec'
          type: array
          title: Mcp Servers
        allow_internet:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Allow Internet
      additionalProperties: false
      type: object
      title: EnvResources
    BenchmarkTaskWriteFailure:
      properties:
        task_id:
          type: string
          title: Task Id
        label:
          anyOf:
            - type: string
            - type: 'null'
          title: Label
        error:
          type: string
          title: Error
      type: object
      required:
        - task_id
        - error
      title: BenchmarkTaskWriteFailure
      description: >-
        A task that did not land; its siblings did, so the bench is short
        exactly these.
    ApiErrorEnvelope:
      properties:
        error:
          $ref: '#/components/schemas/ApiErrorBody'
      required:
        - error
      title: ApiErrorEnvelope
      type: object
    ToolCall:
      properties:
        name:
          type: string
          title: Name
        arguments:
          additionalProperties: true
          type: object
          title: Arguments
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
        raw_string:
          anyOf:
            - type: string
            - type: 'null'
          title: Raw String
        argument_encoding:
          type: string
          enum:
            - json
            - xml
          title: Argument Encoding
          default: json
        is_parsed_successfully:
          type: boolean
          title: Is Parsed Successfully
          default: true
        parser_error_msg:
          anyOf:
            - type: string
            - type: 'null'
          title: Parser Error Msg
      additionalProperties: false
      type: object
      required:
        - name
        - arguments
      title: ToolCall
    ToolResponse:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        arguments:
          additionalProperties: true
          type: object
          title: Arguments
        response:
          title: Response
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
        raw_name_args:
          anyOf:
            - type: string
            - type: 'null'
          title: Raw Name Args
        metadata:
          anyOf:
            - $ref: '#/components/schemas/ToolResponseMetadata'
            - type: 'null'
        duration_seconds:
          anyOf:
            - type: number
            - type: 'null'
          title: Duration Seconds
        is_env_done:
          type: boolean
          title: Is Env Done
          default: false
      additionalProperties: false
      type: object
      required:
        - id
        - name
        - arguments
      title: ToolResponse
    ToolDefinition:
      properties:
        name:
          type: string
          title: Name
        description:
          type: string
          title: Description
        parameters:
          additionalProperties: true
          type: object
          title: Parameters
      additionalProperties: false
      type: object
      required:
        - name
        - description
        - parameters
      title: ToolDefinition
    MessageUsage:
      properties:
        prompt_tokens:
          type: integer
          title: Prompt Tokens
          default: 0
        completion_tokens:
          type: integer
          title: Completion Tokens
          default: 0
        total_tokens:
          type: integer
          title: Total Tokens
          default: 0
      additionalProperties: false
      type: object
      title: MessageUsage
    ImageSpec:
      properties:
        dockerfile_path:
          anyOf:
            - type: string
            - type: 'null'
          title: Dockerfile Path
        image_ref:
          anyOf:
            - type: string
            - type: 'null'
          title: Image Ref
      additionalProperties: false
      type: object
      title: ImageSpec
    NetworkMode:
      type: string
      enum:
        - no-network
        - public
        - allowlist
      title: NetworkMode
    McpServerSpec:
      properties:
        name:
          type: string
          title: Name
        transport:
          type: string
          enum:
            - sse
            - streamable-http
            - stdio
          title: Transport
          default: sse
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
        command:
          anyOf:
            - type: string
            - type: 'null'
          title: Command
        args:
          items:
            type: string
          type: array
          title: Args
      additionalProperties: false
      type: object
      required:
        - name
      title: McpServerSpec
    ApiErrorBody:
      properties:
        type:
          $ref: '#/components/schemas/ErrorType'
        code:
          type: string
          title: Code
        message:
          type: string
          title: Message
        param:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Param
        doc_url:
          type: string
          title: Doc Url
        context:
          additionalProperties: true
          title: Context
          type: object
      required:
        - type
        - code
        - message
        - doc_url
        - context
      title: ApiErrorBody
      type: object
    ToolResponseMetadata:
      properties:
        generated_tool_info:
          anyOf:
            - $ref: '#/components/schemas/GeneratedToolInfo'
            - type: 'null'
      additionalProperties: false
      type: object
      title: ToolResponseMetadata
    ErrorType:
      enum:
        - invalid_request_error
        - authentication_error
        - permission_error
        - conflict_error
        - billing_error
        - rate_limit_error
        - dependency_error
        - api_error
      title: ErrorType
      type: string
    GeneratedToolInfo:
      properties:
        provider:
          type: string
          title: Provider
        model:
          type: string
          title: Model
        messages:
          items:
            $ref: '#/components/schemas/BenchmarkMessage'
          type: array
          title: Messages
      additionalProperties: false
      type: object
      required:
        - provider
        - model
        - messages
      title: GeneratedToolInfo
  responses:
    ApiErrorResponse:
      description: >-
        Common API error. Possible codes: `authentication_required`,
        `permission_denied`, `validation_error`, `rate_limited`,
        `internal_error`, `service_unavailable`.
      headers:
        X-Request-ID:
          $ref: '#/components/headers/RequestId'
        Trajectory-Should-Retry:
          $ref: '#/components/headers/TrajectoryShouldRetry'
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorEnvelope'
  headers:
    RequestId:
      schema:
        type: string
    TrajectoryShouldRetry:
      schema:
        type: boolean
    RetryAfter:
      schema:
        type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Organization API key

````

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