nat.atif#
Pydantic models for Agent Trajectory Interchange Format (ATIF).
Models are derived from the Harbor reference implementation (harbor-framework/harbor) and follow the ATIF RFC (0001-trajectory-format). NAT-specific relaxations are documented inline in the individual model files.
Backward-compatible aliases (ATIFStep, ATIFTrajectory, and so on)
are provided so existing code can continue to work without import changes.
Submodules#
Attributes#
Classes#
Agent system identification and configuration. |
|
Validated ancestry metadata embedded in ATIF |
|
Invocation timing metadata embedded in ATIF |
|
Validated structure for NAT-owned ATIF |
|
A single content part within a multimodal message. |
|
Image source specification for images stored as files or at remote URLs. |
|
Aggregate statistics for the entire trajectory. |
|
LLM operational and confidence data for a single step. |
|
Environment feedback/result after actions or system events. |
|
A single result within an observation. |
|
A single step in an ATIF trajectory. |
|
Reference to a delegated subagent trajectory. |
|
A tool call within a step. |
|
ATIF trajectory — the complete interaction history of an agent run. |
Package Contents#
- class Agent(/, **data: Any)#
Bases:
pydantic.BaseModelAgent system identification and configuration.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- class AtifAncestry(/, **data: Any)#
Bases:
pydantic.BaseModelValidated ancestry metadata embedded in ATIF
Step.extra.Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- class AtifInvocationInfo(/, **data: Any)#
Bases:
pydantic.BaseModelInvocation timing metadata embedded in ATIF
Step.extra.Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- validate_timestamp_pairing() AtifInvocationInfo#
- class AtifStepExtra(/, **data: Any)#
Bases:
pydantic.BaseModelValidated structure for NAT-owned ATIF
Step.extrapayload.Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- ancestry: AtifAncestry = None#
- invocation: AtifInvocationInfo | None = None#
- tool_ancestry: list[AtifAncestry] = None#
- tool_invocations: list[AtifInvocationInfo] | None = None#
- class ContentPart(/, **data: Any)#
Bases:
pydantic.BaseModelA single content part within a multimodal message.
Used when a message or observation contains mixed content types (text and images). For text-only content, a plain string can still be used instead of a ContentPart array.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- type: Literal['text', 'image'] = None#
- source: ImageSource | None = None#
- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- validate_content_type() ContentPart#
Validate that the correct fields are present for each content type.
- class ImageSource(/, **data: Any)#
Bases:
pydantic.BaseModelImage source specification for images stored as files or at remote URLs.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- media_type: Literal['image/jpeg', 'image/png', 'image/gif', 'image/webp'] = None#
- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- class FinalMetrics(/, **data: Any)#
Bases:
pydantic.BaseModelAggregate statistics for the entire trajectory.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- class Metrics(/, **data: Any)#
Bases:
pydantic.BaseModelLLM operational and confidence data for a single step.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- class Observation(/, **data: Any)#
Bases:
pydantic.BaseModelEnvironment feedback/result after actions or system events.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- results: list[nat.atif.observation_result.ObservationResult] = None#
- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- class ObservationResult(/, **data: Any)#
Bases:
pydantic.BaseModelA single result within an observation.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- content: str | list[nat.atif.content.ContentPart] | None = None#
- subagent_trajectory_ref: list[nat.atif.subagent_trajectory_ref.SubagentTrajectoryRef] | None = None#
- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- class Step(/, **data: Any)#
Bases:
pydantic.BaseModelA single step in an ATIF trajectory.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- source: Literal['system', 'user', 'agent'] = None#
- message: str | list[nat.atif.content.ContentPart] = None#
- tool_calls: list[nat.atif.tool_call.ToolCall] | None = None#
- observation: nat.atif.observation.Observation | None = None#
- metrics: nat.atif.metrics.Metrics | None = None#
- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- class SubagentTrajectoryRef(/, **data: Any)#
Bases:
pydantic.BaseModelReference to a delegated subagent trajectory.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- class ToolCall(/, **data: Any)#
Bases:
pydantic.BaseModelA tool call within a step.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- ATIF_VERSION = 'ATIF-v1.6'#
- class Trajectory(/, **data: Any)#
Bases:
pydantic.BaseModelATIF trajectory — the complete interaction history of an agent run.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- schema_version: Literal['ATIF-v1.0', 'ATIF-v1.1', 'ATIF-v1.2', 'ATIF-v1.3', 'ATIF-v1.4', 'ATIF-v1.5', 'ATIF-v1.6'] = None#
- agent: nat.atif.agent.Agent = None#
- steps: list[nat.atif.step.Step] = None#
- final_metrics: nat.atif.final_metrics.FinalMetrics | None = None#
- model_config#
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- to_json_dict(exclude_none: bool = True) dict[str, Any]#
Export trajectory to a dictionary suitable for JSON serialization.
- validate_step_ids() Trajectory#
Validate that step_ids are sequential starting from 1.
- validate_tool_call_references() Trajectory#
Validate that observation source_call_ids reference valid tool_call_ids.
- ATIFAgentConfig#
- ATIFContentPart#
- ATIFImageSource#
- ATIFFinalMetrics#
- ATIFStepMetrics#
- ATIFObservation#
- ATIFObservationResult#
- ATIFStep#
- ATIFSubagentTrajectoryRef#
- ATIFToolCall#
- ATIFTrajectory#