Live
How AWS Strands Decider 2B and Strands Box reshape AI agent development pipelinesWorkers Build Runtimes Updated to Latest Node, Python, Go, Bun, and Tool VersionsGPU Security on Kubernetes: New Risks and Defensive ApproachesMCP gateway hits GA in Red Hat Connectivity Link 1.5 – implications for OpenShift AI deploymentsLocal AI Inference on the Surface Laptop Ultra: Performance, Power, and Practical Trade‑offsOpen‑Weight Model Risk Management: Actionable Guidance for EngineersSelf‑Hosted Void Platform Lets Teams Govern AI‑Built Apps on CloudflareRethinking Agent Evaluation: Practical Lessons from the Google Cloud Developer PluginHow AWS Strands Decider 2B and Strands Box reshape AI agent development pipelinesWorkers Build Runtimes Updated to Latest Node, Python, Go, Bun, and Tool VersionsGPU Security on Kubernetes: New Risks and Defensive ApproachesMCP gateway hits GA in Red Hat Connectivity Link 1.5 – implications for OpenShift AI deploymentsLocal AI Inference on the Surface Laptop Ultra: Performance, Power, and Practical Trade‑offsOpen‑Weight Model Risk Management: Actionable Guidance for EngineersSelf‑Hosted Void Platform Lets Teams Govern AI‑Built Apps on CloudflareRethinking Agent Evaluation: Practical Lessons from the Google Cloud Developer Plugin

Adopt TOON to Reduce LLM Token Costs in High‑Volume Tool Integrations

AI SummaryPowered by AI

Tool output formats are being optimized with Token‑Oriented Object Notation (TOON), which removes repetitive field names and reduces token consumption for AI coding agents. This matters because token usage drives cost, and a compact representation can lower expenses while preserving data integrity.

Tool output formats for AI coding agents are being reconsidered: a schema‑first representation called Token‑Oriented Object Notation (TOON) can replace verbose JSON when the data shape is uniform, cutting the number of characters—and therefore tokens—sent to the model. Practitioners care because token consumption dominates the cost of agent‑driven workflows, and reducing repetitive field names can lower expenses without sacrificing data fidelity.

Why the Output Format Matters for Token Budgets

When an agent reads source files, tickets, logs, or security findings, the bulk of the token bill comes from the context it must ingest, not from the final pull‑request it generates. Repeating JSON keys for each record adds structural overhead that could otherwise be used for more relevant evidence, such as code snippets or instructions. By emitting a single header that lists field names once and then streaming rows of values, TOON eliminates that redundancy.

Practical Gains Observed with TOON

In a measured comparison of a 25‑issue Sonar report, the TOON representation used 49 % fewer characters than pretty‑printed JSON and 33 % fewer than minified JSON. The TOON project’s own benchmarks also show lower token usage for uniform tabular datasets while maintaining comparable retrieval accuracy. These figures are directional; teams should capture real payloads, run them through the tokenizer used by their chosen model, and compare the results.

// JSON example (single record)
{ "key": "AZ1002fQ9x", "severity": "BLOCKER", "component": "src/main/java/com/acme/UserRepo.java", "line": 29, "status": "OPEN" }

// TOON example (header + rows)
key,severity,component,line,status
AZ1002fQ9x,BLOCKER,src/main/java/com/acme/UserRepo.java,29,OPEN

Choosing the Right Representation

The decision should be driven by the consumer and the data shape:

  • Human‑oriented terminal output: a simple table is often sufficient.
  • Scripted or API‑driven pipelines: standard JSON remains convenient for nested or irregular structures.
  • LLM‑driven agents processing many uniform records: a schema‑first format like TOON can reduce token load.

Adopting TOON does not require abandoning JSON; both formats can coexist, with the toolchain selecting TOON only when the downstream consumer is an LLM.

Operational and Architectural Considerations

Switching output formats introduces a few practical steps:

  1. Identify the highest‑volume structured calls in the agent workflow (e.g., issue listings, dependency alerts).
  2. Capture a baseline payload in the current format and measure token count using the model’s tokenizer.
  3. Enable the alternative format (TOON) for that call and re‑measure token consumption.
  4. Validate that the agent still makes correct decisions—e.g., locating the highest‑priority finding and confirming remediation status.

Because the format change is lossless for the targeted data shapes, it should not affect the correctness of downstream actions, but teams must verify that the toolchain accepts the new representation and that any downstream parsers are updated accordingly.

Related CloudNinjas coverage: AI engineering.

What This Means For Practitioners

Start by profiling the token cost of your most frequent tool responses. If a response consists of a large, uniform collection, experiment with a schema‑first format such as TOON and measure the impact on token usage and decision quality. Adopt the compact format only where it integrates cleanly with existing tooling, and keep JSON for cases that require nested or irregular data. By treating tool output as part of the agent’s context design, you can achieve measurable cost savings without compromising the fidelity of the information the model receives.

Originally published atThe New Stack