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

# Harbor

> Ingest Harbor/ATIF trajectories into Docent

Harbor ([web](https://www.harborframework.com/), [GitHub](https://github.com/harbor-framework/harbor)) is a framework for evaluating and optimizing AI agents. ATIF ([docs](https://www.harborframework.com/docs/agents/trajectory-format)) is a trajectory format developed by Harbor. We offer helpers that import Harbor outputs and ATIF trajectories into Docent.

## Use this when

Use Harbor ingestion when your source data is either:

* a Harbor trial directory containing `agent/`, `verifier/`, `config.json`, and `result.json`
  (see [output structure](https://www.harborframework.com/docs/run-jobs/results-and-artifacts#output-structure))
* a raw ATIF trajectory JSON payload that you want to convert directly

## Main helpers

* `convert_atif_to_agent_run(atif)` converts one parsed ATIF payload into one Docent `AgentRun`.
* `convert_harbor_trial_to_agent_run(trial_dir, path_root=None)` converts one Harbor trial directory into one `AgentRun`.
* `convert_harbor_directory_to_agent_runs(root)` recursively discovers Harbor trials and converts each one.

All three helpers are available from `docent.sdk.integrations`.

```python theme={null}
from docent.sdk.integrations import (
    convert_atif_to_agent_run,
    convert_harbor_directory_to_agent_runs,
    convert_harbor_trial_to_agent_run,
)
```

## Example

To convert every Harbor trial under a root directory:

```python theme={null}
from docent.sdk.integrations import convert_harbor_directory_to_agent_runs

agent_runs = convert_harbor_directory_to_agent_runs("/path/to/harbor/root")
```

To convert a raw ATIF payload already loaded in memory:

```python theme={null}
import json

from docent.sdk.integrations import convert_atif_to_agent_run

with open("trajectory.json", "r", encoding="utf-8") as infile:
    atif = json.load(infile)

agent_run = convert_atif_to_agent_run(atif)
```

After conversion, upload normally:

```python theme={null}
from docent import Docent
from docent.sdk.integrations import convert_harbor_directory_to_agent_runs

client = Docent()
agent_runs = convert_harbor_directory_to_agent_runs("/path/to/harbor/root")
client.add_agent_runs(collection_id, agent_runs)
```

## More on the conversion process

Each Harbor trial or ATIF payload becomes one Docent `AgentRun`.

At a high level, the converter:

* turns the ATIF trajectory into a single Docent transcript
* preserves ATIF metadata under `agent_run.metadata["atif"]`
* preserves Harbor trial metadata under `agent_run.metadata["harbor"]`
* stores the raw `config.json` and `result.json` payloads in Harbor metadata when converting a Harbor trial

For Harbor trial directories specifically, Docent expects exactly one ATIF JSON file directly under `agent/`.

The converter is strict. If the source data uses unsupported ATIF features such as image content, continued trajectories, subagent references, malformed step sequences, or invalid Harbor trial structure, it raises `ConversionError` instead of trying to approximate the data.
