Skip to main content

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.

Release files for atif 1.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for atif 1.7.0
File Size Uploaded
atif-1.7.0.tar.gz 9.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for atif 1.7.0
File Interpreter ABI Platform
atif-1.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.0 kB

Release files / atif-1.7.0.tar.gz

Download URL atif-1.7.0.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
668cf3d4592a2147e62a4c2fc3663faacb3217a1627b395a1e0f354076f79d3f
BLAKE2b-256 checksum
How to use checksums
c114b0629cab0a86470c31d530498fc39c65a8385eaf95f4f39dbcde695284c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 16, 2026.

Transparency log

Release files / atif-1.7.0-py3-none-any.whl

Download URL atif-1.7.0-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7bb0c09a6d94ff5a73f6253a2aeb101d41d0724cfd0cdb8d96541ac4f2b7ab6c
BLAKE2b-256 checksum
How to use checksums
ba97cddb7c5cebe218534563533600eacc57beaace90ee85c435126214f5b18b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.7.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page