Agents

Ax programs make compact native tools for AI agents.

File digestexamples/agents/file_digest.ax reads bounded prefix, range, tail, text line, JSON line-window previews, and base64 file byte windows, writes artifacts, and hashes full files or byte ranges.
FS journalexamples/agents/fs_journal.ax prepares nested artifact parents, appends and reads JSONL event logs, walks and filters artifacts with newline and JSON discovery APIs, records stat arrays, writes atomically, persists validated JSON state, cleans, and hashes outputs.
Signed manifestexamples/agents/signed_manifest.ax hashes a file and signs compact JSON, whole files, and byte ranges with HMAC-SHA256.
Secure tokenexamples/agents/secure_token.ax creates random hex and base64url tokens, UUID trace IDs, and checks signatures with constant-time compare.
Env reportexamples/agents/env_report.ax reads defaulted agent metadata and writes a prefix-scoped environment JSON snapshot.
Process probeexamples/agents/process_probe.ax captures command output, status, line arrays, and merged diagnostic logs as structured JSON for native agent workflows.
IO diagnosticsexamples/agents/io_diagnostics.ax keeps stdout protocol output separate from stderr diagnostics with io.eprintln.
CLI probeexamples/agents/cli_probe.ax reads flags, defaulted option values, structured argv JSON, and parsed option/flag manifests.
JSON toolexamples/agents/json_tool.ax validates JSON, reads defaulted fields, queries nested paths, reads typed scalars, checks arrays, appends array manifests, builds valid JSON artifacts, and writes key manifests.
String agentexamples/agents/string_agent.ax normalizes labels, checks byte positions and match counts, and writes a digest.
Path manifestexamples/agents/path_manifest.ax normalizes source paths and writes a manifest digest.
Time probeexamples/agents/time_probe.ax records seconds, milliseconds, UTC ISO timestamps, and a short native sleep.
URL routerexamples/agents/url_router.ax extracts URL parts, individual query values, and decoded query JSON for HTTP-facing tools.
Tool serverexamples/agents/tool_server.ax exposes native HTTP endpoints.
HTTP fetchexamples/agents/http_fetch.ax calls local HTTP tool endpoints with body-only and structured bounded JSON GET/POST results.
Async scoreexamples/agents/async_score.ax demonstrates async worker dispatch.

Native HTTP Tool

&3010{G/health>#{ok:!1,service:"ax-agent-tool"} G/tools/*>"tool" P/echo>~}

Run

ax build examples/agents/tool_server.ax -o .ax-out/tool_server
.ax-out/tool_server
curl http://localhost:3010/health

HTTP Client

ax run examples/agents/http_fetch.ax

Environment Metadata

AX_AGENT_NAME=ax ax run examples/agents/env_report.ax

FS Journal

ax run examples/agents/fs_journal.ax

Signed Manifest

ax run examples/agents/signed_manifest.ax

Secure Token

ax run examples/agents/secure_token.ax

Process Capture

ax run examples/agents/process_probe.ax

IO Diagnostics

ax run examples/agents/io_diagnostics.ax
# stdout stays protocol-safe; io.eprintln writes diagnostics to stderr

CLI Arguments

ax run examples/agents/cli_probe.ax -- --input examples/agents/path_manifest.ax --mode digest --upper

JSON Payloads

ax run examples/agents/json_tool.ax

String Normalization

ax run examples/agents/string_agent.ax

Path Manifest

ax run examples/agents/path_manifest.ax

Time Probe

ax run examples/agents/time_probe.ax

URL Router

ax run examples/agents/url_router.ax