Skip to main content
Harbor can generate high-quality rollouts in ATIF (Agent Trajectory Interchange Format) for reinforcement learning optimization of AI agents. This guide shows you how to collect trajectories and use them for RL training.

Overview

RL optimization with Harbor involves:
  1. Trajectory collection: Running agents on tasks and recording interactions
  2. ATIF export: Converting trajectories to standardized format
  3. Reward shaping: Using task verifiers to provide learning signals
  4. Training: Using trajectories to fine-tune agent models
Harbor focuses on trajectory generation. You’ll need an RL training framework (e.g., PPO, DPO) to train models.

ATIF Format

The Agent Trajectory Interchange Format (ATIF) is Harbor’s standard for representing agent interactions:

Collecting Trajectories

Agent Support

Only agents with ATIF support can generate trajectories:
To enable ATIF for custom agents, set SUPPORTS_ATIF = True in your agent class and populate the trajectory field in AgentContext.

Running Data Collection

1

Choose an ATIF-compatible agent

2

Run evaluation

This generates trajectories for all successful and failed attempts.
3

Export trajectories

Creates a JSONL file with one trajectory per line.

Filtering Trajectories

Export only successful trajectories:
Export trajectories by difficulty:

Using Trajectories for RL

Data Preparation

Load and preprocess trajectories:

Reward Shaping

Use partial rewards for better learning signals:

Training with PPO

Example using a hypothetical PPO trainer:

Advanced Techniques

Multi-Task Training

Collect diverse trajectories:

Curriculum Learning

Start with easy tasks, progress to harder:

Behavior Cloning

Learn from expert demonstrations:

Evaluation

Validate improved agent:
Generate comparison report:

Best Practices

  1. Collect diverse data: Use multiple benchmarks and task types
  2. Balance dataset: Include successful and failed trajectories
  3. Validate continuously: Test on held-out tasks
  4. Start simple: Begin with behavior cloning before RL
  5. Monitor overfitting: Track validation performance
  6. Use partial rewards: Better learning signals than binary
  7. Version control: Track model checkpoints and data

Limitations

Current limitations:
  • Only Terminus agents support ATIF natively
  • Trajectory size can be large (100KB+ per task)
  • RL training requires significant compute
  • Agent improvements may not generalize to new domains

Next Steps

Custom Agents

Add ATIF support to your agent

Parameter Sweeps

Optimize hyperparameters

Agent Context

Learn about AgentContext

Verifiers

Design better reward functions