Designing a Five-Layer Wire Protocol for AI Agent Communication

    This article examines the hidden token cost of repeatedly transmitting structural descriptions in HTTP/JSON responses and outlines a five-layer wire protocol designed for AI agent communication. It covers four recurring problems with traditional HTTP for agents, the responsibilities of each protocol layer (physical, framing, structure, identity and authorization, and semantics), a sample schema negotiation exchange, unresolved design questions, and a phased rollout and validation approach.

    1. Where the Problem Starts: A Long-Ignored Cost

    Once you connect a large language model to existing HTTP APIs, one outcome is almost inevitable: a significant share of the tokens consumed by inference produces no new information but is instead spent re-reading the same structural description over and over.

    Take a common paginated list endpoint. Every record in the response carries the full set of field names: identifier, name, price, description, category, stock, and so on. The model already builds an understanding of this structure at the first record, yet traditional HTTP/JSON semantics have no state bit that says “you already know this.” The result: the bytes are still sent, the tokenizer still splits them, and the cost is still paid.

    From rough measurements across several internal workloads, in structure-heavy endpoint scenarios (product catalogs, account transaction records, feeds), repeated structural descriptions account for roughly 30% to 60% of response-side tokens. This range correlates strongly with workload characteristics, so we do not treat it as a conclusion. Instead, we plan to publish a reproducible evaluation methodology in a later stage so that outside parties can verify it independently.

    This alone is not enough to justify designing a protocol from scratch. What made the decision for us was that, after listing every way traditional HTTP feels awkward for agents, the list kept growing.

    2. Four Recurring Fundamental Problems

    2.1 Structural descriptions repeat with every record

    Field-selection query schemes can cut unused fields, but field names remain bound to each individual record and cannot be “remembered” at the session level. For responses with thousands of records, this redundancy grows linearly.

    2.2 Agent identity has no place at the protocol layer

    Existing authentication mechanisms assume a “human user” or a “service disguised as a human.” When a model makes a call on behalf of a user, the server has no standardized way at the protocol layer to ask: who issued this agent, what permission scopes were granted, whether it has been revoked, and how long it is valid. The common practice today is to stuff a token into a generic auth header and rely on the gateway to parse it. Every team reinvents the wheel, implementations are inconsistent with one another, and auditing and accountability lack a unified handle.

    2.3 The semantic layer is left entirely to the agent to guess

    APIs return structured data, but field meanings, enum values, units, and state machines must be inferred by the model itself. The typical engineering workaround is to pile on lengthy prompts that repeatedly tell the model the format of a given time field or that a certain status code means “shipped.” This work happens at inference time, is redone on every call, and the protocol layer is completely unaware of it, unable to cache or reuse it.

    2.4 Error and retry semantics are inconsistent

    Human-facing error pages are mixed with program-facing status codes, making it hard for an agent to reliably distinguish among four entirely different handling paths: invalid parameters, insufficient permissions, temporary unavailability, and the need for human intervention. This easily leads to futile retries or premature abandonment.

    3. Design Approach for the Five Layers

    We split the protocol into five layers, with a core principle: each layer solves only one class of problem, and upper layers must not bypass lower layers to assume implementation details.

    • Physical and transport layer: Unconcerned with semantics, responsible only for reliable byte transport and connection reuse; can map onto existing transport capabilities.
    • Framing and boundary layer: Determines message boundaries, compression, and chunking, addressing the problem of a large response occupying the entire context at once.
    • Structure layer: Allows the structural description to be negotiated once within a session, after which records carry only identifiers and values, mechanically eliminating repeated field names.
    • Identity and authorization layer: Makes the issuer, permission scopes, revocation status, and validity period first-class citizens within the protocol, rather than conventions buried in headers.
    • Semantic layer: Carries field meanings, enums, units, and state transitions so they can be cached and shared across multiple agents.

    A schematic of the structure negotiation process can be abstracted as:

    1. Client -> Server: DESCRIBE resource=ProductList fields=[id,name,price,status]
    2. Server -> Client: SCHEMA id=0x1A version=3 types={...} enums={status:0=pending,2=shipped}
    3. Client -> Server: QUERY schema=0x1A page=1 size=200
    4. Server -> Client: DATA schema=0x1A rows=[[1,"A",9.9,2], ...]

    The key point is that after schema=0x1A, field names no longer repeat with every row.

    4. What We Admit Is Not Yet Figured Out

    First, cache invalidation strategy for structure negotiation. When the structure version is upgraded, how do we let long-lived agents transition smoothly and avoid a large number of half-old, half-new sessions.

    Second, the authoritative source of the semantic layer. Whether semantic descriptions are maintained by the service provider or by the ecosystem collectively is a governance question that a purely technical solution cannot resolve.

    Third, coexistence with existing infrastructure. The protocol ultimately has to land on common cloud product categories such as gateways, logging, monitoring and alerting, and message queues. How to ensure observability does not degrade still needs validation.

    Fourth, consistency of cross-language reference implementations. Multi-language SDKs are prone to behavioral drift and need an executable conformance test suite as a constraint.

    5. Phased Rollout and Validation

    We lean toward splitting the evolution into three stages: first, without changing existing deployments, use the structure layer and semantic layer to obtain measurable gains; then introduce the identity layer and run parallel validation with gateway-side authentication; and only last consider replacing the transport layer. Each stage comes with a reproducible evaluation method and public data, rather than just an isolated percentage.

    If you have also thought seriously at the protocol layer about the shape of agent traffic, welcome to point out where the tradeoffs above do not hold up, especially the boundary between the identity layer and the semantic layer, which is the part we are least certain about right now.