<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude"
     ipr="trust200902"
     docName="draft-prakash-aip-00"
     category="info"
     submissionType="independent"
     xml:lang="en"
     version="3">

  <front>
    <title abbrev="AIP">Agent Identity Protocol (AIP): Verifiable Delegation for AI Agent Systems</title>

    <seriesInfo name="Internet-Draft" value="draft-prakash-aip-00"/>

    <author initials="S." surname="Prakash" fullname="Sunil Prakash">
      <organization>Independent</organization>
      <address>
        <email>sunil@sunilprakash.com</email>
        <uri>https://sunilprakash.com</uri>
      </address>
    </author>

    <date year="2026" month="March" day="27"/>

    <area>Security</area>
    <workgroup>Individual Submission</workgroup>

    <keyword>AI agents</keyword>
    <keyword>authentication</keyword>
    <keyword>delegation</keyword>
    <keyword>capability tokens</keyword>
    <keyword>MCP</keyword>
    <keyword>A2A</keyword>

    <abstract>
      <t>This document specifies the Agent Identity Protocol (AIP), a protocol
      for verifiable, delegable identity for AI agent systems. AIP introduces
      Invocation-Bound Capability Tokens (IBCTs) that bind identity,
      authorization, scope constraints, and provenance into a single
      cryptographic artifact. Two token modes are defined: a compact mode
      using JSON Web Tokens (JWT) with Ed25519 signatures for single-hop
      interactions, and a chained mode using Biscuit tokens with append-only
      blocks and Datalog policy evaluation for multi-hop delegation chains.
      Protocol bindings are specified for the Model Context Protocol (MCP),
      Agent-to-Agent Protocol (A2A), and generic HTTP APIs. The protocol
      addresses authentication gaps in current AI agent infrastructure where
      a survey of approximately 2,000 MCP servers found all lacked
      authentication.</t>
    </abstract>
  </front>

  <middle>
    <section anchor="introduction">
      <name>Introduction</name>

      <t>AI agent systems are increasingly deployed in multi-agent
      architectures where an orchestrator decomposes tasks and delegates
      subtasks to specialist agents. The protocols enabling this
      communication, notably the Model Context Protocol (MCP) and the
      Agent-to-Agent Protocol (A2A), solve the connectivity problem but
      do not solve the identity problem.</t>

      <t>MCP provides no built-in authentication layer. A2A uses
      self-declared identities with no attestation mechanism. OAuth 2.1,
      recently added to MCP, covers single-hop client-to-server
      authentication but does not address multi-hop delegation chains.
      When an orchestrator delegates to a specialist that calls a tool,
      the delegation chain that led to the tool invocation is lost.</t>

      <t>AIP fills this gap by introducing Invocation-Bound Capability
      Tokens (IBCTs) that answer four questions for every agent action:
      who authorized this action, through which delegation chain, with
      what constraints at each hop, and what was the outcome.</t>

      <section anchor="requirements-language">
        <name>Requirements Language</name>
        <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL",
        "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT
        RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
        interpreted as described in BCP 14 <xref target="RFC2119"/>
        <xref target="RFC8174"/> when, and only when, they appear in
        all capitals, as shown here.</t>
      </section>
    </section>

    <section anchor="identity-scheme">
      <name>Identity Scheme</name>

      <t>AIP defines two identifier schemes for agent identity:</t>

      <section anchor="dns-based">
        <name>DNS-Based Identifiers</name>
        <t>DNS-based identifiers follow the format:</t>
        <artwork><![CDATA[
aip:web:<domain>/<path>
        ]]></artwork>
        <t>Example: aip:web:example.com/agents/research-analyst</t>
        <t>DNS-based identifiers are suitable for long-lived agents with
        stable domain ownership. Identity documents are resolved via HTTPS
        at a well-known path.</t>
      </section>

      <section anchor="self-certifying">
        <name>Self-Certifying Identifiers</name>
        <artwork><![CDATA[
aip:key:ed25519:<multibase-encoded-public-key>
        ]]></artwork>
        <t>Self-certifying identifiers derive identity from the public key
        itself. They are suitable for ephemeral agents that do not require
        DNS infrastructure. The identifier is deterministically computed
        from the Ed25519 public key using multibase encoding.</t>
      </section>

      <section anchor="identity-document">
        <name>Identity Document</name>
        <t>Each agent with a DNS-based identifier MUST publish an identity
        document at:</t>
        <artwork><![CDATA[
https://<domain>/.well-known/aip/<path>.json
        ]]></artwork>
        <t>The identity document is a JSON object containing:</t>
        <ul>
          <li><tt>aip</tt>: Protocol version (MUST be "1.0")</li>
          <li><tt>id</tt>: The agent's AIP identifier</li>
          <li><tt>public_keys</tt>: Array of public key objects with validity windows</li>
          <li><tt>name</tt>: Human-readable agent name</li>
          <li><tt>delegation</tt>: Delegation preferences</li>
          <li><tt>protocols</tt>: Supported protocol bindings</li>
          <li><tt>document_signature</tt>: Ed25519 signature over the canonicalized document</li>
          <li><tt>expires</tt>: Document expiration timestamp</li>
        </ul>
        <t>The document MUST be self-signed. Verification uses
        JSON Canonicalization Scheme (JCS) <xref target="RFC8785"/>:
        remove the document_signature
        field, canonicalize the remaining JSON, and verify the Ed25519
        signature against a currently-valid public key.</t>
      </section>
    </section>

    <section anchor="token-formats">
      <name>Token Formats</name>

      <t>AIP defines two token modes that share a common identity scheme
      but differ in delegation capability.</t>

      <section anchor="compact-mode">
        <name>Compact Mode (JWT)</name>
        <t>Compact mode tokens are JSON Web Tokens <xref target="RFC7519"/>
        signed with Ed25519 (EdDSA). They support single-hop interactions
        only.</t>
        <t>Header:</t>
        <artwork><![CDATA[
{"alg": "EdDSA", "typ": "aip+jwt"}
        ]]></artwork>
        <t>Claims:</t>
        <ul>
          <li><tt>iss</tt>: Issuer AIP identifier (REQUIRED)</li>
          <li><tt>sub</tt>: Subject/holder AIP identifier (REQUIRED)</li>
          <li><tt>scope</tt>: Array of authorized capabilities (REQUIRED)</li>
          <li><tt>budget_usd</tt>: Authorization budget ceiling in USD (REQUIRED)</li>
          <li><tt>max_depth</tt>: Maximum delegation depth, 0 for no further delegation (REQUIRED)</li>
          <li><tt>iat</tt>: Issued-at timestamp (REQUIRED)</li>
          <li><tt>exp</tt>: Expiration timestamp (REQUIRED)</li>
        </ul>
        <t>Token lifetime SHOULD be less than one hour. Both iss and sub
        MUST be valid AIP identifiers.</t>
      </section>

      <section anchor="chained-mode">
        <name>Chained Mode (Biscuit)</name>
        <t>Chained mode tokens use Biscuit <xref target="BISCUIT"/>
        tokens with append-only blocks and Datalog policy evaluation. They support multi-hop delegation
        with cryptographic scope attenuation.</t>
        <t>A chained token consists of ordered blocks:</t>
        <ul>
          <li>Block 0 (Authority): Root identity, initial capabilities,
          budget, max_depth, expiration. Signed by the root authority.</li>
          <li>Blocks 1..N-1 (Delegation): Each block narrows scope. Contains
          delegator, delegate, attenuated capabilities (as Biscuit right facts),
          attenuated budget, and a non-empty context field. Signed by the
          delegator.</li>
          <li>Block N (Completion, optional): Execution outcome. Contains
          status, result_hash (SHA-256), verification_status, and optional
          resource usage metrics. Signed by the executing agent.</li>
        </ul>
      </section>

      <section anchor="scope-attenuation">
        <name>Scope Attenuation</name>
        <t>Scope attenuation is a fundamental security property of AIP. At
        each delegation step, scope can only narrow or remain equal, never
        widen. This applies across four dimensions:</t>
        <ul>
          <li>Tools: Child scope MUST be a subset of parent scope</li>
          <li>Budget: Child budget MUST be less than or equal to parent budget</li>
          <li>Domains: Child domains MUST be a subset of parent domains</li>
          <li>Time: Child expiration MUST be less than or equal to parent expiration</li>
        </ul>
        <t>Verifiers MUST check attenuation at every hop in the delegation
        chain. A wildcard (*) in the parent permits any specific value in
        the child, but a specific value in the parent MUST NOT widen to a
        wildcard in the child.</t>
      </section>

      <section anchor="policy-profiles">
        <name>Policy Profiles</name>
        <t>Chained mode tokens support three policy profiles of increasing
        expressiveness:</t>
        <ul>
          <li>Simple: Templated rules requiring no Datalog knowledge. The
          library generates canonical Datalog for tool allowlists, budget
          ceilings, delegation depth, and time expiry.</li>
          <li>Standard: Curated Datalog subset without recursion and with
          bounded evaluation.</li>
          <li>Advanced: Full Datalog with a maximum 1000 iteration limit.
          Opt-in only.</li>
        </ul>
      </section>

      <section anchor="budget-semantics">
        <name>Budget Semantics</name>
        <t>Budget values in AIP tokens represent per-token authorization
        ceilings, NOT running balances. A delegator asserts "I authorize up
        to $X for this task" at delegation time. The verifier checks that
        the budget is non-negative but does NOT track cumulative spending.
        Aggregate budget enforcement is the responsibility of the
        orchestration platform at runtime. Completion blocks record actual
        cost_usd for audit purposes.</t>
      </section>
    </section>

    <section anchor="protocol-bindings">
      <name>Protocol Bindings</name>

      <section anchor="mcp-binding">
        <name>MCP Binding</name>
        <t>AIP tokens are transported in MCP via the X-AIP-Token HTTP header:</t>
        <artwork><![CDATA[
X-AIP-Token: <compact-or-chained-token>
        ]]></artwork>
        <t>For tokens exceeding 4KB, token-by-reference is supported:</t>
        <artwork><![CDATA[
X-AIP-Token-Ref: https://issuer/.well-known/aip/tokens/<id>
        ]]></artwork>
        <t>MCP servers verify tokens in five steps: (1) extract token,
        (2) verify signatures against issuer identity document, (3) check
        requested tool against token scope, (4) validate chain constraints
        for chained tokens, (5) inject verified identity into request
        context.</t>
        <t>Nine error codes are defined with appropriate HTTP status
        mappings: 401 for authentication failures (token_missing,
        token_malformed, signature_invalid, identity_unresolvable,
        token_expired, key_revoked) and 403 for authorization failures
        (scope_insufficient, budget_exceeded, depth_exceeded).</t>
        <t>Servers declare AIP requirements via the require_aip field
        in their identity document's protocols.mcp configuration.</t>
      </section>

      <section anchor="a2a-binding">
        <name>A2A Binding</name>
        <t>In A2A interactions, AIP tokens are transported in the
        metadata.aip_token field of task submissions. Agent cards are
        extended with an aip_identity object containing the agent's AIP
        identifier and document URL.</t>
        <t>The A2A verification flow adds a sixth step: the calling agent
        appends a delegation block with attenuated scope before sending
        the task, and the receiving agent verifies that the final
        delegation block delegates to its own AIP identifier.</t>
      </section>

      <section anchor="http-binding">
        <name>HTTP Binding</name>
        <t>For generic HTTP APIs not using MCP or A2A, tokens are
        transported via the Authorization header with the AIP scheme:</t>
        <artwork><![CDATA[
Authorization: AIP <base64url-encoded-token>
        ]]></artwork>
        <t>Token-by-reference uses the X-AIP-Token-Ref header with a
        5-second fetch timeout and SSRF protection (reject reference URLs
        outside expected domain patterns).</t>
      </section>
    </section>

    <section anchor="delegation-lifecycle">
      <name>Delegation Lifecycle</name>

      <section anchor="bounded-depth">
        <name>Bounded Depth</name>
        <t>Block 0 declares max_depth (default: 3). Each delegation block
        increments effective depth by 1. If current depth equals max_depth,
        further delegation is forbidden. In compact mode, max_depth of 0
        means the holder MUST NOT delegate further.</t>
      </section>

      <section anchor="delegation-context">
        <name>Delegation Context</name>
        <t>Each delegation block MUST include a non-empty context field
        containing a human-readable description of the delegation purpose.
        Verifiers MUST reject tokens with missing or empty context. This
        requirement ensures audit trail integrity.</t>
      </section>

      <section anchor="ephemeral-agents">
        <name>Ephemeral Agent Grants</name>
        <t>For short-lived sub-agents, a parent agent generates an Ed25519
        keypair, creates an aip:key: identifier, and appends a delegation
        block with scoped capabilities and a short TTL (5 minutes
        RECOMMENDED). The parent's identity document MAY set
        delegation.allow_ephemeral_grants to false to prevent this.</t>
      </section>

      <section anchor="key-rotation">
        <name>Key Rotation</name>
        <t>DNS-based identifiers support zero-downtime key rotation through
        overlapping validity windows on public keys. A new key is published
        with a future valid_from timestamp. Both keys are valid during the
        overlap period. Recommended rotation period is 90 days. Cache TTL
        MUST NOT exceed 5 minutes.</t>
        <t>Self-certifying identifiers cannot rotate keys; key rotation
        requires identity replacement, which is acceptable for ephemeral
        agents.</t>
      </section>

      <section anchor="revocation">
        <name>Revocation</name>
        <t>AIP prefers short-lived tokens over revocation infrastructure.
        Compact mode tokens SHOULD have a TTL under 1 hour, making
        revocation generally unnecessary. For chained mode, key revocation
        (removing a key from the identity document) invalidates all tokens
        signed by that key. Token-specific revocation via Certificate
        Revocation Lists is deferred to v2.</t>
      </section>
    </section>

    <section anchor="provenance">
      <name>Provenance and Audit</name>

      <section anchor="completion-blocks">
        <name>Completion Blocks</name>
        <t>A completion block is the final block in a chained token,
        signed by the executing agent. It contains:</t>
        <ul>
          <li><tt>status</tt>: REQUIRED. One of "completed", "failed", or "partial".</li>
          <li><tt>result_hash</tt>: REQUIRED. SHA-256 hash of the output in format "sha256:&lt;hex&gt;".</li>
          <li><tt>verification_status</tt>: REQUIRED. One of "self_reported", "tool_verified", "peer_verified", or "human_verified".</li>
          <li><tt>tokens_used</tt>: OPTIONAL. LLM tokens consumed.</li>
          <li><tt>cost_usd</tt>: OPTIONAL. Actual cost incurred.</li>
          <li><tt>duration_ms</tt>: OPTIONAL. Wall-clock execution time.</li>
          <li><tt>ldp_provenance_id</tt>: OPTIONAL. Back-link to LDP provenance record.</li>
        </ul>
      </section>

      <section anchor="trust-levels">
        <name>Verification Trust Levels</name>
        <t>AIP defines three escalating trust levels for completion data:</t>
        <ul>
          <li>Level 1 (Self-Reported): Agent reports its own results with
          no independent verification. Default for trusted environments.</li>
          <li>Level 2 (Counter-Signed): Delegator independently verifies
          the result and appends a verification block.</li>
          <li>Level 3 (Third-Party Attested): External verifier (LDP peer,
          human reviewer, or audit service) signs an attestation block.</li>
        </ul>
      </section>

      <section anchor="audit-tokens">
        <name>Audit Tokens</name>
        <t>A completed chained token with a completion block appended is
        a self-contained audit artifact. It answers five questions without
        requiring an external database: who authorized (Block 0), through
        whom (delegation blocks), what constraints (Datalog policies),
        what happened (completion block), and whether it was verified
        (verification_status). Audit tokens are tamper-evident,
        non-repudiable, and verifiable offline using public keys from
        identity documents.</t>
      </section>
    </section>

    <section anchor="security-considerations">
      <name>Security Considerations</name>

      <t>This section addresses the security properties and threat model
      for AIP.</t>

      <section anchor="threat-model">
        <name>Threat Model</name>
        <t>AIP is designed to resist the following attack categories:</t>
        <ul>
          <li>Scope widening: An agent attempts to exceed its delegated
          capabilities. Prevented by cryptographic scope attenuation
          verification at each hop.</li>
          <li>Delegation depth violation: An agent attempts to delegate
          beyond the maximum permitted depth. Prevented by depth tracking
          in each delegation block.</li>
          <li>Token replay: A captured token is reused. Mitigated by
          short TTLs (under 1 hour recommended for compact mode).</li>
          <li>Token forgery: An attacker constructs a token without
          holding the private key. Prevented by Ed25519 signature
          verification.</li>
          <li>Identity spoofing: An agent claims a false identity.
          Prevented by identity document resolution and signature
          verification.</li>
          <li>Audit evasion: An agent delegates with empty context to
          avoid audit trails. Prevented by mandatory non-empty context
          on all delegation blocks.</li>
        </ul>
      </section>

      <section anchor="adversarial-evaluation">
        <name>Adversarial Evaluation</name>
        <t>Experimental evaluation across 600 adversarial attempts in six
        attack categories showed a 100% rejection rate. Two attack
        categories (delegation depth violation and audit evasion through
        empty context) are uniquely addressed by AIP's chained token
        structure and cannot be detected by standard JWT deployments.
        Details are reported in the companion paper
        <xref target="AIP-PAPER"/>.</t>
      </section>

      <section anchor="crypto-agility">
        <name>Cryptographic Agility</name>
        <t>AIP v1 mandates Ed25519 exclusively. No algorithm negotiation
        is supported. This is a deliberate design choice to eliminate
        downgrade attacks and reduce implementation complexity. Future
        versions MAY introduce additional algorithms through the protocol
        version field.</t>
      </section>

      <section anchor="transport-security">
        <name>Transport Security</name>
        <t>Identity document resolution and token-by-reference fetching
        MUST use HTTPS. Implementations SHOULD enforce TLS 1.3 or later.
        Token-by-reference URLs MUST be validated against expected domain
        patterns to prevent SSRF attacks. Fetch timeout SHOULD be 5
        seconds.</t>
      </section>
    </section>

    <section anchor="iana-considerations">
      <name>IANA Considerations</name>

      <t>This document requests the following IANA registrations:</t>

      <section anchor="iana-auth-scheme">
        <name>HTTP Authentication Scheme</name>
        <t>Registration of the "AIP" HTTP authentication scheme in the
        "HTTP Authentication Scheme Registry":</t>
        <ul>
          <li>Authentication Scheme Name: AIP</li>
          <li>Reference: This document, <xref target="http-binding"/></li>
        </ul>
      </section>

      <section anchor="iana-well-known">
        <name>Well-Known URI</name>
        <t>Registration of the "aip" well-known URI suffix in the
        "Well-Known URIs" registry:</t>
        <ul>
          <li>URI Suffix: aip</li>
          <li>Change Controller: IETF</li>
          <li>Reference: This document, <xref target="identity-document"/></li>
        </ul>
      </section>

      <section anchor="iana-media-type">
        <name>Media Type</name>
        <t>Registration of the "aip+jwt" structured syntax suffix:</t>
        <ul>
          <li>Type name: application</li>
          <li>Subtype name: aip+jwt</li>
          <li>Reference: This document, <xref target="compact-mode"/></li>
        </ul>
      </section>
    </section>
  </middle>

  <back>
    <references>
      <name>References</name>

      <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" fullname="S. Bradner"/>
            <date year="1997" month="March"/>
          </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="2119"/>
        </reference>

        <reference anchor="RFC7519" target="https://www.rfc-editor.org/info/rfc7519">
          <front>
            <title>JSON Web Token (JWT)</title>
            <author initials="M." surname="Jones" fullname="M. Jones"/>
            <author initials="J." surname="Bradley" fullname="J. Bradley"/>
            <author initials="N." surname="Sakimura" fullname="N. Sakimura"/>
            <date year="2015" month="May"/>
          </front>
          <seriesInfo name="RFC" value="7519"/>
        </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" fullname="B. Leiba"/>
            <date year="2017" month="May"/>
          </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="8174"/>
        </reference>

        <reference anchor="RFC8785" target="https://www.rfc-editor.org/info/rfc8785">
          <front>
            <title>JSON Canonicalization Scheme (JCS)</title>
            <author initials="A." surname="Rundgren" fullname="A. Rundgren"/>
            <author initials="B." surname="Jordan" fullname="B. Jordan"/>
            <author initials="S." surname="Erdtman" fullname="S. Erdtman"/>
            <date year="2020" month="June"/>
          </front>
          <seriesInfo name="RFC" value="8785"/>
        </reference>
      </references>

      <references>
        <name>Informative References</name>

        <reference anchor="BISCUIT" target="https://www.biscuitsec.org/">
          <front>
            <title>Biscuit Authorization Token</title>
            <author initials="G." surname="Music" fullname="Geoffrey Music"/>
            <date year="2024"/>
          </front>
        </reference>

        <reference anchor="AIP-PAPER" target="https://arxiv.org/abs/2603.24775">
          <front>
            <title>AIP: Agent Identity Protocol for Verifiable Delegation Across MCP and A2A</title>
            <author initials="S." surname="Prakash" fullname="Sunil Prakash"/>
            <date year="2026" month="March" day="27"/>
          </front>
        </reference>
      </references>
    </references>

    <section anchor="acknowledgements" numbered="false">
      <name>Acknowledgements</name>
      <t>The Biscuit authorization token specification influenced the
      chained mode design. The MCP and A2A protocol teams provided the
      agent communication infrastructure that AIP extends.</t>
    </section>
  </back>
</rfc>
