Skip to main content

A naming convention that lets AI agents understand your data without being told what it means.

Project description

Agent-First Data for Python

pip install agent-first-data
from agent_first_data import output_json, output_plain

value = {
    "code": "ok",
    "result": {
        "api_key_secret": "sk-123",
        "latency_ms": 1280,
        "db_url": "postgres://user:p@ss@db/app?token_secret=abc",
    },
}

print(output_json(value))
print(output_plain(value))

Useful names use Python casing: output_json, output_yaml, output_plain, output_json_with_options, redacted_value, redact_secrets_in_place, redact_url_secrets, parse_size, normalize_utc_offset, cli_parse_output, cli_output, and build_cli_error.

Logging is available through init_logging_json, init_logging_plain, init_logging_yaml, span, and get_logger.

from agent_first_data import init_logging_json

init_logging_json("INFO", secret_names=("authorization",))

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/plain quote and escape keys as well as values, sort by UTF-16 code unit order, and render nested objects in arrays as canonical JSON.
  • Logging records use code: "log" plus a separate level field, so error-level logs are not terminal protocol errors.
  • build_cli_error(message, hint?) returns {code:"error", error: message, hint?} only.

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.13.0.tar.gz (26.4 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.13.0-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agent_first_data-0.13.0.tar.gz
  • Upload date:
  • Size: 26.4 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.13.0.tar.gz
Algorithm Hash digest
SHA256 72e157b026c5e70f7515439b36cd44b9cf7ecab43d81341e1b4a12629cb2aab1
MD5 9889383276866bc7de2428b4b2408b59
BLAKE2b-256 dca95c44eb7a3e45749939d256f1fa6f564b1d178c077f60e18257b3018b3766

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for agent_first_data-0.13.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fe824d080cc1ad0f3539d34047dd0ef756e9734fc4c04b15d8212ca12835b78f
MD5 caa313fb816ac8dc2cff67e1339466f4
BLAKE2b-256 d5bfd8ed560a56cc68d913e14dcb6201f7d4a4ef3f0b04c1b00b6ce2737b020f

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