nat.atif.atif_step_extra#
Typed models for NAT-owned ancestry / invocation metadata embedded in
ATIF extra dicts.
The ATIF v1.7 spec does not define a typed ancestry model — producers
embed ancestry-shaped data inside the optional extra field on
records where it is meaningful. NAT’s convention places:
step-level ancestry at
Step.extra["ancestry"](AtifAncestryshape)per-tool-call ancestry at
ToolCall.extra["ancestry"](AtifAncestryshape)step-level invocation timing at
Step.extra["invocation"](AtifInvocationInfoshape)per-tool-call invocation timing at
ToolCall.extra["invocation"](AtifInvocationInfoshape)
These models are validated representations of those payloads — producers
MAY round-trip them through model_dump() before placing them in
extra; consumers MAY parse them back with model_validate() to
revalidate the shape. Direct dict use is also supported. The spec
treats extra as a loosely-typed dict, so consumers MUST tolerate
absence and missing keys.
Classes#
Validated ancestry metadata embedded in ATIF |
|
Invocation timing metadata embedded in ATIF |
|
Validated structure for NAT-owned ATIF |
|
Validated structure for NAT-owned ATIF |
Module Contents#
- class AtifAncestry(/, **data: Any)#
Bases:
pydantic.BaseModelValidated ancestry metadata embedded in ATIF
extradicts.Used in two locations under the NAT convention:
Step.extra["ancestry"]— step-level: which callable produced this step (e.g. an LLM node under a parent agent).ToolCall.extra["ancestry"]— per-tool-call: which callable issued this tool invocation.
The model enforces a parent-pair invariant:
parent_nameMAY only be set whenparent_idis also set. The inverse —parent_idset,parent_nameunset — is allowed (the converter emits this when a parent’s UUID isn’t in the local name map).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_parent_pair() Self#
- class AtifInvocationInfo(/, **data: Any)#
Bases:
pydantic.BaseModelInvocation timing metadata embedded in ATIF
extradicts.Used at
Step.extra["invocation"]for step-level timing and atToolCall.extra["invocation"]for per-tool timing.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() Self#
- class AtifStepExtra(/, **data: Any)#
Bases:
pydantic.BaseModelValidated structure for NAT-owned ATIF
Step.extrapayload.NAT writes the following keys into
Step.extraunder this convention:ancestry(required by NAT’s converter) —AtifAncestryshape: which callable produced this step.invocation(optional) —AtifInvocationInfoshape: step-level timing.data_schema(optional, opaque dict) — the producer-declared ATOF data_schema preserved for downstream validation.
Per-tool-call ancestry and timing live on
ToolCall.extra, NOT here — they’re co-located with the tool_call they describe rather than aligned by index on the parent step. This is the v1.7-aligned layout (the spec addsextratoToolCallfor this purpose).model_config = ConfigDict(extra="allow")so callers MAY add additional keys. The requiredancestryfield documents NAT’s own convention but does not preclude other producers from emitting differentStep.extrashapes.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#
- class AtifToolCallExtra(/, **data: Any)#
Bases:
pydantic.BaseModelValidated structure for NAT-owned ATIF
ToolCall.extrapayload.NAT writes the following keys into
ToolCall.extraunder this convention:ancestry(optional) —AtifAncestryshape: which callable issued this tool invocation.invocation(optional) —AtifInvocationInfoshape: per-tool-call timing.
model_config = ConfigDict(extra="allow")so callers MAY add additional keys.extra="allow"also means aToolCall.extrathat lacks both keys still validates — neither is required by the NAT convention.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 = None#
- invocation: AtifInvocationInfo | None = None#