<?xml version="1.0" encoding="UTF-8"?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude"
     ipr="trust200902"
     submissionType="independent"
     category="exp"
     docName="draft-sogomonian-aiip-architecture-03"
     version="3"
     sortRefs="true"
     symRefs="true"
     tocInclude="true"
     tocDepth="4">

  <front>
    <title abbrev="AIIP Architecture">Architecture for the Artificial Intelligence Internet Protocol (AIIP)</title>

    <author fullname="Aram Sogomonian" initials="A." surname="Sogomonian">
      <organization>Artificial Intelligence Internet Foundation (AIIF)</organization>
      <address>
        <postal>
          <country>US</country>
        </postal>
        <email>aiinternetfoundation@icloud.com</email>
      </address>
    </author>

    <date year="2025" month="December" day="14"/>

    <area>Internet</area>
    <workgroup>Independent Submission</workgroup>

    <abstract>
      <t>
        This document defines the architectural model for the Artificial Intelligence Internet
        Protocol (AIIP), including decentralized discovery and a byte-precise native envelope.
        AIIP enables stateless, verifiable invocation of autonomous systems using a
        resolve-invoke-receipt pattern over authenticated transports. Native AIIP is the default for
        machine-to-machine operation; HTTPS gateways are optional for human-facing access. Each
        invocation produces a cryptographically verifiable execution receipt, optionally including
        attestation evidence.
      </t>
    </abstract>

    <note>
      <name>Note</name>
      <t>Work in Progress.</t>
    </note>
  </front>

  <middle>

    <section anchor="intro" numbered="true">
      <name>Introduction</name>
      <t>
        AIIP provides a uniform address space and invocation model for AI resources with verifiable
        outcomes. The architecture follows a resolve-invoke-receipt pattern.
      </t>
      <t>
        Autonomous systems communicate natively using AIIP envelopes over authenticated transports.
        Human operators and supervisory systems can access AIIP resources via HTTPS gateways for
        compatibility with Web-based tools.
      </t>
      <t>
        This revision adds discovery metadata (DNS bootstrap plus HTTPS well-known) and an autonomous
        delegation use case.
      </t>
      <t>
        The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;,
        &quot;SHALL NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;,
        &quot;MAY&quot;, and &quot;OPTIONAL&quot; in this document are to be interpreted as described in
        <xref target="RFC2119"/> and <xref target="RFC8174"/>.
      </t>
    </section>

    <section anchor="overview" numbered="true">
      <name>Architectural Overview</name>
      <t>
        AIIP separates addressing, invocation, and verification into distinct steps:
        (1) discovery and resolution provide invocation metadata;
        (2) invocation is carried in a native AIIP envelope;
        (3) the response includes an execution receipt that can be verified independently.
      </t>
    </section>

    <section anchor="native" numbered="true">
      <name>Native Autonomous Access Model</name>
      <t>
        Autonomous systems, including robots, industrial controllers, agents, and embedded devices,
        use AIIP natively. In native mode, AIIP envelopes are exchanged directly between client and
        resource over an authenticated transport such as mutual TLS or QUIC.
      </t>
      <t>
        Native AIIP invocation does not depend on HTTP semantics, cookies, or browser-originated
        state. Authorization, policy enforcement, and result verification are defined by AIIP.
      </t>
      <t>
        Human operators and management interfaces typically interact with AIIP resources through HTTPS
        gateways. These gateways provide compatibility with Web-based clients but are not required for
        autonomous operation.
      </t>
    </section>

    <section anchor="discovery" numbered="true">
      <name>Discovery and Delegation Metadata</name>
      <t>
        AIIP supports decentralized discovery using two complementary mechanisms: DNS-based bootstrap
        discovery and HTTPS-based detailed metadata retrieval. This design avoids reliance on any
        single global resolver by allowing each administrative domain to publish its own resolution
        parameters and delegation information.
      </t>

      <section anchor="dns-bootstrap" numbered="true">
        <name>DNS Bootstrap Discovery</name>
        <t>
          For an AIIP identifier whose authority is a DNS name (for example,
          <tt>aiip://service.example/...</tt>), an implementation MAY perform bootstrap discovery by
          querying a DNS TXT record under <tt>_aiip.service.example</tt>.
        </t>
        <t>
          The TXT record value is a semicolon-separated set of key/value parameters. At a minimum,
          it SHOULD include an <tt>endpoint</tt> parameter indicating where detailed metadata can be
          retrieved.
        </t>
        <t>Example:</t>
        <sourcecode type="text"><![CDATA[
_aiip.service.example.  IN TXT  "v=aiip1; endpoint=https://service.example/.well-known/aiip"
]]></sourcecode>
        <t>
          The DNS record is intended for bootstrap only. Implementations SHOULD treat HTTPS metadata
          (Section <xref target="https-well-known"/>) as authoritative when available.
        </t>
      </section>

      <section anchor="https-well-known" numbered="true">
        <name>HTTPS Metadata Discovery</name>
        <t>
          An implementation MAY retrieve detailed AIIP metadata from the HTTPS well-known resource
          <tt>/.well-known/aiip</tt> on the authority host (see <xref target="RFC8615"/>). The
          retrieved document can provide resolver endpoints, verification keys or key references, and
          policy signals required to validate invocation metadata.
        </t>
        <t>
          The well-known document MUST be fetched over HTTPS and its authenticity and integrity MUST
          be validated using standard HTTPS server authentication.
        </t>
        <t>
          If both DNS bootstrap discovery and HTTPS metadata discovery are available, implementations
          SHOULD use the DNS record only to locate the HTTPS metadata.
        </t>
      </section>

      <section anchor="delegation-statements" numbered="true">
        <name>Delegation Statements</name>
        <t>
          Discovery metadata MAY include delegation statements allowing an administrative domain to
          delegate subsets of its AIIP namespace or specific capabilities to other parties. Clients
          and resolvers MUST validate delegation chains prior to accepting invocation metadata derived
          from delegated authority.
        </t>
      </section>
    </section>

    <section anchor="envelope" numbered="true">
      <name>Native Envelope Framing</name>
      <t>
        AIIP invocations are carried in a byte-framed envelope suitable for native machine-to-machine
        transports. The wire format defined here is transport-agnostic: authenticated transports
        provide confidentiality and channel security, while the AIIP envelope provides a stable
        framing and replay-resistant metadata.
      </t>

      <section anchor="byte-order" numbered="true">
        <name>Byte Order</name>
        <t>
          All multi-octet integer fields are encoded in network byte order (big-endian). Unless
          otherwise specified, fields are unsigned.
        </t>
      </section>

      <section anchor="header" numbered="true">
        <name>32-Byte Header</name>
        <t>
          An AIIP message is encoded as:
          <tt>Wire = Header(32) || Payload(PayloadLen) || Signature(SigLen)</tt>.
          The header is exactly 32 octets.
        </t>

        <figure anchor="fig-header">
          <name>AIIP Header Layout (32 bytes)</name>
          <artwork><![CDATA[
  0                   1                   2                   3
  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
 +-------------------------------+-------------------------------+
 |          Magic "AIIP"         | VerMaj|VerMin|   Flags (16)    |
 +-------------------------------+-------------------------------+
 |          PayloadLen (32)      |           SigLen (16)         |
 +-------------------------------+-------------------------------+
 |                         Nonce (64)                            |
 +---------------------------------------------------------------+
 |                      TimestampMs (64)                         |
 +---------------------------------------------------------------+
Bytes:  0..3   Magic (0x41 49 49 50)
        4      VerMaj (this document: 1)
        5      VerMin (this document: 0)
        6..7   Flags
        8..11  PayloadLen
        12..13 SigLen
        14..15 Rsv16 (MUST be 0)
        16..23 Nonce
        24..31 TimestampMs
          ]]></artwork>
        </figure>


        <t>
          No reserved fields exist beyond the fixed 32-byte header; the signature bytes follow the payload.
        </t>

        <t>
          Flags is a 16-bit bitmask. Bit 0 (0x0001) indicates that the requester requires a receipt
          in the response. Other bits are reserved for future use.
        </t>

        <t>Example header bytes (illustrative only):</t>
        <sourcecode type="text"><![CDATA[
41 49 49 50  01 00  00 01  00 00 00 9C  00 40  00 00
2F 7A 13 44  9B 02 5D 8A  00 00 01 93  8F 4C 3A 10
]]></sourcecode>

        <t>
          Payload is UTF-8 JSON. Binary fields (when needed) are represented using base64url strings.
        </t>
      </section>
    </section>

    <section anchor="receipts" numbered="true">
      <name>Execution Receipts</name>
      <t>
        Each successful invocation produces an execution receipt that can be verified independently
        of transport intermediaries. Receipts bind the invocation identifier, relevant policy context,
        and execution outcome.
      </t>
      <t>
        This document illustrates a JWS-based receipt container (<xref target="RFC7515"/>). The
        specific receipt schema is expected to evolve with implementation experience.
      </t>

      <t>Illustrative receipt container:</t>
      <sourcecode type="json"><![CDATA[
{
  "protected": "base64url(jws-protected-header)",
  "payload": {
    "txid": "b7f7cfd2-6c38-4d7a-8e5a-6f1e1d9e0a10",
    "ts": 1734149100000,
    "result": { "status": 200, "data_commitment": "base64url(hash)" },
    "policy": { "max_speed_mps": 0.5, "forbidden_zones": ["Z1", "Z2"] },
    "attestation": { "tee": "base64url(attestation-evidence)" }
  },
  "signature": "base64url(jws-signature)"
}
]]></sourcecode>

      <t>Receipt structure sketch (informative, ASN.1-like):</t>
      <sourcecode type="text"><![CDATA[
AIIP-Receipt ::= SEQUENCE {
  txid            UUID,
  ts              INTEGER,            -- milliseconds since epoch
  resultCommit    OCTET STRING,       -- hash/commitment
  policy          SEQUENCE OF UTF8String OPTIONAL,
  attestation     OCTET STRING OPTIONAL,
  sigAlg          OBJECT IDENTIFIER,
  signature       OCTET STRING
}
]]></sourcecode>
    </section>

    <section anchor="delegation-usecase" numbered="true">
      <name>Use Case: Autonomous Delegation</name>
      <t>
        AIIP enables explicit delegation of real-world actions to autonomous agents without
        disclosure of user credentials and without interactive authorization at execution time. A
        user may delegate a capability (for example, <tt>aiip://user.phone/call</tt>) to an AI agent
        once, under defined policy constraints.
      </t>
      <t>
        After delegation, any authorized AI agent may invoke the delegated capability directly using
        AIIP. Invocation does not require access to passwords, OAuth tokens, or user sessions. Each
        execution produces a verifiable receipt binding the user’s authorization, the invoked action,
        and the execution outcome.
      </t>
      <t>Example invocation:</t>
      <sourcecode type="text">aiip://user.phone/call?to=+15551234567&amp;text=I'm+late</sourcecode>
      <t>
        The resulting execution receipt provides non-repudiable evidence that the user authorized the
        action and that it was executed as requested. This delegation model enables autonomous agents
        to perform actions such as calls, messages, device control, or payments without exposing
        credentials or requiring repeated user interaction.
      </t>
    </section>

    <section anchor="gateway" numbered="true">
      <name>HTTPS Gateway Profile</name>
      <t>
        An HTTPS gateway translates Web-based requests into AIIP invocations and returns results with
        receipts to human-facing clients.
      </t>
      <t>
        The HTTPS gateway is a compatibility layer for human operators and MUST NOT be required for
        autonomous or machine-to-machine AIIP invocation.
      </t>
    </section>

    <section anchor="security" numbered="true">
      <name>Security Considerations</name>
      <t>
        AIIP implementations MUST authenticate peers via the selected transport binding, prevent
        replay, and ensure integrity of invocation and receipt data.
      </t>
      <t>
        Execution receipts provide non-repudiable evidence of authorization and execution, suitable
        for audit, dispute resolution, and legal review.
      </t>
    </section>

    <section anchor="privacy" numbered="true">
      <name>Privacy Considerations</name>
      <t>
        Implementations SHOULD minimize retained metadata and avoid correlating invocations beyond
        what is required for verification.
       Delegations SHOULD be scoped minimally to avoid over-exposure of capabilities or metadata.</t>
    </section>

    <section anchor="iana" numbered="true">
      <name>IANA Considerations</name>
      <t>This document makes no IANA requests. Future revisions may request registration of well-known resources used for AIIP discovery.</t>
    </section>

  </middle>

  <back>

    <references>
      <name>Normative References</name>

      <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119">
        <front>
          <title>Key words for use in RFCs to Indicate Requirement Levels</title>
          <author initials="S." surname="Bradner"/>
          <date year="1997" month="March"/>
        </front>
        <seriesInfo name="RFC" value="2119"/>
      </reference>

      <reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174">
        <front>
          <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
          <author initials="B." surname="Leiba"/>
          <date year="2017" month="May"/>
        </front>
        <seriesInfo name="RFC" value="8174"/>
      </reference>

      <reference anchor="RFC8615" target="https://www.rfc-editor.org/info/rfc8615">
        <front>
          <title>Well-Known Uniform Resource Identifiers (URIs)</title>
          <author initials="M." surname="Nottingham"/>
          <date year="2019" month="May"/>
        </front>
        <seriesInfo name="RFC" value="8615"/>
      </reference>

      <reference anchor="RFC7515" target="https://www.rfc-editor.org/info/rfc7515">
        <front>
          <title>JSON Web Signature (JWS)</title>
          <author initials="M.B." surname="Jones"/>
          <date year="2015" month="May"/>
        </front>
        <seriesInfo name="RFC" value="7515"/>
      </reference>

    </references>

    <section numbered="false">
      <name>Author's Address</name>
      <t>
        Aram Sogomonian<br/>
        Artificial Intelligence Internet Foundation (AIIF)<br/>
        United States of America<br/>
        Email:
        <eref target="mailto:aiinternetfoundation@icloud.com">aiinternetfoundation@icloud.com</eref>
      </t>
    </section>

  </back>

</rfc>
