Skip to main content

A naming convention that lets AI agents understand your data without being told what it means, plus a CLI and library for reading and safely editing structured JSON, TOML, YAML, dotenv, and INI documents.

Project description

Agent-First Data for Python

pip install agent-first-data
from agent_first_data import json_result, render, OutputFormat

value = json_result(
    {
        "api_key_secret": "sk-123",
        "latency_ms": 1280,
        "db_url": "postgres://user:p@ss@db/app?token_secret=abc",
    }
).build()

print(render(value, OutputFormat.JSON))
print(render(value, OutputFormat.PLAIN))

Useful names use Python casing: render (the single value x format x options -> str entry point; takes an OutputFormat and an optional keyword-only options=), redacted_value, redact_url_secrets, redact_argv, normalize_utc_offset, is_valid_rfc3339_date, is_valid_rfc3339_time, is_valid_rfc3339, is_valid_bcp47, cli_parse_output, build_cli_error, build_cli_version, cli_handle_version_or_continue, decode_protocol_event.

Behavior Notes

  • Default redaction replaces every _secret or configured secret-name subtree with ***, including objects and arrays.
  • _url fields scrub userinfo passwords and secret-named query parameters; surrounding whitespace is trimmed and internal whitespace redacts the whole field.
  • YAML keeps original keys and values (structure-preserving, like JSON), sorting keys by UTF-16 code unit order and quoting/escaping unsafe keys and string scalars. Plain strips formatting suffixes, formats values, sorts the same way, and renders nested objects/arrays as canonical JSON.
  • Logging records use kind:"log" with a nested log payload and a separate level field, so error-level logs are not terminal protocol errors.
  • build_cli_error(message, hint?) returns a strict-ready CLI error with error.retryable:false and trace:{}.
  • Use cli_handle_version_or_continue() before argument parsing so --version always answers with a structured protocol-v1 kind:"result" version event. An explicit --output wins; pass the command's normal output as default_format (JSON when omitted), plus its value-taking global flag names.

Reference

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

agent_first_data-0.25.0.tar.gz (36.7 kB view details)

Uploaded Source

Built Distribution

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

agent_first_data-0.25.0-py3-none-any.whl (27.3 kB view details)

Uploaded Python 3

File details

Details for the file agent_first_data-0.25.0.tar.gz.

File metadata

  • Download URL: agent_first_data-0.25.0.tar.gz
  • Upload date:
  • Size: 36.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for agent_first_data-0.25.0.tar.gz
Algorithm Hash digest
SHA256 d96d35572e298215275818665b3d85864c338c366ebe3c8dafbe45a02be0322c
MD5 c75443c416f0f49283ed11c714e96acc
BLAKE2b-256 46a00d42d962ce9ec553e8e0362ca8065d86795e6e75142ff6daed2662fc9dfb

See more details on using hashes here.

File details

Details for the file agent_first_data-0.25.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agent_first_data-0.25.0-py3-none-any.whl
Algorithm Hash digest
SHA256 595bb05aff5b16f66f9e1dd3272be90d8f300a639dd1508e5721c2b61be6914a
MD5 51671fb1f6b75e54a052decdf45222f6
BLAKE2b-256 9a612d8d35f666afe9ac1333d6783fc8dff3be36b0480c3a5fb6ac0f6a0c3966

See more details on using hashes here.

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