---
title: "Attach Production Trace"
method: POST
path: "/api/v1/agents/{agent_id}/traces"
tags: ["agents"]
---

# Attach Production Trace

`POST /api/v1/agents/{agent_id}/traces`

Attach an existing production trajectory owned by this organization to an agent. A trajectory can belong to one agent; reattaching to the same agent is idempotent. Trajectories recorded for training runs cannot be attached.

## Path parameters

- `agent_id` string, required

## Request body

- AttachAgentProductionTraceRequest
  - `trajectory_id` string, required

## Response `200`

Successful Response

- AgentProductionTrace
  - `agent_id` string, required
  - `trajectory` TrajectoryMetadata, required
    - `trajectory_id` string, required
    - `organization_id` string, required
    - `dataset_id` string, nullable
    - `dataset_name` string, nullable
    - `dataset_source` string, nullable
    - `dataset_gcs_prefix` string, nullable
    - `trace_id` string, nullable
    - `model_id` string, nullable
    - `model_association_source` string, nullable
    - `model_association_metadata` object, nullable
    - `source` string, required
    - `status` string, nullable
    - `reward` number, nullable
    - `num_steps` integer, nullable
    - `created_at` string, required
    - `training_run_id` string, nullable
    - `xid` string, nullable
    - `task_id` string, nullable
    - `policy_step` integer, nullable — Sampled policy step, not optimizer step.
    - `rollout` TrajectoryRolloutStatus
      - `rollout_id` string, required
      - `status` string, required — Recorded Rollout Service state, such as IN_PROGRESS or FAILED.
      - `termination_reason` string, nullable — Recorded rollout termination enum.
      - `harness_diagnostic` HarnessDiagnostic
        - `exception_chain` string[]
        - `locations` string[]
        - `category` 'timeout' | 'connection' | 'rate_limit' | 'authentication' | 'server' | 'other', required
        - `preceding_tracebacks` TracebackDiagnostic[]
          - `exception_chain` string[]
          - `locations` string[]
        - `exit_code` integer, nullable
  - `attached_at` string, required — Time the canonical trajectory was recorded.
  - `updated_at` string, required
  - `feedback_score` number, nullable
  - `feedback_text` string, nullable

## Changes

- **2026-09-28** `1efa21f7aeb8` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/trajectory/apis/trajectory-api/changes/api/v1/agents/:agent_id/traces/post.md)

---

[API](https://skmtc.dev/trajectory/apis/trajectory-api.md) · [All operations](https://skmtc.dev/trajectory/apis/trajectory-api/llms.txt) · [OpenAPI document](https://skmtc.dev/trajectory/apis/trajectory-api/revisions/8331f8435ce8?raw)
