Skip to main content

Pydantic models for the Agent Trajectory Interchange Format (ATIF v1.7).

Project description

atif

Pydantic models for the Agent Trajectory Interchange Format (ATIF), a standardized JSON schema for logging the complete interaction history of autonomous LLM agents — user messages, agent responses, tool calls, observations, metrics, and embedded subagent trajectories. Implements ATIF v1.7.

Install

pip install atif

Usage

from atif import Trajectory

data = {
    "schema_version": "ATIF-v1.7",
    "agent": {"name": "my-agent", "version": "1.0.0", "model_name": "claude-sonnet-4-6"},
    "steps": [
        {"step_id": 1, "source": "user", "message": "What time is it?"},
        {
            "step_id": 2,
            "source": "agent",
            "message": "Let me check.",
            "tool_calls": [
                {"tool_call_id": "c1", "function_name": "now", "arguments": {}}
            ],
            "observation": {
                "results": [{"source_call_id": "c1", "content": "2026-05-16T12:00:00Z"}]
            },
            "metrics": {"prompt_tokens": 120, "completion_tokens": 18},
        },
    ],
}

trajectory = Trajectory.model_validate(data)
print(trajectory.steps[1].tool_calls[0].function_name)  # "now"
print(trajectory.to_json_dict(exclude_none=True))

Validation enforces the ATIF rules: sequential step_ids, ISO 8601 timestamps, agent-only fields gated on source == "agent", tool-call / observation correlation, embedded-subagent trajectory_id uniqueness, and ContentPart text/image XOR.

Versioning

atif's MAJOR.MINOR tracks the ATIF RFC version it implements (1.7.x ⇔ ATIF v1.7); PATCH is reserved for library-only fixes. Because the ATIF RFC occasionally introduces breaking changes on a MINOR bump (e.g. v1.7's SubagentTrajectoryRef resolution change), a MINOR bump of this library may be breaking too — pin to atif~=1.7.0 if you need to stay on a single ATIF version.

AI disclosure

Parts of this project, including code, tests, and documentation, were written with the assistance of AI tooling. Readers should be aware that AI was involved in its production.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

atif-1.7.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

atif-1.7.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file atif-1.7.0.tar.gz.

File metadata

  • Download URL: atif-1.7.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for atif-1.7.0.tar.gz
Algorithm Hash digest
SHA256 668cf3d4592a2147e62a4c2fc3663faacb3217a1627b395a1e0f354076f79d3f
MD5 e75d5cd0070b925fcc9d56959efdd5df
BLAKE2b-256 c114b0629cab0a86470c31d530498fc39c65a8385eaf95f4f39dbcde695284c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for atif-1.7.0.tar.gz:

Publisher: publish.yml on bolu61/python-atif

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file atif-1.7.0-py3-none-any.whl.

File metadata

  • Download URL: atif-1.7.0-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for atif-1.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7bb0c09a6d94ff5a73f6253a2aeb101d41d0724cfd0cdb8d96541ac4f2b7ab6c
MD5 d0b8303c2de05ebcf35f16c5d24ed13e
BLAKE2b-256 ba97cddb7c5cebe218534563533600eacc57beaace90ee85c435126214f5b18b

See more details on using hashes here.

Provenance

The following attestation bundles were made for atif-1.7.0-py3-none-any.whl:

Publisher: publish.yml on bolu61/python-atif

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page