Skip to main content

arkadia-data — AK-DATA (Arkadia Data Format) for Python

PyPI version PyPI downloads License: MIT

Lossless, schema-first data for LLMs and agents. AK-DATA writes JSON data with a header that names each field once and records that follow it by position — about 55% fewer tokens than JSON and 14% fewer than TOON on typical agent payloads, decoding back to the exact original.

pip install arkadia-data            # library, no dependencies
pip install "arkadia-data[bench]"   # + tiktoken, toon-format, PyYAML (exact counts, TOON/YAML comparison)

This package is a library. The ak-data command line tool is the Rust crate of the same name (brew install arkadia-solutions/tap/ak-data or cargo install arkadia-data) and writes exactly the same text.

Library

import arkadia.data as akd

data = {"users": [{"id": 1, "name": "Ada"}, {"id": 2, "name": "Alan"}]}

text = akd.encode(data, {"compact": True})   # '<users:<[id:number,name:string]>>([(1,"Ada"),(2,"Alan")])'
result = akd.decode(text)
result.node.dict() == data                    # True
result.errors                                 # [] — decode errors, if any

akd.encode(data)                              # readable multi-line form
akd.encode(data, {"prompt_output": True})     # structural template for model output

Shortcuts and prompt helpers:

akd.dumps(data)              # compact (same as encode(..., compact=True, escape_new_lines=True))
akd.loads(text)              # data; raises akd.AKDataError on invalid input (strict=False: best effort)
akd.loads_any(reply)         # model reply in JSON or AK-DATA, with or without ``` fences
akd.to_prompt(data)          # one-line hint + <data>…</data>
akd.FORMAT_DEFINITION        # ~120-token definition to paste into a chat model
akd.answer_instruction("<result:<[name:string,total:number]>>")
akd.count_tokens(text)       # exact with tiktoken, approximate otherwise

Prompts

from arkadia.bench.prompts import build_prompt, get_example

ex = get_example("3")                         # one of the 66 bundled examples
ex.prompt("ak-data-compact")                  # definition + data + question + answer format
build_prompt(data, "Who joined first?", "toon", answer=("result", [("name", "string")]))

Formats: json, toon (extra bench), ak-data, ak-data-compact. The same prompts on the command line: ak-data prompt --example 3 -f toon.

Changes and history

from arkadia.data import diff

changes = diff.diff(old, new)        # [Change(op='change', path='users[id=2].name', …)]
diff.apply(old, changes) == new      # ConflictError when a change does not fit
diff.apply(new, diff.reverse(changes)) == old
text = diff.commit(text, new, title="Rename Alan", author="Ada")   # data + its history ($changes)
diff.history(text)                   # [ChangeSet(id, date, author, title, …)]

The history is metadata: akd.loads(text) still returns exactly the data.

MIT © Arkadia Solutions · https://arkadia.solutions/akdata · changelog

Metadata

Release files for arkadia-data 0.3.1

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

Source distribution (sdist)

Source distribution for arkadia-data 0.3.1
File Size Uploaded Provenance Actions
arkadia_data-0.3.1.tar.gz 203.6 kB Without provenance Details for arkadia_data-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for arkadia-data 0.3.1
File Interpreter ABI Platform Actions
arkadia_data-0.3.1-py3-none-any.whl Python 3 none any Details for arkadia_data-0.3.1-py3-none-any.whl

Total release size: 418.3 kB

Release files / arkadia_data-0.3.1.tar.gz

Download URL arkadia_data-0.3.1.tar.gz
Size 203.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ff9af73e296554ec517faa68452e7d556002ef2006643392a9b4aed7271039a5
BLAKE2b-256 checksum
How to use checksums
72fb628e0248080e5cc0939738ad72a4640c7e83282f96edd746fb06f1050b6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / arkadia_data-0.3.1-py3-none-any.whl

Download URL arkadia_data-0.3.1-py3-none-any.whl
Size 214.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b8eb7c1c990ab683795e72fbd6780b326dfd34ca4196387b81c1703066d024d9
BLAKE2b-256 checksum
How to use checksums
8408a5ee97f0ddd87f329d236641311d94f4ec2fc412381035010c14e17cedbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for arkadia-data 0.3.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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