> ## 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.

# Attach Agent Training Run

> Claim an unassigned training run without changing existing ownership.



## OpenAPI

````yaml /openapi.json post /api/v1/agents/{agent_id}/training-runs
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/agents/{agent_id}/training-runs:
    post:
      tags:
        - agents
      summary: Attach Agent Training Run
      description: Claim an unassigned training run without changing existing ownership.
      operationId: attachAgentTrainingRun
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            type: string
            title: Agent Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AttachAgentTrainingRunRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrainingRunResponse'
        '404':
          description: >-
            The requested resource does not exist or is not visible to the
            caller.
          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/ResourceNotFoundErrorResponse'
        '409':
          description: >-
            The operation conflicts with the current state or an idempotent
            request.
          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/ConflictErrorResponse'
        default:
          $ref: '#/components/responses/ApiErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    AttachAgentTrainingRunRequest:
      properties:
        training_run_id:
          type: string
          maxLength: 64
          minLength: 1
          title: Training Run Id
      additionalProperties: false
      type: object
      required:
        - training_run_id
      title: AttachAgentTrainingRunRequest
    TrainingRunResponse:
      properties:
        agent_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Id
          description: Persisted owner; null for unassigned legacy runs.
        parent_checkpoint_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Parent Checkpoint Id
        training_run_id:
          type: string
          title: Training Run Id
        pipeline_run_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Pipeline Run Id
        display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Name
          description: User-facing training run name; null for legacy rows.
        status:
          $ref: '#/components/schemas/TrainingRunLifecycleStatus'
        bench_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Bench Id
        base_model_slug:
          type: string
          title: Base Model Slug
        options:
          $ref: '#/components/schemas/RecordedRunOptions'
        created_by:
          type: string
          title: Created By
        created_at:
          type: string
          format: date-time
          title: Created At
        failure:
          anyOf:
            - $ref: '#/components/schemas/AsyncFailure'
            - type: 'null'
          description: Structured failure when status is failed.
        has_training_execution:
          type: boolean
          title: Has Training Execution
          description: Whether a training execution has been assigned.
          readOnly: true
      type: object
      required:
        - agent_id
        - training_run_id
        - pipeline_run_id
        - display_name
        - status
        - bench_id
        - base_model_slug
        - options
        - created_by
        - created_at
        - has_training_execution
      title: TrainingRunResponse
    ResourceNotFoundErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ResourceNotFoundErrorBody'
      type: object
      required:
        - error
      title: ResourceNotFoundErrorResponse
    ConflictErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ConflictErrorBody'
      type: object
      required:
        - error
      title: ConflictErrorResponse
    TrainingRunLifecycleStatus:
      type: string
      enum:
        - pending
        - running
        - cancel_signaled
        - cancelling
        - succeeded
        - failed
        - cancelled
      title: TrainingRunLifecycleStatus
    RecordedRunOptions:
      properties:
        load_weights_only:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Load Weights Only
        density_aware_training:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Density Aware Training
        algorithm:
          anyOf:
            - $ref: '#/components/schemas/TrainingAlgorithm'
            - type: 'null'
        train_on_truncation:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Train On Truncation
        train_on_error:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Train On Error
        train_on_timeout:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Train On Timeout
        val_enabled:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Val Enabled
        val_interval_steps:
          anyOf:
            - type: integer
            - type: 'null'
          title: Val Interval Steps
        val_num_tasks:
          anyOf:
            - type: integer
            - type: 'null'
          title: Val Num Tasks
        val_trajectories_per_task:
          anyOf:
            - type: integer
            - type: 'null'
          title: Val Trajectories Per Task
        val_max_concurrent_trajectories:
          anyOf:
            - type: integer
            - type: 'null'
          title: Val Max Concurrent Trajectories
        val_final_wait_timeout_seconds:
          anyOf:
            - type: number
            - type: 'null'
          title: Val Final Wait Timeout Seconds
        learning_rate:
          anyOf:
            - type: number
            - type: 'null'
          title: Learning Rate
        lr_warmup_steps:
          anyOf:
            - type: integer
            - type: 'null'
          title: Lr Warmup Steps
        lr_hold_steps:
          anyOf:
            - type: integer
            - type: 'null'
          title: Lr Hold Steps
        lr_min_ratio:
          anyOf:
            - type: number
            - type: 'null'
          title: Lr Min Ratio
        reasoning_effort:
          anyOf:
            - type: string
              enum:
                - 'off'
                - 'on'
                - minimal
                - low
                - medium
                - high
                - xhigh
                - max
            - type: 'null'
          title: Reasoning Effort
        temperature:
          anyOf:
            - type: number
            - type: 'null'
          title: Temperature
        top_p:
          anyOf:
            - type: number
            - type: 'null'
          title: Top P
        top_k:
          anyOf:
            - type: integer
            - type: 'null'
          title: Top K
        val_reasoning_effort:
          anyOf:
            - type: string
              enum:
                - 'off'
                - 'on'
                - minimal
                - low
                - medium
                - high
                - xhigh
                - max
            - type: 'null'
          title: Val Reasoning Effort
        val_temperature:
          anyOf:
            - type: number
            - type: 'null'
          title: Val Temperature
        val_top_p:
          anyOf:
            - type: number
            - type: 'null'
          title: Val Top P
        val_top_k:
          anyOf:
            - type: integer
            - type: 'null'
          title: Val Top K
        val_max_output_tokens_per_turn:
          anyOf:
            - type: integer
            - type: 'null'
          title: Val Max Output Tokens Per Turn
        val_max_output_tokens_per_trajectory:
          anyOf:
            - type: integer
            - type: 'null'
          title: Val Max Output Tokens Per Trajectory
        val_max_turns_per_trajectory:
          anyOf:
            - type: integer
            - type: 'null'
          title: Val Max Turns Per Trajectory
        val_trajectory_timeout_seconds:
          anyOf:
            - type: integer
            - type: 'null'
          title: Val Trajectory Timeout Seconds
        num_steps:
          anyOf:
            - type: integer
            - type: 'null'
          title: Num Steps
        batch_size:
          anyOf:
            - type: integer
            - type: 'null'
          title: Batch Size
        group_size:
          anyOf:
            - type: integer
            - type: 'null'
          title: Group Size
        min_trajectories_per_group:
          anyOf:
            - type: integer
            - type: 'null'
          title: Min Trajectories Per Group
        max_concurrent_trajectories:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Concurrent Trajectories
        max_staleness:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Staleness
        train_on_all_fail:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Train On All Fail
        train_on_all_pass:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Train On All Pass
        train_on_zero_advantage:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Train On Zero Advantage
        trajectory_timeout_seconds:
          anyOf:
            - type: integer
            - type: 'null'
          title: Trajectory Timeout Seconds
        batch_timeout_seconds:
          anyOf:
            - type: integer
            - type: 'null'
          title: Batch Timeout Seconds
        max_output_tokens_per_turn:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Output Tokens Per Turn
        max_output_tokens_per_trajectory:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Output Tokens Per Trajectory
        max_turns_per_trajectory:
          anyOf:
            - type: integer
            - type: 'null'
          title: Max Turns Per Trajectory
      additionalProperties: false
      type: object
      title: RecordedRunOptions
      description: Recorded settings retain values outside the public launch limits.
    AsyncFailure:
      properties:
        type:
          type: string
          title: Type
          description: Stable category used for exception mapping.
        code:
          type: string
          title: Code
          description: Stable programmatic reason for the asynchronous failure.
        message:
          type: string
          title: Message
          description: Human-readable explanation for this failure occurrence.
        context:
          additionalProperties: true
          type: object
          title: Context
          description: Machine-readable values specific to this failure code.
      type: object
      required:
        - type
        - code
        - message
      title: AsyncFailure
    ResourceNotFoundErrorBody:
      properties:
        type:
          type: string
          const: invalid_request_error
          title: Type
        code:
          type: string
          const: resource_not_found
          title: Code
        message:
          type: string
          title: Message
        param:
          anyOf:
            - type: string
            - type: 'null'
          title: Param
        doc_url:
          type: string
          title: Doc Url
        context:
          $ref: '#/components/schemas/EmptyErrorContext'
      type: object
      required:
        - type
        - code
        - message
        - doc_url
        - context
      title: ResourceNotFoundErrorBody
    ConflictErrorBody:
      properties:
        type:
          type: string
          const: conflict_error
          title: Type
        code:
          type: string
          const: conflict
          title: Code
        message:
          type: string
          title: Message
        param:
          anyOf:
            - type: string
            - type: 'null'
          title: Param
        doc_url:
          type: string
          title: Doc Url
        context:
          $ref: '#/components/schemas/EmptyErrorContext'
      type: object
      required:
        - type
        - code
        - message
        - doc_url
        - context
      title: ConflictErrorBody
    ApiErrorEnvelope:
      properties:
        error:
          $ref: '#/components/schemas/ApiErrorBody'
      required:
        - error
      title: ApiErrorEnvelope
      type: object
    TrainingAlgorithm:
      type: string
      enum:
        - gspo
        - grpo
      title: TrainingAlgorithm
    EmptyErrorContext:
      properties: {}
      additionalProperties: false
      type: object
      title: EmptyErrorContext
    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
    ErrorType:
      enum:
        - invalid_request_error
        - authentication_error
        - permission_error
        - conflict_error
        - billing_error
        - rate_limit_error
        - dependency_error
        - api_error
      title: ErrorType
      type: string
  headers:
    RequestId:
      schema:
        type: string
    TrajectoryShouldRetry:
      schema:
        type: boolean
    RetryAfter:
      schema:
        type: string
  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'
  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.