nat.utils.atif_converter#

Convert NAT IntermediateStep traces to the Agent Trajectory Interchange Format (ATIF).

ATIF is a standardized JSON format for logging the complete interaction history of autonomous LLM agents. Reference: laude-institute/harbor

This module provides: - Conversion helpers built on shared ATIF v1.6 models - IntermediateStepToATIFConverter for batch conversion - ATIFStreamConverter for incremental / streaming conversion

Classes#

IntermediateStepToATIFConverter

Convert a complete list of NAT IntermediateSteps to an ATIF trajectory.

ATIFStreamConverter

Stateful converter that emits ATIF steps incrementally.

Module Contents#

class IntermediateStepToATIFConverter#

Convert a complete list of NAT IntermediateSteps to an ATIF trajectory.

convert(
steps: list[nat.data_models.intermediate_step.IntermediateStep],
*,
session_id: str | None = None,
agent_name: str | None = None,
) nat.atif.ATIFTrajectory#

Convert a list of IntermediateSteps to an ATIF trajectory.

class ATIFStreamConverter(agent_name: str = 'nat-agent')#

Stateful converter that emits ATIF steps incrementally.

_step_id: int = 1#
_agent_config#
_tool_defs_captured = False#
_pending: _PendingAgentTurn | None = None#
_emitted_steps: list[nat.atif.ATIFStep] = []#
_total_prompt = 0#
_total_completion = 0#
_total_cached = 0#
property agent_config: nat.atif.ATIFAgentConfig#

Current agent configuration (populated as steps arrive).

push(
ist: nat.data_models.intermediate_step.IntermediateStep,
) nat.atif.ATIFStep | None#

Process one IntermediateStep and return a flushed ATIF step if available.

finalize() list[nat.atif.ATIFStep]#

Flush any pending agent turn and return remaining steps.

get_trajectory() nat.atif.ATIFTrajectory#

Build the complete ATIF trajectory from all emitted steps.

_flush_pending() nat.atif.ATIFStep | None#

Convert the pending turn into an ATIFStep and clear it.