<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc category="exp" docName="draft-song-oauth-ai-agent-authorization-00"
     ipr="trust200902">
  <front>
    <title abbrev="Abbreviated-Title">OAuth2.0 Extention for AI Agent:
    Authorization on Target</title>

    <author fullname="Yurong Song " initials="Y" surname="Song">
      <organization>Huawei</organization>

      <address>
        <email>songyurong1@huawei.com</email>
      </address>
    </author>

    <author fullname="Lun Li" initials="L" surname="Li">
      <organization>Huawei</organization>

      <address>
        <email>lilun20@huawei.com</email>
      </address>
    </author>

    <author fullname="Faye Liu" initials="F" surname="Liu">
      <organization>Huawei Singapore</organization>

      <address>
        <email>liufei19@huawei.com</email>
      </address>
    </author>

    <date day="3" month="July" year="2025"/>

    <area>Security</area>

    <workgroup>Web Authorization Protocol</workgroup>

    <keyword>OAuth</keyword>

    <abstract>
      <t>In this draft, we address to potential adapt authorization frameworks
      for the future AI agent. An extension is proposed in the OAuth 2.0
      protocol with an optional field *target_id* for granular authorization.
      It can be seen useful for the future virtual/physical AI agents. By
      explicitly identifying the target during authorization, the draft aims
      to support precise permission management and enhance traceability.
      Serveral risks can be mitigated through the proposed extension, such as
      potential unauthorized or malicious behavior of AI components in the
      netowrk, while the compatibility of existing OAuth 2.0 workflows is
      still maintained.</t>
    </abstract>

    <note title="Requirements Language">
      <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">RFC2119</xref>.</t>
    </note>
  </front>

  <middle>
    <section title="Introduction">
      <t>The rapid development of current AI agents necessitates urgent
      research in the field of AI agent security. Specifically, based on the
      analysis in <xref target="I-D.rosenberg-ai-protocols"/>, authorization
      stands as a key research direction within AI agent security, covering
      both intra-domain and inter-domain levels. It involves various scenarios
      such as AI agents accessing APIs (e.g., scenarios under the MCP
      protocol) and mutual access between AI agents (e.g., scenarios under the
      A2A protocol). However, AI agents possess the characteristics of
      autonomy, dynamics, and long-lived identities, making the direct
      application of procedures defined by existing standards (OAuth)
      significantly inadequate. What's more, as specified in the EU GDPR, data
      subjects have the right to know how their data will be used. In the
      context of authorization, the resource owner, as the provider of data,
      resources, or services to the AI agent, acts as a data subject. To
      better comply with regulation, the client should therefore disclose not
      only its own identity but also the identity of the specific AI agent
      executing the actions.</t>

      <t>Therefore, it is necessary to adapt OAuth scheme for full-scenario
      authorization of AI agents. Nevertheless, <xref
      target="I-D.oauth-ai-agents-on-behalf-of-user"/> has designed a
      user-delegated authorization mechanism for AI agents based on "actor" to
      implement user-delegated authorization for AI agents. It is observed in
      <xref target="I-D.yao-agent-auth-considerations"/> that AI agents can be
      devided into two categories: physical AI agent and vitual AI agent. This
      draft will consider the scenario where the AI agent itself acts as a
      client, which includes the following two use cases based on the
      category.</t>

      <t><list style="symbols">
          <t>Use Case 1: The user deploys an AI model on a client that acts as
          a virtual AI agent. In this case, the AI agent is a module on the
          client. For example, the client could be a smartphone, where the
          user downloads a ChatGPT model and instantiates an AI agent
          locally.</t>

          <t>Use Case 2: The client is a physical AI agent equipped with
          multiple AI models differing in functionality, versions, or vendors.
          In this case, the AI model is a module on the AI agent. For example,
          if developers provide only an AI agent framework with APIs and
          functional blocks, the user can select Model A for chatting and
          Model B for confidential work within their company, then install
          both into the agent.</t>
        </list>As previously noted, AI agents function differently from other
      modules. Once authorized by the user, an AI agent can make independent
      decisions and execute tasks automatically. While this brings convenience
      to daily life, it also introduces significant uncertainty due to
      unexplainable problem of AI. Specifically, an AI agent or AI model could
      be compromised or trained to perform harmful tasks even as other client
      modules remain unaffected -- this risk is heightened when the client and
      the AI agent or AI model originate from different providers. In such
      cases, failing to identify the specific AI agent or model involved would
      hinder root cause analysis. Moreover, authorizing at the client level
      might lead to accidental denial of authorization on the client,
      disrupting the client's normal operation.</t>

      <t>Therefore, for these use cases, authorization needs to clarify which
      specific module of the client is being authorized. This draft proposes
      an authorization mechanism centered on a *target* -- role introduced to
      identify the client module requiring authorization. To support this, an
      optional extension field named *target_id* is added to the OAuth 2.0
      protocol flow. The *target* may refer to virtual AI agents deployed on
      the client or AI models hosted on a physical AI agent.</t>

      <t>This solution clearly distinguishes between the client and its AI
      agents or models, preventing unintended disruptions. Additionally, it
      allows users to select the appropriate AI agent or AI model on the
      client to grant consent to. For example, in daily scenarios, they may
      authorize Model A, while in work scenarios, they may choose Model B in
      previous example. Furthermore, users can clearly see which AI agent or
      model is requesting permission, enabling better management of local AI
      components. For instance, if Model B requests access to the user's
      digital album, the user can reject the request and even revoke Model B's
      permission to access all files on a specific disk.</t>
    </section>

    <section title="Terminology">
      <t>Target: a module on the client that actually utilize the resource
      provided by resource owner, e.g. a virtual AI agent deployed on the
      client, or an AI model deployed on the client (physical AI agent).</t>

      <t>This draft uses the terms "authorization server", "client", "resource
      server" defined by OAuth 2.0 <xref target="RFC6749"/></t>
    </section>

    <section title="Extention of Protocol Flow">
      <t>This protocol flow is modeled after <xref target="RFC6749"/> and
      extends it with a *target_id* field to enable authorization for the
      target.</t>

      <t><figure>
          <artwork><![CDATA[     +--------+                               +---------------+
     |        |--(A)- Authorization Request ->|   Resource    |
     |        |                               |     Owner     |
     |        |<-(B)-- Authorization Grant ---|               |
     |        |                               +---------------+
     |        |
     |        |                               +---------------+
     |        |--(C)-- Authorization Grant -->| Authorization |
     | Client |         *target_id*           |     Server    |
     |        |                               |               |
     |        |<-(D)----- Access Token -------|               |
     |        |         (*tar=target_id*)     +---------------+
     |        |
     |        |                               +---------------+
     |        |--(E)----- Access Token ------>|    Resource   |
     |        |                               |     Server    |
     |        |<-(F)--- Protected Resource ---|               |
     +--------+                               +---------------+]]></artwork>
        </figure></t>

      <section title="Extension for Client Registration">
        <t>Before initiating the protocol, the client registers with the
        authorization server, as defined in <xref target="RFC6749"/>.</t>

        <t>In this draft, information about the AI agent or AI model is
        included as part of the client registration process, including details
        such as identity and capabilities. For instance, when a client
        registers using a profile, if it is deployed with an AI agent or AI
        model, the profile will incorporate relevant information about them.
        Additionally, the client itself maintains awareness of the AI agent or
        AI model information.</t>
      </section>

      <section title="Authorization Request &amp; Response">
        <t>At first the client requests authorization from the resource owner
        and receives an authorization grant, as defined in <xref
        target="RFC6749"/>.</t>

        <t>When the client needs to execute a task, it selects the AI agent or
        AI model capable of performing the task. Selection methods may
        include:</t>

        <t><list style="symbols">
            <t>Semantic matching based on the capabilities of the AI agent or
            AI model and the task description. The task description may be
            received from other entities or determined by the client. For
            example, if a model's capability is "image recognition" and the
            task description is "identify geographical location from an
            image", a match is established.</t>

            <t>Selecting an available AI agent or model based on operational
            status. For example, both Model A and Model B support image
            recognition, but Model A is in use while Model B is idle, so Model
            B is chosen.</t>

            <t>Choosing the appropriate AI agent or AI model based on the
            availability of computing resources and the resource consumption
            of each option.</t>

            <t>The client acts as an "entry point" to uniformly receive user
            requirements and then internally selects models according to
            preset rules. For instance, after the user authorizes the "office
            scenario," the client automatically selects Model B.</t>
          </list>Following this step, the chosen AI agent or AI model is
        designated as the *target*.</t>
      </section>

      <section title="Access Token Request &amp; Response">
        <t>The client requests an access token by authenticating with the
        authorization server and presenting the authorization grant, as
        defined in <xref target="RFC6749"/>, and the message includes the
        following parameters:</t>

        <t><list style="hanging">
            <t hangText="target_id"/>

            <t hangText="">OPTIONAL. The identifier of the target which is
            determined to utilize the requested resource.</t>

            <t hangText="code"/>

            <t hangText="">REQUIRED. The authorization code received from the
            authorization server, as defined in <xref target="RFC6749"/>.</t>

            <t hangText="client_id"/>

            <t>REQUIRED, if the client is not authenticating with the
            authorization server, as defined in <xref target="RFC6749"/>.</t>
          </list>The authorization server authenticates the client and
        validates the authorization grant, as defined in <xref
        target="RFC6749"/>. Then, the authorization server further validates
        whether the target identified by the target_id in the message is
        successfully registered and whether the target is bound to the client.
        For example, the client's profile includes the target_id. If valid,
        the authorization server issues an access token containing a claim
        indicating that the target is authorized.</t>

        <t>If the validation is successful, the access token response message
        includes an access token. The acess token is similar to OAuth2.0,
        except that it consists of an additional claim to specify the
        target.</t>

        <t><list style="hanging">
            <t hangText="tar"/>

            <t hangText="">OPTIONAL. The identifier of the target which is
            authorized to utilize the requested resource.</t>
          </list>If the validation fails, the access token response message
        includes the reason for failure. <xref target="RFC6749"/> has defined
        types of error response. In this case, if the target validation fails,
        the authorization server may reuse the unauthorized_client message and
        indicate that the target is not registered.</t>

        <t>The client requests the protected resource from the resource server
        and authenticates by presenting the access token, as defined in <xref
        target="RFC6749"/>. Additionally, it should send the target_id to the
        resource server to indicate that the requested resource will be used
        by the target. The resource server validates the access token, as
        defined in <xref target="RFC6749"/> and also validates whether the
        received target_id is included in the access token. If the validation
        succeeds, the resource server provides the resource to the client,
        which then passes the resource to the AI agent or AI model identified
        by the target_id.</t>
      </section>
    </section>

    <section title="Security Considerations">
      <t>TBD</t>
    </section>

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

      <t>TBD.</t>
    </section>
  </middle>

  <back>
    <references/>

    <references title="Normative References">
      <reference anchor="RFC2119">
        <front>
          <title>Key words for use in RFCs to Indicate Requirement
          Levels</title>

          <author fullname="S. Bradner" initials="S." surname="Bradner"/>

          <date month="March" year="1997"/>

          <abstract>
            <t>In many standards track documents several words are used to
            signify the requirements in the specification. These words are
            often capitalized. This document defines these words as they
            should be interpreted in IETF documents. This document specifies
            an Internet Best Current Practices for the Internet Community, and
            requests discussion and suggestions for improvements</t>
          </abstract>
        </front>

        <seriesInfo name="BCP" value="14"/>

        <seriesInfo name="RFC" value="2119"/>

        <seriesInfo name="DOI" value="10.17487/RFC2119"/>
      </reference>

      <reference anchor="RFC6749">
        <front>
          <title>The OAuth 2.0 Authorization Framework</title>

          <author fullname="D. Hardt, Ed." initials="Dick" surname="Hardt"/>

          <date month="October" year="2012"/>

          <abstract>
            <t>In many standards track documents several words are used to
            signify the requirements in the specification. These words are
            often capitalized. This document defines these words as they
            should be interpreted in IETF documents. This document specifies
            an Internet Best Current Practices for the Internet Community, and
            requests discussion and suggestions for improvementsv</t>
          </abstract>
        </front>

        <seriesInfo name="RFC" value="6749"/>

        <seriesInfo name="DOI" value="10.17487/RFC6749"/>
      </reference>

      <?rfc ?>
    </references>

    <references title="Informative References">
      <reference anchor="I-D.rosenberg-ai-protocols">
        <front>
          <title>Framework, Use Cases and Requirements for AI Agent
          Protocols</title>

          <author fullname="Jonathan Rosenberg" initials="J."
                  surname="Rosenberg">
            <organization>Five9</organization>
          </author>

          <author fullname="Cullen Fluffy Jennings" initials="C. F."
                  surname="Jennings">
            <organization>Cisco</organization>
          </author>

          <date day="5" month="May" year="2025"/>

          <abstract>
            <t>AI Agents are software applications that utilize Large Language
            Models (LLM)s to interact with humans (or other AI Agents) for
            purposes of performing tasks. AI Agents can make use of resources
            - including APIs and documents - to perform those tasks, and are
            capable of reasoning about which resources to use. To facilitate
            AI agent operation, AI agents need to communicate with users, and
            then interact with other resources over the Internet, including
            APIs and other AI agents. This document describes a framework for
            AI Agent communications on the Internet, identifying the various
            protocols that come into play. It introduces use cases that
            motivate features and functions that need to be present in those
            protocols. It also provides a brief survey of existing work in
            standardizing AI agent protocols, including the Model Context
            Protocol (MCP), the Agent to Agent Protocol (A2A) and the Agntcy
            Framework, and describes how those works fit into this framework.
            The primary objective of this document is to set the stage for
            possible standards activity at the IETF in this space.</t>
          </abstract>
        </front>

        <seriesInfo name="Internet-Draft"
                    value="draft-rosenberg-ai-protocols-00"/>
      </reference>

      <reference anchor="I-D.oauth-ai-agents-on-behalf-of-user">
        <front>
          <title>Further considerations on AI Agent Authentication and
          Authorization Based on OAuth 2.0 Extension</title>

          <author fullname="Thilina" initials="T. S." surname="Senarath">
            <organization>WSO2</organization>
          </author>

          <author fullname="Ayesha Dissanayaka" initials="A."
                  surname="Dissanayaka">
            <organization>WSO2</organization>
          </author>

          <date day="8" month="May" year="2025"/>

          <abstract>
            <t>AI Agents are software applications that utilize Large Language
            Models (LLM)s to interact with humans (or other AI Agents) for
            purposes of performing tasks. AI Agents can make use of resources
            - including APIs and documents - to perform those tasks, and are
            capable of reasoning about which resources to use. To facilitate
            AI agent operation, AI agents need to communicate with users, and
            then interact with other resources over the Internet, including
            APIs and other AI agents. This document describes a framework for
            AI Agent communications on the Internet, identifying the various
            protocols that come into play. It introduces use cases that
            motivate features and functions that need to be present in those
            protocols. It also provides a brief survey of existing work in
            standardizing AI agent protocols, including the Model Context
            Protocol (MCP), the Agent to Agent Protocol (A2A) and the Agntcy
            Framework, and describes how those works fit into this framework.
            The primary objective of this document is to set the stage for
            possible standards activity at the IETF in this space.</t>
          </abstract>
        </front>

        <seriesInfo name="Internet-Draft"
                    value="draft-oauth-ai-agents-on-behalf-of-user-01"/>
      </reference>

      <reference anchor="I-D.yao-agent-auth-considerations">
        <front>
          <title>Further considerations on AI Agent Authentication and
          Authorization Based on OAuth 2.0 Extension</title>

          <author fullname="Kehan Yao" initials="K." surname="Yao">
            <organization>China Mobile</organization>
          </author>

          <date day="30" month="June" year="2025"/>

          <abstract>
            <t>AI Agents are software applications that utilize Large Language
            Models (LLM)s to interact with humans (or other AI Agents) for
            purposes of performing tasks. AI Agents can make use of resources
            - including APIs and documents - to perform those tasks, and are
            capable of reasoning about which resources to use. To facilitate
            AI agent operation, AI agents need to communicate with users, and
            then interact with other resources over the Internet, including
            APIs and other AI agents. This document describes a framework for
            AI Agent communications on the Internet, identifying the various
            protocols that come into play. It introduces use cases that
            motivate features and functions that need to be present in those
            protocols. It also provides a brief survey of existing work in
            standardizing AI agent protocols, including the Model Context
            Protocol (MCP), the Agent to Agent Protocol (A2A) and the Agntcy
            Framework, and describes how those works fit into this framework.
            The primary objective of this document is to set the stage for
            possible standards activity at the IETF in this space.</t>
          </abstract>
        </front>

        <seriesInfo name="Internet-Draft"
                    value="draft-yao-agent-auth-considerations-00"/>
      </reference>
    </references>
  </back>
</rfc>
