Skip to main content

Crate av_atif

Crate av_atif 

Source
Expand description

ATIF — Agent Trajectory Interchange Format (Harbor), version 1.7.

Verified against the published specification at harborframework.com/docs/agents/trajectory-format (2026-08-10):

  • root Trajectory with schema_version, optional run-scoped session_id (relaxed in v1.7), trajectory_id + subagent_trajectories (v1.7), agent, ordered steps, final_metrics, extra (v1.1);
  • Step.step_id sequential from 1; source ∈ {system, user, agent}; agent-only fields (reasoning_content, reasoning_effort, model_name, tool_calls, metrics) rejected on non-agent steps; observation allowed on agent steps and, since v1.2, system steps; llm_call_count (v1.7) allowed on any step;
  • Metrics carries prompt_tokens / completion_tokens / cached_tokens / cost_usd (+ logprobs, completion_token_ids v1.3, prompt_token_ids v1.4) — the cached-token preservation that makes an exported trajectory a replayable KV-cache checkpoint (brief Module H);
  • validator collects errors in one pass (Harbor philosophy), not just the first — capped at MAX_VALIDATION_ISSUES with a truncation notice.

Reader accepts every published version v1.0–v1.7 with per-version field gating; the writer always emits v1.7 (inbound tolerant, outbound strict).

Re-exports§

pub use model::Agent;
pub use model::FinalMetrics;
pub use model::Metrics;
pub use model::Observation;
pub use model::ObservationResult;
pub use model::ReasoningEffort;
pub use model::Source;
pub use model::Step;
pub use model::SubagentTrajectoryRef;
pub use model::ToolCall;
pub use model::Trajectory;
pub use model::ATIF_VERSION;
pub use model::SUPPORTED_VERSIONS;
pub use validate::validate_bytes;
pub use validate::validate_trajectory;
pub use validate::validate_value;
pub use validate::Mode;
pub use validate::ValidationIssue;
pub use writer::write_atomic;
pub use writer::TrajectoryBuilder;

Modules§

model
ATIF data model (serde), matching Harbor’s published Pydantic models.
validate
ATIF validator, mirroring Harbor’s trajectory-validator semantics: validates required fields, types and constraints, sequential step ids (starting from 1), tool-call references in observations, ISO-8601 timestamps, agent-only field placement — and collects errors as it goes (not just the first), up to MAX_VALIDATION_ISSUES, after which a truncation notice is appended.
writer
Trajectory construction and crash-safe persistence.