arkadia-data — AK-DATA (Arkadia Data Format) for Python
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.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| arkadia_data-0.3.0.tar.gz | 203.5 kB | Without provenance | Details for arkadia_data-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| arkadia_data-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for arkadia_data-0.3.0-py3-none-any.whl |
Total release size: 418.0 kB
Release files / arkadia_data-0.3.0.tar.gz
| Download URL | arkadia_data-0.3.0.tar.gz |
|---|---|
| Size | 203.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e7173b6453f71c010fc63dc369a2a7e3e3139f6654e165cfada3a1577105d6df
|
|
BLAKE2b-256 checksum How to use checksums |
2298abc6a2785da8dfb0cb9684aa7351f304691cf542ac434845075f32d58a33
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.8
|
Release files / arkadia_data-0.3.0-py3-none-any.whl
| Download URL | arkadia_data-0.3.0-py3-none-any.whl |
|---|---|
| Size | 214.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1bf0c3d42373436dea04cfeef229f800311f75014e617995e7d55390b290d6b0
|
|
BLAKE2b-256 checksum How to use checksums |
6abe84aee70438c2bc4823c60ab9250bdd52b147142c2fd84591ef96eeb806a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.8
|
Security for arkadia-data 0.3.0
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.