Trajectory data structure and how to add data to trajectory evaluation datasets
A trajectory is structured, time-series data generated by an AI Agent during task execution. It fully records the agent's thinking, actions, and observations across multi-turn interactions, starting from the user instruction. Trajectory evaluation assesses the reliability of the agent's execution process—for example, whether steps are logically coherent and whether irrelevant or redundant steps exist—complementing evaluation of the final output alone.
Trajectory data is in JSON format. Its core fields include:
Trajectory data example (excerpt):
When creating an evaluation dataset, select Trajectory as the scenario. The default table schema is generated automatically:
You can continue editing the column settings on top of the default schema. For detailed steps, see Create and Manage Datasets.
On the dataset details page, click Add Data > Add Single Record, then fill in the fields in the dialog:
On the dataset details page, click Add Data > Batch Import:
Traces in Application Observability can be exported directly as trajectory evaluation data: select multiple Traces in the Trace list, configure the mapping between Trace fields and evaluation dataset fields, and import them into the dataset. See "Add to Evaluation Set" in Application Observability.
What is a trajectory
Trajectory data is in JSON format. Its core fields include:
| Field | Description |
|---|---|
| schema_version | Trajectory schema version |
| session_id | Session ID |
| trajectory_id | Trajectory ID |
| agent | Information about the agent that executed the trajectory (name, version, etc.) |
| steps | List of steps. Each step records the source (user or agent), message, timestamp, and execution details (Span ID, duration, token consumption, etc.) |
| extra | Trajectory-level execution details: Span ID, Span kind, status, duration, semantic profile (semantic_profile), and input/output details. agent, steps, and final_metrics each have their own extra that carries additional information |
| final_metrics | Aggregated metrics, including total steps, token consumption, tool call count, and first-token latency |
When adding a single trajectory record, click Trajectory Sample to insert a complete sample trajectory as a reference template for manual entry.
Creating a trajectory evaluation dataset
When creating an evaluation dataset, select Trajectory as the scenario. The default table schema is generated automatically:
| Column | Data type | Required | Description |
|---|---|---|---|
| input | String | Yes | User input |
| reference_output | String | No | Reference output |
| trajectory | Trajectory | Yes | Agent execution trajectory |
Adding trajectory data
Adding a single record
On the dataset details page, click Add Data > Add Single Record, then fill in the fields in the dialog:
- input (String, required): user input, up to 10,000 characters.
- reference_output (String, optional): reference output, up to 10,000 characters.
- trajectory (Trajectory, required): agent execution trajectory.
- Trajectory Sample: Insert a sample trajectory JSON. If trajectory content already exists, inserting the sample overwrites the current content and requires confirmation in a dialog.
- Import by Trace ID: Enter a Trace ID to import the trajectory data of that Trace. Make sure the Trace is currently valid.
- Preview: Render the current trajectory data as a Trace view, showing the call chain, inputs and outputs, status, duration, and token consumption.
Batch import
On the dataset details page, click Add Data > Batch Import:
- Upload a local file. Supported formats: .xls, .xlsx, and .csv. Maximum file size: 20 MB.
- Select the import mode: Append Data (keeps existing data and appends new data to the end) or Full Overwrite (clears existing data before writing).
- Configure column mapping: map the data columns in the file to the dataset columns, and verify that the field types match.
If some records fail during import, download the log from the import result to check the failure reasons.