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 json_result, output_json, output_plain

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

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

Useful names use Python casing: output_json, output_yaml, output_plain (each takes an optional keyword-only options=), redacted_value, redact_secrets_in_place, redact_url_secrets, normalize_utc_offset, is_valid_rfc3339_date, is_valid_rfc3339_time, is_valid_rfc3339, is_valid_bcp47, cli_parse_output, cli_output, build_cli_error, build_cli_version, cli_handle_version_or_continue, decode_protocol_event. Skill admin and stream-redirect helpers live in agent_first_data.skill and agent_first_data.stream_redirect (import the submodule directly).

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 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 bare --version stays conventional and --version --output json|yaml|plain stays structured.
  • Use agent_first_data.stream_redirect.install_from_raw_args() before version/help handling if a CLI exposes --stdout-file or --stderr-file; stderr is redirected as native diagnostics, not JSON.

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.17.1.tar.gz (45.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.17.1-py3-none-any.whl (41.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agent_first_data-0.17.1.tar.gz
  • Upload date:
  • Size: 45.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.17.1.tar.gz
Algorithm Hash digest
SHA256 ff46e950b959f32f5de27abc7352f41539a9b627ca42f033aa96f471884b7c2d
MD5 317a328750ae1657e5fe6efa72c1de55
BLAKE2b-256 a7ce332b14dc89ca1e4bcc754076c0f467ef8659c9b5ca38145ed46a5941ac11

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for agent_first_data-0.17.1-py3-none-any.whl
Algorithm Hash digest
SHA256 26f19af3ab9e584735e5919c35091f59d3ef5db461184e60effe8dc130ee26b5
MD5 821904278ce333770d884f260c6db25e
BLAKE2b-256 83a370a4ae272707f8dd2f5ab3f5599f3f66f32a6f8a06f99a72ccc6f52cbff7

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