<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://tools.ietf.org/tools/rfcxml/v3/rfc.xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" version="3"
     submissionType="IETF"
     docName="draft-liu-agent-protocol-over-moq-00"
     ipr="trust200902"
     category="std"
     consensus="true">
  <front>
    <title abbrev="Agent Protocol over MoQ">Agent Protocol over MoQ</title>
    <seriesInfo name="Internet-Draft" value="draft-liu-agent-protocol-over-moq-00"/>
    <author fullname="Dapeng Liu" initials="D." surname="Liu">
      <organization abbrev="Alibaba Cloud">Alibaba Cloud</organization>
      <address>
        <email>max.ldp@alibaba-inc.com</email>
      </address>
    </author>
    <author fullname="Suresh Krishnan" initials="S." surname="Krishnan">
      <organization abbrev="Cisco">Cisco</organization>
      <address>
        <email>suresh.krishnan@gmail.com</email>
      </address>
    </author>
    <date year="2026" month="March"/>
    <abstract>
      <t>
This document specifies a Agent-to-Agent communication framework enabling structured, low-latency, and semantically rich communication between autonomous agents over the Media over QUIC (MoQ) protocol. 
It leverages MoQ's efficient media transport capabilities while introducing a new application-layer framing mechanism to support control signaling, session management, and large data fragmentation. 
The design supports both intra-domain and inter-domain deployment, with an emphasis on interoperability, extensibility, and minimal overhead.
      </t>
    </abstract>
  </front>
  <middle>
    <section title="Introduction">
      <t>
The multimodal capabilities of AI Agents, has created a need for a real-time communication framework that supports both media streaming and structured control 
signaling. Existing protocols such as HTTP/2, gRPC, either suffer from head-of-line blocking or lack native support for real-time media and bidirectional streaming.
      </t>
      <t>
Media over QUIC (MoQ) offers a compelling transport foundation with its low-latency, multiplexed, and connection-robust design. 
However, MoQ is originally optimized for media delivery and lacks native semantics for agent-to-agent control, session establishment, and structured data exchange.
      </t>
      <t>
This document proposes an application-layer protocol framework that operates over MoQ. It introduces:
      </t>
      <ul spacing="normal">
        <li>A binary framing structure to carry both control and media payloads.</li>
        <li>A session management mechanism for multi-turn agent dialogues.</li>
        <li>Strategies for fragmenting large control signals with partial reliability.</li>
        <li>Support for both MoQ domain-local and internet-wide communication.</li>
      </ul>
      <t>
The proposed framework is designed to be minimal, modular, and compatible with existing MoQ implementations. 
It does not modify MoQ's transport semantics but instead defines a new application-layer envelope that can be carried within MoQ Objects or Datagrams.
      </t>
    </section>
    <section title="Requirements and Terminology">
      <t>
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in <xref target="RFC2119"/>.
      </t>
      <dl>
        <dt>MoQ:</dt>
        <dd>Media over QUIC, a protocol for real-time media delivery.</dd>
        <dt>Agent:</dt>
        <dd>An autonomous entity capable of sending and receiving structured commands and media.</dd>
        <dt>Session:</dt>
        <dd>A logical dialogue between two agents, identified by a Session ID.</dd>
        <dt>Frame:</dt>
        <dd>The basic unit of agent to agent communication, consisting of a header and payload.</dd>
      </dl>
    </section>
    <section title="Architecture Overview">
      <t>
Agent Protocol over MoQ operates as an application-layer protocol on top of MoQ. The protocol stack is illustrated below:
      </t>
      <figure>
        <name>Protocol Stack of Agent Protocol over MoQ</name>
        <artwork align="center"><![CDATA[
+-------------------------------------------------------------+
|     Agent to Agent Communication - Application Logic        |
|  (Agent Reasoning, Command Execution, Media Processing)     |
+-------------------------------------------------------------+
                              |
                              v
+-------------------------------------------------------------+
|                                                             |
|   Agent Protocol over MoQ Frame Layer (Header + Payload)    |
|                                                             |
|  +-------------------+  +-------------------------------+   |
|  |   Frame Header    |  |       Frame Payload           |   |
|  | - Magic Number    |  | - CMD (JSON)                  |   |
|  | - Version         |  | - DATA (Binary chunks)        |   |
|  | - Message Type    |  | - STREAM (Media samples)      |   |
|  | - Session ID      |  | - HEARTBEAT (Empty)           |   |
|  | - Stream ID       |  |                               |   |
|  | - Flags           |  |                               |   |
|  | - Payload Length  |  |                               |   |
|  +-------------------+  +-------------------------------+   |
+-------------------------------------------------------------+
                              |
                              v
+-------------------------------------------------------------+
|              Media Transport Layer (MoQ)                    |
|                                                             |
|   Track Management  |  Group/Object  |  Datagram Support    |
|   Subscribe/Publish |  Prioritization|  Low-latency         |
+-------------------------------------------------------------+
                              |
                              v
+-------------------------------------------------------------+
|                  Transport Layer (QUIC)                     |
|                                                             |
|   UDP-based  |  0-RTT Handshake  |  Stream Multiplexing     |
|   TLS 1.3    |  Loss Recovery    |  Flow Control            |
+-------------------------------------------------------------+
        ]]></artwork>
      </figure>
      <t>
The stack consists of four main layers:
      </t>
      <ul spacing="normal">
        <li>Transport Layer (QUIC): Provides UDP-based, low-latency transport with built-in encryption (TLS 1.3), 0-RTT connection establishment, stream multiplexing, and congestion control.</li>
        <li>Media Transport Layer (MoQ): Handles track-based pub/sub, group and object organization, priority management, and datagram support for real-time media delivery.</li>
        <li>Application Framing Layer: Defines the Agent Protocol over MoQ binary frame structure with fixed header fields and variable payload, enabling efficient encapsulation of different message types.</li>
        <li>Application Logic: Implements agent-specific functionality including reasoning engines, command interpretation, media processing, and business logic.</li>
      </ul>
      <t>
Agents establish a MoQ session (via WebTransport or native QUIC client) and use one or more Tracks for communication. Each agent-to-agent message is encapsulated in a binary frame before being sent as a MoQ Object or Datagram. The framing layer provides session management, fragmentation support, and extensibility through version and flag fields.
      </t>
    </section>
    <section title="Agent to Agent Communication Frame Structure">
      <t>
The Agent to Agent Communication frame is a binary structure designed for efficiency and extensibility. 
It consists of a fixed-length header and a variable-length payload.
      </t>
      <section title="Frame Header Format">
        <table>
          <thead>
            <tr>
              <th align="left">Field</th>
              <th align="center">Length (bytes)</th>
              <th align="left">Description</th>
              <th align="left">MoQ Mapping</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left">Magic Number</td>
              <td align="center">2</td>
              <td align="left">Identifier: 0xA2A2</td>
              <td align="left">Detects agent-to-agent traffic</td>
            </tr>
            <tr>
              <td align="left">Version</td>
              <td align="center">1</td>
              <td align="left">Protocol version (e.g., 0x01)</td>
              <td align="left">Forward compatibility</td>
            </tr>
            <tr>
              <td align="left">Msg Type</td>
              <td align="center">1</td>
              <td align="left">Message type: CMD(0x01), DATA(0x02), STREAM(0x03), HEARTBEAT(0x04)</td>
              <td align="left">Route to handler</td>
            </tr>
            <tr>
              <td align="left">Session ID</td>
              <td align="center">8</td>
              <td align="left">Unique session identifier (UUIDv7 or hash)</td>
              <td align="left">Correlate multi-turn dialogues</td>
            </tr>
            <tr>
              <td align="left">Stream ID</td>
              <td align="center">4</td>
              <td align="left">Identifier for fragmented streams</td>
              <td align="left">Reassemble large data</td>
            </tr>
            <tr>
              <td align="left">Flags</td>
              <td align="center">1</td>
              <td align="left">Bitmask: compressed(0x01), encrypted(0x02), fragmented(0x04)</td>
              <td align="left">Processing hints</td>
            </tr>
            <tr>
              <td align="left">Payload Len</td>
              <td align="center">4</td>
              <td align="left">Length of the following payload</td>
              <td align="left">Parse boundary</td>
            </tr>
          </tbody>
        </table>
      </section>
      <section title="Frame Payload">
        <t>
The payload is interpreted based on the Msg Type and Flags:
        </t>
        <ul>
          <li>CMD: JSON or MessagePack-encoded command structure.</li>
          <li>DATA: Raw binary chunk of a large file or buffer.</li>
          <li>STREAM: Raw media sample or simplified RTP-like header + frame.</li>
          <li>HEARTBEAT: Empty payload; used for liveness detection.</li>
        </ul>
      </section>
      <section title="Message Encoding Formats">
        <t>
Agent Protocol over MoQ uses JSON (JavaScript Object Notation) as the standard encoding format for structured message content:
        </t>
        
        <section title="JSON Encoding">
          <t>
JSON (JavaScript Object Notation) is used for all CMD and control messages:
          </t>
          <ul>
            <li><strong>Human-readable</strong> and widely supported across programming languages</li>
            <li><strong>Self-describing</strong> with key-value pairs</li>
            <li><strong>Schema-flexible</strong> allowing dynamic field addition</li>
            <li><strong>Standard library support</strong> in most modern languages</li>
          </ul>
          <t>
Example CMD message in JSON:
          </t>
          <figure>
            <artwork align="left"><![CDATA[{
  "action": "session_init",
  "session_id": "abc-123-def-456",
  "auth_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "capabilities": {
    "media_types": ["video/h264", "audio/opus"],
    "max_fragment_size": 1400
  }
}]]></artwork>
          </figure>
        </section>
        
        <section title="Binary Encoding for STREAM and DATA">
          <t>
Media streams and large data payloads use raw binary encoding:
          </t>
          <ul>
            <li><strong>STREAM messages</strong>: Raw media samples (H.264, Opus, etc.) without additional encoding overhead</li>
            <li><strong>DATA messages</strong>: Raw binary chunks for file transfers and large payloads</li>
            <li><strong>Maximum efficiency</strong> for bandwidth-constrained scenarios</li>
          </ul>
        </section>
      </section>
      <section title="Message Type Details">
        <t>
Each message type has specific field requirements and processing rules:
        </t>
        
        <section title="CMD Message Format">
          <t>
CMD messages carry structured commands encoded in JSON. In addition to session management commands, CMD messages include specific actions for subscription management in pub/sub scenarios.
          </t>
          <table>
            <thead>
              <tr>
                <th align="left">Field</th>
                <th align="left">Type</th>
                <th align="left">Required</th>
                <th align="left">Description</th>
                <th align="left">Example</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td align="left">action</td>
                <td align="left">String</td>
                <td align="left">Yes</td>
                <td align="left">Command identifier</td>
                <td align="left">"session_init", "session_ack", "subscribe_request", "unsubscribe_request", "track_ready"</td>
              </tr>
              <tr>
                <td align="left">session_id</td>
                <td align="left">String/UUID</td>
                <td align="left">Yes (for session cmds)</td>
                <td align="left">Session identifier</td>
                <td align="left">"abc-123-def-456"</td>
              </tr>
              <tr>
                <td align="left">auth_token</td>
                <td align="left">String</td>
                <td align="left">Yes (for session_init)</td>
                <td align="left">JWT with operation claim</td>
                <td align="left">"eyJhbGciOiJIUzI1NiIsIn..."</td>
              </tr>
              <tr>
                <td align="left">status</td>
                <td align="left">String</td>
                <td align="left">No</td>
                <td align="left">Response status</td>
                <td align="left">"approved", "denied", "error"</td>
              </tr>
              <tr>
                <td align="left">error_code</td>
                <td align="left">Integer</td>
                <td align="left">No</td>
                <td align="left">Error identifier</td>
                <td align="left">401, 403, 500</td>
              </tr>
              <tr>
                <td align="left">payload</td>
                <td align="left">Any</td>
                <td align="left">No</td>
                <td align="left">Command-specific data</td>
                <td align="left">{"key": "value"}</td>
              </tr>
            </tbody>
          </table>
        </section>
        
        <section title="Subscription Management Fields">
          <t>
For subscription-related actions such as "subscribe_request" and "unsubscribe_request", CMD messages include additional fields:
          </t>
          <table>
            <thead>
              <tr>
                <th align="left">Field</th>
                <th align="left">Type</th>
                <th align="left">Required</th>
                <th align="left">Description</th>
                <th align="left">Example</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td align="left">track_name</td>
                <td align="left">String</td>
                <td align="left">Yes (for subscribe)</td>
                <td align="left">Name of the track to subscribe to</td>
                <td align="left">"agent2.session456.video"</td>
              </tr>
              <tr>
                <td align="left">quality_params</td>
                <td align="left">Object</td>
                <td align="left">No</td>
                <td align="left">Quality parameters for the subscription</td>
                <td align="left">{"resolution": "1080p", "fps": 30}</td>
              </tr>
              <tr>
                <td align="left">subscriber_id</td>
                <td align="left">String</td>
                <td align="left">Yes (for subscribe)</td>
                <td align="left">ID of the subscribing agent</td>
                <td align="left">"agent1"</td>
              </tr>
            </tbody>
          </table>
        </section>
        
        <section title="DATA Message Format">
          <t>
DATA messages carry raw binary chunks for large file transfers.
          </t>
          <table>
            <thead>
              <tr>
                <th align="left">Field</th>
                <th align="left">Type</th>
                <th align="left">Required</th>
                <th align="left">Description</th>
                <th align="left">Constraints</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td align="left">chunk_index</td>
                <td align="left">Integer</td>
                <td align="left">Yes</td>
                <td align="left">Position in sequence</td>
                <td align="left">0-based, sequential</td>
              </tr>
              <tr>
                <td align="left">total_chunks</td>
                <td align="left">Integer</td>
                <td align="left">Yes (last chunk)</td>
                <td align="left">Total number of chunks</td>
                <td align="left">Must match in all chunks</td>
              </tr>
              <tr>
                <td align="left">checksum</td>
                <td align="left">String</td>
                <td align="left">No</td>
                <td align="left">Data integrity hash</td>
                <td align="left">SHA-256 hex encoded</td>
              </tr>
              <tr>
                <td align="left">metadata</td>
                <td align="left">Object</td>
                <td align="left">No</td>
                <td align="left">File/type information</td>
                <td align="left">{"filename": "file.txt"}</td>
              </tr>
            </tbody>
          </table>
        </section>
        
        <section title="STREAM Message Format">
          <t>
STREAM messages carry media samples with optional timing information.
          </t>
          <table>
            <thead>
              <tr>
                <th align="left">Field</th>
                <th align="left">Type</th>
                <th align="left">Required</th>
                <th align="left">Description</th>
                <th align="left">Example</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td align="left">timestamp</td>
                <td align="left">Integer</td>
                <td align="left">Yes</td>
                <td align="left">Sample timestamp (ms)</td>
                <td align="left">1678901234567</td>
              </tr>
              <tr>
                <td align="left">media_type</td>
                <td align="left">String</td>
                <td align="left">Yes</td>
                <td align="left">Media content type</td>
                <td align="left">"video/h264", "audio/opus"</td>
              </tr>
              <tr>
                <td align="left">sequence_number</td>
                <td align="left">Integer</td>
                <td align="left">Yes</td>
                <td align="left">Frame sequence</td>
                <td align="left">12345</td>
              </tr>
              <tr>
                <td align="left">key_frame</td>
                <td align="left">Boolean</td>
                <td align="left">No</td>
                <td align="left">Is key frame</td>
                <td align="left">true</td>
              </tr>
              <tr>
                <td align="left">bitrate</td>
                <td align="left">Integer</td>
                <td align="left">No</td>
                <td align="left">Current bitrate (bps)</td>
                <td align="left">1000000</td>
              </tr>
            </tbody>
          </table>
        </section>
        
        <section title="HEARTBEAT Message Format">
          <t>
HEARTBEAT messages have empty payload and are used for liveness detection.
          </t>
          <table>
            <thead>
              <tr>
                <th align="left">Field</th>
                <th align="left">Value</th>
                <th align="left">Description</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td align="left">Payload Length</td>
                <td align="left">0</td>
                <td align="left">No payload data</td>
              </tr>
              <tr>
                <td align="left">Processing</td>
                <td align="left">Ack only</td>
                <td align="left">Recipient should acknowledge receipt</td>
              </tr>
            </tbody>
          </table>
        </section>
      </section>
      
      <section title="MoQ Mapping and Transport Considerations">
        <t>
Agent Protocol over MoQ frames are mapped to MoQ Objects and Datagrams based on their reliability and latency requirements:
        </t>
        <ul>
          <li><strong>CMD frames</strong>: Mapped to MoQ Objects to ensure reliable delivery of control messages. These require acknowledgment and retransmission if lost.</li>
          <li><strong>STREAM frames</strong>: Mapped to MoQ Objects by default for ordered delivery. May use MoQ Datagrams for loss-tolerant real-time streams where occasional packet loss is acceptable.</li>
          <li><strong>DATA frames</strong>: Large data chunks are mapped to MoQ Objects for reliable transfer. Small data may use MoQ Datagrams for lower latency.</li>
          <li><strong>HEARTBEAT frames</strong>: Mapped to MoQ Datagrams for efficient keep-alive functionality without requiring acknowledgments.</li>
        </ul>
        <t>
This mapping ensures that the transport characteristics of MoQ align with the application requirements of agent-to-agent communication.
        </t>
      </section>
      
      <section title="Pub/Sub Mechanism Integration">
        <t>
The MoQ pub/sub mechanism is integrated with Agent Protocol over MoQ through specific CMD message types that manage subscriptions at the application layer:
        </t>
        <ul>
          <li><strong>Subscription Requests</strong>: Agents send CMD messages with action "subscribe_request" to initiate track subscriptions.</li>
          <li><strong>Subscription Management</strong>: The "subscribe_request" includes track name, quality parameters, and authorization tokens.</li>
          <li><strong>Track Naming Convention</strong>: Track names follow the format "{agent_id}.{session_id}.{stream_type}", e.g., "agent1.abc-123-video".</li>
          <li><strong>Authorization</strong>: Subscription requests are validated against the agent's authorization token before establishing the underlying MoQ subscription.</li>
        </ul>
        <t>
This approach provides application-layer control over the underlying MoQ pub/sub mechanism, allowing fine-grained access control and session management.
        </t>
      </section>
    </section>
    <section title="Session and Communication Model">
      <t>
Agent Protocol over MoQ supports two communication modes:
      </t>
      <section title="In-Session Communication (Recommended)">
        <t>
Agents establish a session using a handshake that includes authorization verification. Once a session is established, agents can use subscription management commands to establish pub/sub relationships:
        </t>
        <ul>
          <li>Agent A obtains an authorization JWT containing an <tt>operation</tt> claim as defined in <xref target="I-D.liu-agent-operation-authorization"/>.</li>
          <li>Agent A sends a CMD frame with {action: "session_init", session_id: 0x123..., auth_token: "&lt;JWT&gt;"}.</li>
          <li>Agent B validates the JWT and verifies the operation permissions before responding.</li>
          <li>Agent B responds with CMD {action: "session_ack", session_id: 0x123..., status: "approved|denied"}.</li>
          <li>Subsequent messages use the same Session ID in the frame header.</li>
        </ul>
        <t>
The session terminates with a <strong>session_bye</strong> command or MoQ session closure.
        </t>
      </section>
      <section title="Session-Less Communication">
        <t>
For stateless interactions (e.g., heartbeat, fire-and-forget command), agents may send frames without session setup. The <strong>Session ID</strong> field is set to zero. Authorization for such interactions is typically pre-established or implicit.
        </t>
      </section>
    </section>
    <section title="Fragmentation and Large Data Handling">
      <t>
Agent Protocol over MoQ defines three strategies based on payload size:
      </t>
      <section title="Small Signals (&lt; 1400 bytes)">
        <t>
Sent as a single MoQ Datagram or Object. No application-layer fragmentation. Ideal for commands and heartbeats.
        </t>
      </section>
      <section title="Large Data (&gt; 1400 bytes)">
        <t>
Application-layer fragmentation is required:
        </t>
        <ul>
          <li>Data is split into chunks (e.g., 1400 bytes).</li>
          <li>Each chunk is encapsulated in an agent protocol over MoQ frame with the same Stream ID.</li>
          <li>The last chunk sets the fragmented flag to 0 and includes final metadata.</li>
        </ul>
        <t>
Reassembly is performed at the receiver using Stream ID and order of arrival.
        </t>
      </section>
      <section title="Streaming Media">
        <t>
Continuous media (audio/video) is sent as a sequence of agent protocol over MoQ <strong>STREAM</strong> frames. 
Each frame carries one media sample. Loss of a single frame does not block subsequent ones, leveraging MoQ's partial reliability.
        </t>
      </section>
    </section>
    <section title="Transport and Domain Considerations">
      <t>
Agent Protocol over MoQ is designed to operate in two modes:
      </t>
      <ul>
        <li>Intra-MoQ-Domain: Agents communicate within the same MoQ infrastructure (e.g., same edge cluster). Low latency, high trust. MoQ-native discovery is RECOMMENDED.</li>
        <li>Inter-Domain (Internet-wide): Agents communicate across networks. STUN/TURN/ICE MAY be used if direct QUIC path fails.</li>
      </ul>
      <t>
Agent Protocol over MoQ does not define its own discovery mechanism but RECOMMENDS integration with MoQ's track discovery or external service directories.
      </t>
    </section>
    <section title="Security Considerations">
      <t>
Agent Protocol over MoQ inherits security from the underlying transport:
      </t>
      <ul spacing="normal">
        <li>QUIC provides TLS 1.3 encryption and 0-RTT resumption.</li>
        <li>Application-layer authorization uses JWT with <tt>operation</tt> claim as defined in <xref target="I-D.liu-agent-operation-authorization"/>.</li>
        <li>Session establishment requires validation of authorization tokens before communication begins.</li>
      </ul>
      <t>
Implementations MUST validate authorization tokens before processing any agent-to-agent communication. Session IDs MUST be cryptographically random to prevent session hijacking.
      </t>
    </section>
    <section title="IANA Considerations">
      <t>
This document requests IANA to create new registries and register initial values for the Agent Protocol over MoQ.
      </t>
      
      <section title="Agent Protocol over MoQ Magic Number Registry">
        <t>
IANA is requested to create a new registry for Agent Protocol over MoQ Magic Numbers under the "Media over QUIC (MoQ)" group. The registration procedure is Standards Action as defined in <xref target="RFC8126"/>.
        </t>
        <t>
Initial registration:
        </t>
        <table>
          <thead>
            <tr>
              <th align="left">Value</th>
              <th align="left">Description</th>
              <th align="left">Reference</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left">0xA2A2</td>
              <td align="left">Agent-to-Agent Communication Frame</td>
              <td align="left">[This document]</td>
            </tr>
          </tbody>
        </table>
      </section>
      
      <section title="Agent Protocol over MoQ Version Registry">
        <t>
IANA is requested to create a new registry for Agent Protocol over MoQ Versions. The registration procedure is Standards Action.
        </t>
        <t>
Initial registration:
        </t>
        <table>
          <thead>
            <tr>
              <th align="left">Value</th>
              <th align="left">Description</th>
              <th align="left">Reference</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left">0x01</td>
              <td align="left">Agent Protocol over MoQ Version 1</td>
              <td align="left">[This document]</td>
            </tr>
          </tbody>
        </table>
        <t>
Values 0x00 and 0xFF are reserved. Values 0x02-0xFE are available for assignment.
        </t>
      </section>
      
      <section title="Agent Protocol over MoQ Message Type Registry">
        <t>
IANA is requested to create a new registry for Agent Protocol over MoQ Message Types. The registration procedure is Specification Required as defined in <xref target="RFC8126"/>.
        </t>
        <t>
Initial registrations:
        </t>
        <table>
          <thead>
            <tr>
              <th align="left">Value</th>
              <th align="left">Message Type</th>
              <th align="left">Description</th>
              <th align="left">Reference</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left">0x00</td>
              <td align="left">Reserved</td>
              <td align="left">Reserved for future use</td>
              <td align="left">[This document]</td>
            </tr>
            <tr>
              <td align="left">0x01</td>
              <td align="left">CMD</td>
              <td align="left">Command message with structured payload</td>
              <td align="left">[This document]</td>
            </tr>
            <tr>
              <td align="left">0x02</td>
              <td align="left">DATA</td>
              <td align="left">Raw binary data chunk</td>
              <td align="left">[This document]</td>
            </tr>
            <tr>
              <td align="left">0x03</td>
              <td align="left">STREAM</td>
              <td align="left">Media stream sample</td>
              <td align="left">[This document]</td>
            </tr>
            <tr>
              <td align="left">0x04</td>
              <td align="left">HEARTBEAT</td>
              <td align="left">Liveness detection message</td>
              <td align="left">[This document]</td>
            </tr>
          </tbody>
        </table>
        <t>
Values 0x05-0xFE are available for assignment. Value 0xFF is reserved.
        </t>
      </section>
      
      <section title="Agent Protocol over MoQ Frame Flags Registry">
        <t>
IANA is requested to create a new registry for Agent Protocol over MoQ Frame Flags. The registration procedure is Specification Required. Each flag is represented by a bit position (0-7).
        </t>
        <t>
Initial registrations:
        </t>
        <table>
          <thead>
            <tr>
              <th align="left">Bit</th>
              <th align="left">Flag Name</th>
              <th align="left">Description</th>
              <th align="left">Reference</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left">0</td>
              <td align="left">Compressed</td>
              <td align="left">Payload is compressed (0x01)</td>
              <td align="left">[This document]</td>
            </tr>
            <tr>
              <td align="left">1</td>
              <td align="left">Encrypted</td>
              <td align="left">Payload has application-layer encryption (0x02)</td>
              <td align="left">[This document]</td>
            </tr>
            <tr>
              <td align="left">2</td>
              <td align="left">Fragmented</td>
              <td align="left">Frame is part of a fragmented stream (0x04)</td>
              <td align="left">[This document]</td>
            </tr>
            <tr>
              <td align="left">3-7</td>
              <td align="left">Unassigned</td>
              <td align="left">Available for assignment</td>
              <td align="left">[This document]</td>
            </tr>
          </tbody>
        </table>
      </section>
      
      <section title="Well-Known URI Registration">
        <t>
IANA is requested to register a new well-known URI in the "Well-Known URIs" registry as defined in <xref target="RFC8615"/>.
        </t>
        <t>
The "/.well-known/a2a" endpoint facilitates agent discovery in inter-domain deployments. When accessed via HTTPS GET, the endpoint returns a JSON response containing the MoQ endpoint information for Agent Protocol over MoQ communication.
        </t>
        <dl>
          <dt>URI suffix:</dt>
          <dd>a2a</dd>
          <dt>Change controller:</dt>
          <dd>IETF</dd>
          <dt>Specification document:</dt>
          <dd>This document</dd>
          <dt>Related information:</dt>
          <dd>Used for WebTransport-based Agent Protocol over MoQ endpoint discovery. The endpoint returns a JSON object with the MoQ endpoint information, e.g., { "moq_endpoint": "quic://api.example.com:443" }</dd>
        </dl>
      </section>
    </section>
  </middle>
  <back>
    <references>
      <name>Normative References</name>
      <reference anchor="RFC2119">
        <front>
          <title>Key words for use in RFCs to Indicate Requirement Levels</title>
          <author fullname="S. Bradner"/>
          <date year="1997" month="March"/>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="2119"/>
      </reference>
      <reference anchor="RFC9000">
        <front>
          <title>QUIC: A UDP-Based Multiplexed and Secure Transport</title>
          <author fullname="J. Iyengar"/>
          <author fullname="M. Thomson"/>
          <date year="2021" month="May"/>
        </front>
        <seriesInfo name="RFC" value="9000"/>
      </reference>
      <reference anchor="RFC8126">
        <front>
          <title>Guidelines for Writing an IANA Considerations Section in RFCs</title>
          <author fullname="M. Cotton"/>
          <author fullname="B. Leiba"/>
          <author fullname="T. Narten"/>
          <date year="2017" month="June"/>
        </front>
        <seriesInfo name="BCP" value="26"/>
        <seriesInfo name="RFC" value="8126"/>
      </reference>
      <reference anchor="RFC8615">
        <front>
          <title>Well-Known Uniform Resource Identifiers (URIs)</title>
          <author fullname="M. Nottingham"/>
          <date year="2019" month="May"/>
        </front>
        <seriesInfo name="RFC" value="8615"/>
      </reference>
    </references>
    <references>
      <name>Informative References</name>
      <reference anchor="MOQ">
        <front>
          <title>Media over QUIC (MoQ) - Internet Draft</title>
          <author fullname="M. D. Nisancioglu"/>
          <author fullname="T. Enghardt"/>
          <author fullname="C. Perkins"/>
          <date year="2024"/>
        </front>
        <seriesInfo name="I-D" value="ietf-moq-00"/>
      </reference>
      <reference anchor="WEBTRANS">
        <front>
          <title>WebTransport over HTTP/3</title>
          <author fullname="P. Jansson"/>
          <author fullname="J. Uberti"/>
          <date year="2022" month="August"/>
        </front>
        <seriesInfo name="RFC" value="9220"/>
      </reference>
      <reference anchor="I-D.liu-agent-operation-authorization">
        <front>
          <title>Agent Operation Authorization Policy</title>
          <author fullname="Dapeng Liu"/>
          <author fullname="Hongru Zhu"/>
          <author fullname="Suresh Krishnan"/>
          <date year="2026" month="January"/>
        </front>
        <seriesInfo name="I-D" value="liu-agent-operation-authorization"/>
      </reference>
    </references>
    <section title="Appendix A: Usage Examples" anchor="appendix-examples">
      <t>
This appendix provides detailed examples of Agent Protocol over MoQ interactions based on a multimodal collaborative design scenario.
      </t>
      
      <section title="A.1 Scenario Overview">
        <t>
<strong>Agents:</strong>
        </t>
        <ul>
          <li><strong>Agent 1 (Personal Assistant):</strong> Resides on a user's smartphone.</li>
          <li><strong>Agent 2 (Professional Designer):</strong> Resides on a cloud server.</li>
        </ul>
      </section>
      
      <section title="A.2 Stateless Communication (Session-Less)">
        <t>
Used for lightweight, fire-and-forget interactions like liveness checks or simple status updates.
        </t>
        
        <section title="A.2.1 Heartbeat Interaction">
          <t>
Agent 1 sends a heartbeat to Agent 2 to maintain the MoQ track activity.
          </t>
          <figure>
            <name>Heartbeat Frame Implementation</name>
            <artwork align="left"><![CDATA[
Header:
- Magic Number: 0xA2A2
- Version: 0x01
- Msg Type: 0x04 (HEARTBEAT)
- Session ID: 0 (Stateless)
- Stream ID: 0
- Flags: 0x00
- Payload Len: 0
Payload: (Empty)
            ]]></artwork>
          </figure>
        </section>
      </section>
      
      <section title="A.3 Stateful Communication with Streaming Media">
        <t>
Used for complex dialogues requiring continuous media processing, such as real-time video analysis.
        </t>
        
        <section title="A.3.1 Real-time Video Stream for Design Feedback">
          <t>
<strong>Step 1: Session Handshake with Authorization</strong>
          </t>
          <figure>
            <name>Session Establishment Sequence</name>
            <artwork align="left"><![CDATA[
Agent 1 (Smartphone)                    Agent 2 (Cloud)
        |                                      |
        |  CMD {action:"session_init",         |
        |       session_id:"abc-123",          |
        |       auth_token:"<JWT>"}            |
        |------------------------------------->|
        |                                      |
        |  CMD {action:"session_ack",          |
        |       session_id:"abc-123",          |
        |       status:"approved"}             |
        |<-------------------------------------|
            ]]></artwork>
          </figure>
          
          <t>
<strong>Step 2: Media Streaming</strong>
          </t>
          <t>
Agent 1 captures video and sends it as STREAM frames within the established session.
          </t>
          <figure>
            <name>Video Sample Frame Implementation</name>
            <artwork align="left"><![CDATA[
Header:
- Magic Number: 0xA2A2
- Version: 0x01
- Msg Type: 0x03 (STREAM)
- Session ID: abc-123
- Flags: 0x00
- Payload Len: 1200
Payload: [Raw H.264/HEVC NAL Unit]
            ]]></artwork>
          </figure>
        </section>
        
        <section title="A.3.2 Subscription Management Example">
          <t>
<strong>Step 1: Subscription Request</strong>
          </t>
          <t>
Agent 1 wants to subscribe to Agent 2's video feed. It sends a subscription request within the established session.
          </t>
          <figure>
            <name>Subscription Request Sequence</name>
            <artwork align="left"><![CDATA[
Agent 1 (Subscriber)                    Agent 2 (Publisher)
        |                                                 |
        |  CMD {action:"subscribe_request",               |
        |       session_id:"abc-123",                     |
        |       track_name:"agent2.video.h264",           |
        |       subscriber_id:"agent1"}                   |
        |------------------------------------------------>|
        |                                                 |
        |  CMD {action:"track_ready",                     |
        |       session_id:"abc-123",                     |
        |       status:"approved",                        |
        |       track_url:"moq://track/agent2.video.h264"}|
        |<------------------------------------------------|
            ]]></artwork>
          </figure>
          
          <t>
<strong>Step 2: Media Streaming via MoQ pub/sub</strong>
          </t>
          <t>
After successful subscription negotiation via CMD messages, the actual media stream flows through the underlying MoQ pub/sub mechanism.
          </t>
        </section>
      </section>
      
      <section title="A.4 Stateful Communication with Large Data Blocks">
        <t>
Used for transferring high-resolution assets or large model weights.
        </t>
        
        <section title="A.4.1 Sending High-Res Design Assets">
          <t>
Agent 2 sends a 5MB design file back to Agent 1.
          </t>
          
          <t>
<strong>Fragmentation Strategy:</strong>
The file is split into chunks of 1400 bytes.
          </t>
          
          <figure>
            <name>First Chunk Frame</name>
            <artwork align="left"><![CDATA[
Header:
- Msg Type: 0x02 (DATA)
- Session ID: abc-123
- Stream ID: 101 (File Transfer Stream)
- Flags: 0x04 (Fragmented = 1)
- Payload Len: 1400
Payload: [First 1400 bytes of the file]
            ]]></artwork>
          </figure>
          
          <figure>
            <name>Last Chunk Frame</name>
            <artwork align="left"><![CDATA[
Header:
- Msg Type: 0x02 (DATA)
- Session ID: abc-123
- Stream ID: 101
- Flags: 0x00 (Fragmented = 0)
- Payload Len: 800
Payload: [Final 800 bytes of the file]
            ]]></artwork>
          </figure>
        </section>
      </section>
      
      <section title="A.5 Deployment Scenarios">
        
        <section title="A.5.1 Intra-Domain (Same Edge Cluster)">
          <t>
Agents are deployed in the same regional data center (e.g., Alibaba Cloud Hangzhou Region).
          </t>
          <ul>
            <li><strong>Discovery:</strong> Uses MoQ-native track discovery.</li>
            <li><strong>Latency:</strong> Extremely low (&lt; 5ms).</li>
            <li><strong>Trust:</strong> High; encryption is present but overhead is minimal due to short physical distance.</li>
          </ul>
        </section>
        
        <section title="A.5.2 Inter-Domain (Cross-Cloud Invocation)">
          <t>
Agent 1 (on Smartphone) calls Agent 2 (on Cloud).
          </t>
          <figure>
            <name>Inter-Domain Connection Flow</name>
            <artwork align="left"><![CDATA[
Agent 1 (Smartphone)  .well-known/a2a    Agent 2 (Cloud)
        |                    |                          |
        | GET https://cloud.example.com/.well-known/a2a |
        |---------------------------------------------->|
        |                    |                          |
        | { "moq_endpoint": "quic://api.cloud.example.com:443" } |
        |<----------------------------------------------|
        |                    |                          |
        | QUIC/MoQ Handshake (0-RTT)                    |
        |---------------------------------------------->|
        |                    |                          |
        | Agent Protocol over MoQ Frame                 |
        | (Session Init with Auth)                      |
        |---------------------------------------------->|
            ]]></artwork>
          </figure>
          <ul>
            <li><strong>Discovery:</strong> Uses HTTPS Well-Known URI as a bootstrap.</li>
            <li><strong>Traversal:</strong> Relies on QUIC's robustness against NAT changes.</li>
            <li><strong>Security:</strong> Inherits TLS 1.3 from QUIC; ensures end-to-end privacy across public networks.</li>
          </ul>
        </section>
      </section>
      
      <section title="A.6 Summary Table of Interaction Types">
        <table>
          <thead>
            <tr>
              <th align="left">Type</th>
              <th align="left">Session ID</th>
              <th align="left">Msg Type</th>
              <th align="left">Typical Usage</th>
              <th align="left">MoQ Mapping</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left"><strong>Session-Less</strong></td>
              <td align="left">0</td>
              <td align="left">HEARTBEAT / CMD</td>
              <td align="left">Keep-alive, Simple Queries</td>
              <td align="left">MoQ Datagram (HEARTBEAT), MoQ Object (CMD)</td>
            </tr>
            <tr>
              <td align="left"><strong>Streaming</strong></td>
              <td align="left">UUID</td>
              <td align="left">STREAM</td>
              <td align="left">Audio/Video/Sensor Stream</td>
              <td align="left">MoQ Object (Ordered Delivery), MoQ Datagram (Loss-Tolerant)</td>
            </tr>
            <tr>
              <td align="left"><strong>Bulk Data</strong></td>
              <td align="left">UUID</td>
              <td align="left">DATA</td>
              <td align="left">Large Files, Images</td>
              <td align="left">MoQ Object (Reliable), MoQ Datagram (Small Data)</td>
            </tr>
            <tr>
              <td align="left"><strong>Control</strong></td>
              <td align="left">UUID</td>
              <td align="left">CMD</td>
              <td align="left">Logic Execution, ACKs, Subscription Management</td>
              <td align="left">MoQ Object (Reliable)</td>
            </tr>
          </tbody>
        </table>
      </section>
    </section>
  </back>
</rfc>