AI Agent Protocol Design: Reducing Token Waste

    Repeated field names, loosely defined delegation, and semantics embedded in prompts make conventional web APIs inefficient for AI agents. This article explores how schema negotiation, compact data representations, verifiable identity, and explicit session controls can reduce unnecessary tokens while improving auditability and interoperability. It also outlines a layered design, practical migration options, security considerations, and a workload-based approach to evaluation.

    When AI agents connect to existing web APIs, an easily overlooked cost lies not in the model itself but in the communication format. Traditional request-response interfaces serve human browsers or fixed clients: field names repeat in every record, authentication assumes one user per session, and callers must interpret the meaning of returned data.

    When the caller is a large language model that repeatedly reads the same structures, these assumptions translate into substantial token overhead, inconsistent authorization boundaries, and field definitions that must be revisited during each inference.

    The solution is not simply a smarter assistant. It is a wire-level design suited to agents—one that addresses cost, auditability, and interoperability together.

    1. Paginated Lists Expose the Mismatch

    A typical product, ledger, or feed API returns an array of objects. Every row includes keys for identifiers, names, prices, descriptions, categories, inventory, and other fields.

    For conventional clients, these keys provide useful self-description. For a tokenizer, they are symbols that count toward the bill. Once the model has learned the field set from the first response, subsequent pages effectively teach it the same table again.

    In workloads with dense schemas, many pages, or long field names, repeated keys can account for a substantial share of the tokens in returned data. The exact proportion depends on field width and record count, but the underlying issue is consistent: HTTP combined with general-purpose object notation does not track whether the recipient already knows the structure.

    Graph-style queries can reduce unnecessary fields, but each record still carries field names. Compression and binary encoding can reduce bandwidth, yet they offer limited inference-cost benefits if the data is decoded back into key-heavy text before reaching the model.

    A more effective approach is to negotiate the structure once during a session or connection, then transmit values in an agreed order. Alternatively, the model side can cache a schema fingerprint while the server indicates that the structure has not changed.

    2. Four Recurring Protocol Gaps

    Structure and instances are not separated

    The protocol should distinguish type definitions from instance data. Types can be referenced through numeric identifiers, hashes, or short labels, while instances travel as columns or ordered slots.

    When a structure changes, explicit incremental patches can avoid retransmitting the entire definition.

    Agent identity has no clear place

    Traditional authentication targets people or service accounts. When a model acts on a user’s behalf, the server needs protocol-level answers to several questions: Who issued the credential? What is the authorized scope? Has it been revoked? Does this call exceed its authority?

    Putting a token in a generic header and letting a gateway interpret it can work. However, independently designed claim fields make interoperability difficult and audit records inconsistent.

    A more robust approach makes the principal, delegation chain, scope, expiration, and revocation signals verifiable protocol fields rather than scattering them across prompts or business JSON.

    Semantics are reconstructed during inference

    An API may return numeric status codes or timestamp fields whose meanings exist only in documentation or system prompts. Each call then consumes context explaining, for example, that a particular status means “shipped.”

    Stable semantic identifiers—covering registered enumerations, units, time zones, and null conventions—can accompany type definitions. The model needs to align with them once instead of repeatedly reading the same manual.

    Session state and idempotency are not agent-friendly

    Models may retry calls, divide tasks into parallel operations, or switch tools midway through a workflow. Without request correlation, partial-success reporting, and resumable cursors, agents can place duplicate orders or miss pages.

    Protocol-level idempotency keys, cursor tokens, and partial-result markers are more reliable than a prompt that says, “Do not call this twice.”

    3. A Layered Design for Agent Traffic

    Classical network layering offers a useful reference, but there is no need to reproduce the seven-layer model. What matters is separating responsibilities.

    Transport and framing

    Existing reliable transports can be reused. The priorities are clear frame boundaries, streaming support, and interruption.

    Long lists should support delivery by page or chunk, and receivers should be able to acknowledge the schema version they understand.

    Representation

    Compact value sequences with schema references should be the default. Text-based object notation can remain available for debugging or initial negotiation.

    Null values, decimal precision, and time representations need explicit definitions so the model does not have to guess.

    Sessions and identity

    Connections or sessions should be bound to delegated credentials, with scopes that can be narrowed to specific resources and operations.

    Revocation can propagate through frequent validation or in-session notifications. Logs should record principal identifiers rather than relying only on IP addresses.

    Semantic registries

    Fields, enumerations, and error codes should belong to versioned registries. Agents can retrieve them at startup or subscribe to changes instead of embedding an entire manual in the system prompt.

    Orchestration conventions

    Tool calls need standard signals for timeouts, cancellation, compensating actions, and human confirmation points. This reduces the need for every application to invent its own state machine.

    4. Implementation Choices and Open Questions

    Compatibility and migration

    A gateway can provide bidirectional adaptation: existing APIs remain unchanged internally, while agents receive schema caching and compact value sequences externally.

    Incremental migration is more realistic than requiring every service to adopt a new protocol at once.

    Security

    Schema negotiation can itself create fingerprinting and side-channel risks, so access to enumerable type catalogs should be restricted.

    Delegated credentials need replay protection. Semantic registries need protection against poisoning; signatures and hash verification should not be omitted.

    Evaluation

    A single percentage is not enough to describe the benefits. Evaluations should report token usage, latency, and error rates across workloads with different schema densities, pagination depths, field-name lengths, and streaming behavior.

    Reproduction methods should be published. Incomplete benchmarks should not be presented as established product metrics.

    Unresolved design questions

    Several boundaries deserve explicit discussion:

    • How should multi-hop agents pass on only the minimum necessary scope?
    • Should semantic version conflicts cause rejection or graceful degradation?
    • How well do compact binary formats align with a model’s native tokenization?
    • Does schema caching create additional data-residency risk for regulated data?

    Acknowledging these limits is more useful to technical discussion than claiming that one protocol can solve all agent communication problems.

    5. How the Protocol Layer Complements Conversational Assistants

    Conversational assistants are good at clarifying intent, breaking down tasks, and selecting tools. They are not well suited to reparsing the same wide table in every interaction.

    A practical division of responsibilities is:

    • The assistant handles task planning and explanations of exceptional conditions.
    • The protocol layer maintains connection state for schemas already understood, scopes already granted, and enumerations already aligned.

    Together, these layers can shorten system prompts, make tool results smaller and more consistent, and allow gateway logs to be searched by principal and schema version.

    For cloud deployments, object storage can hold large schema-registry snapshots. Message queues can distribute revocation and version updates across services. Container platforms can host stateless adaptation gateways, while logging and monitoring track repeated-schema overhead and authentication-failure categories.

    These are combinations of general infrastructure capabilities, not dependencies on a particular proprietary interface. Teams can also use a unified cloud resource and permissions framework for session-level credential rotation, aligning agent calls with existing audit trails.

    6. Practical Checklist

    • API design: Keep fields stable, make enumerations explicit, include time zones, and provide machine-readable errors.
    • Gateway: Negotiate schemas in the first response or at session setup, omit repeated keys afterward, and standardize token parsing.
    • Model side: Cache schema fingerprints and refresh field explanations in prompts only when the schema changes.
    • Evaluation: Measure token usage by workload category rather than making external promises based on a single internal figure.
    • Governance: Put registry versioning, signatures, revocation, and least-privilege scopes into specifications—not just blog posts.

    AI agents do not eliminate the need for clear APIs. They amplify the cost of repeatedly explaining the same data structures.

    Moving structure, identity, and semantics out of prompts and into the protocol lets conversational assistants reserve context for actual reasoning rather than rereading field names. That is why agent traffic deserves explicit protocol-level support—and why further benchmarks and open-source implementations remain worth developing.