读见

如何让 AI 智能体安全注册你的应用:WorkOS 的 Isabelle Williams 谈身份验证与授权

原题How to Let AI Agents Sign Up for Your App Safely — Isabelle Williams, WorkOS

约 13 分钟原文英文已翻译

视频由 YouTube 提供

推荐理由WorkOS 以旅行应用拆解匿名认领、身份断言与独立令牌,帮助开发者把智能体入口、用户归属和可撤销授权分别设计清楚。

看前速览

5 个要点

Isabelle Williams 通过 Waypoint 演示智能体如何匿名试用、让用户认领成果、凭身份断言注册,以及如何用独立且可撤销的令牌限制权限。

  1. 让智能体发现接入方式,授权检查仍由应用执行

    auth.md 告诉智能体如何获取访问权限、创建账户。应用仍须在 API 端执行授权检查,接入说明与权限执行各自承担不同职责。

  2. 允许智能体先证明价值,再让用户注册

    匿名智能体先获得有限访问权限和认领令牌。用户随后通过一次性代码登录并认领已有成果,再授权智能体以自己的身份继续操作。

  3. 在用户同意后使用身份断言,同时保留应用的决策权

    智能体提供方在用户同意后提供身份断言。Waypoint 验证断言,并自行决定创建或关联账户及授予哪些权限,而不是由智能体提供方替它决定。

  4. 为智能体签发独立令牌,权限取两者交集

    令牌同时标识智能体及其代表的用户。权限取用户权限与智能体预设上限的交集,支持操作归因,并可在不终止用户会话的情况下撤销智能体访问。

  5. 通过智能体做不到的操作,展示权限边界

    资金智能体可以调配 70 美元,弥补 250 美元缺口的一部分,却不能提高预算。必须由 Jordan 将预算调至 2,000,智能体才能完成任务,用户与智能体的权限差异因此变得直观。

完整摘要

WorkOS 产品经理 Isabelle Williams 用自己搭建的旅行规划应用 Waypoint,回答三个问题:智能体如何发现并进入应用,如何把操作关联到真实客户,以及应用如何限制或撤销它的权限。auth.md 用于说明获取访问权限的方式,真正的授权检查仍由应用的 API 执行。

一种接入方式允许智能体先获得有限的匿名访问权限和认领令牌。用户之后登录、输入一次性代码,即可把已有成果归入自己的账户。另一种方式先征求用户同意,再由智能体提供方通过 ID-JAG 传递身份断言。接收应用验证断言后,自行决定创建还是关联账户,以及授予哪些权限。在演示环境中,一个此前未注册的用户完成了开户,获得纽约行程、晚餐预订和可分享链接。

对于应用内置的智能体,Williams 主张将其身份与用户身份分开。智能体令牌的权限取用户权限与预设权限上限的交集,便于追踪操作和独立撤销访问。资金智能体向 Alex 的 250 美元缺口调配了 70 美元,却不能提高总预算;用户 Jordan 将预算调至 2,000 后,它才完成任务。这些是讲者描述的演示结果,并非生产安全验证。内容没有深入讨论重放防护、发行方信任策略或对抗测试,字幕中的部分协议术语和密码学细节也尚未核实。

章节

文字稿

查看原文

简要说明Brief Description

本次演讲将以 Waypoint 旅行规划应用为例,说明代理如何发现身份验证选项、匿名试用应用、通过声明或身份断言将其工作关联到真实用户,并使用可审计和撤销的限定范围令牌开展操作。Using the Waypoint travel-planning app, this talk explains how agents can discover authentication options, try an app anonymously, connect their work to a real user through claims or identity assertions, and operate with scoped tokens that can be audited and revoked.

目录Table of Contents

  • 简介
    Intro
  • 演示应用:Waypoint
    The demo app: Waypoint
  • 关于面向智能体的应用的三个问题
    Three questions for agent-ready apps
  • auth.md:智能体的入口文件
    auth.md: a front door for agents
  • 匿名模式与认领代理的工作成果
    Anonymous mode and claiming an agent's work
  • 使用身份断言跳过注册流程
    Skipping signup with identity assertions
  • 什么是 ID-JAG?
    What is an ID-JAG?
  • 演示:一名代理注册并规划行程
    Demo: an agent signs up and plans a trip
  • 为什么这需要开放标准
    Why this needs open standards
  • 限制和撤销代理人
    Limiting and revoking agents
  • 演示:一名范围受限的资金代理人
    Demo: a scoped funding agent
  • 要点
    Takeaways

简介Intro

大家好。我叫 Isabel,是 WorkOS 的产品经理。今天我想和大家聊聊:你的下一位用户将是一个智能体。简单介绍一下 WorkOS:我们为身份验证提供基础设施,帮助你构建应用、智能体和 API。包括 OpenAI、Propel 和 Cursor 在内,已有超过 3,000 家客户信任我们。今天演示时,我会使用一个用 Cursor 实时编写的应用,它叫 Waypoint。Hi everyone. My name is Isabel. I'm a product manager at WorkOS. Today, I'm going to be talking about how your next user is an agent. Briefly on WorkOS, we do infra for auth. We help you build apps, agents, APIs. We're trusted by over 3,000 customers including OpenAI and Propel and Cursor. For my presentation today, I'm going to be using an app that I live coded with Cursor. It's called Waypoint.

演示应用:WaypointThe demo app: Waypoint

这是一款既适用于个人出行,也适用于公司差旅的旅行规划应用。今天,我们会使用 Waypoint 来帮助规划前往纽约市参加 AIE 的行程。过去一年里,尤其是最近几周,随着 Muse 和 Instinct 的出现,以及个人智能体的兴起,我一直在思考这对 Waypoint 意味着什么。我首先想到的是:如何让智能体进入我的应用?It is a travel planning app both for individual use and for company travel. And we're going to use Waypoint today to help plan our trip to AIE in New York City. So, over the past year, but especially in the past few weeks with Muse and Instinct and the rise of personal agents, I've been thinking a lot about what this means for Waypoint. The first thing that I've been thinking about is how do I let agents into my app?

关于适用于智能体的应用的三个问题Three questions for agent-ready apps

所以,当我思考 Waypoint 的个人旅行层级时,在代理出现之前,从产品驱动增长的角度来看,思考人类用户如何发现我的应用、注册并迅速体验到那个恍然大悟的时刻,确实非常重要。但当我思考自己如何使用个人代理,以及我认为其他人(如果他们还没有开始的话)将如何使用个人代理时,我认为他们会把大量研究、产品探索、开始使用产品以及体验到那个恍然大悟时刻的工作,完全交给自己的代理。So, when I think about the personal travel tier of Waypoint, before agents, it's really important from a product-led growth perspective to think about how human users discover my application, get signed up, and get to that aha moment really quickly. But when I think about how I'm using personal agents, and how I think others are going to be using personal agents if they're not already, is that they're going to be turning over a lot of that research, product discovery, and getting started with the product, and getting to that aha moment totally over to their agents.

所以,我在想,让代理通过 Waypoint 来完成这件事将会非常重要。随着我对这个想法有了更深入的思考,我接下来的问题是:如何将这些以这种模式开始使用我产品的代理与真实客户连接起来?So, I'm thinking about how it's going to be really important that I let agents do this with Waypoint. Now, as I got a little further into that thinking, the next question that I have is how do I connect those agents that are getting started with my product in this mode to real customers?

最后,随着我进一步思考 Waypoint 如何服务于企业团队的商务出行,我意识到其中涉及合规和财务风险。因此,对我来说,确保能够限制代理的操作权限,并在需要时撤销这些权限,非常重要。Finally, as I think more about how Waypoint works for company travel for corporate teams, there are compliance and financial risk elements to that. So, it's really important to me to make sure that I can limit what an agent can do and revoke it when I need to.

auth.md:智能体的入口auth.md: a front door for agents

那么,带着这三个问题,我们来聊聊我是如何用 Waypoint 解决它们的。首先,我考虑的是如何让智能体接入。如果你打开这里的这个链接,会发现它以 auth.md 结尾。这是一个真实的链接,你确实可以打开它,但它不是给我们看的,而是给智能体看的。auth.md 是一种开放协议,说明智能体如何在应用程序中注册账户。auth.md 是一个由你托管在应用程序中的 Markdown 文件。同样,你可以打开并阅读它,但它不是给我们看的,而是给智能体看的。智能体可以通过它了解如何开始使用你的应用程序。So, with those three questions in mind, let's talk through how I did them with Waypoint. So, the first thing that I'm thinking about, how to let agents in. If you go to this link here, it ends in auth.md. So, this is a real link. You can actually go to this, but it's not meant for us. It's meant for agents. auth.md is an open protocol that talks about how agents can register for accounts with applications. auth.md is a markdown file that you host with your application. And again, you can go to it and read it, but it's not meant for us. It's meant for your agent. It's where an agent can discover how to get started with your application.

它介绍了如何获取访问权限、创建账户以及调用你的 API 的机制。It describes the mechanisms for getting access, for creating an account, and being able to call your API.

关于 auth.md,有一点很重要:它描述的是访问权限和操作,但实际通过 API 强制执行身份验证的是你的应用程序,在这里也就是 Waypoint。因此,我接下来要介绍并演示的 Waypoint 的 auth.md 文件有两种模式。第一种模式允许智能体以匿名模式试用我的应用程序。我希望智能体能够执行有限的操作,以证明我的应用程序确实有价值,而不必注册并创建账户。但针对我之前提出的第二个问题,我真正希望这些智能体代表用户行事。One thing that's important to remember with auth.md is that it describes access and operations, but your application, so in this case Waypoint, is the one that's enforcing auth through the API. So, in this auth.md file that I'm going to talk about for Waypoint and I'm going to demo, there's two modes to it. The first mode is allowing agents to try my application in anonymous mode. So, I want agents to be able to take limited actions to prove that my application has value without having to sign up and create an account. But to the second question I posed earlier, I really want these agents to be acting on behalf of users.

所以,我希望在能够将这些智能体关联到真实用户时,可以扩展提供给它们的可用操作。So, I want to be able to expand the available actions that I give to these agents when I can tie them back to a real user.

匿名模式与认领代理的工作成果Anonymous mode and claiming an agent's work

那么,我们来看看 auth.md 协议中的第一个机制,了解这一流程如何实现。这个流程允许代理先以匿名模式尝试操作,然后由用户介入,认领代理所做的操作,并将这些操作转移到代理账户下。协议的第一部分是让代理能够通过我的 API 执行匿名操作。最终,代理会获得一个访问令牌,以及一个认领令牌;用户之后可以用这个令牌认领代理所做的操作,并将其转移到该用户的账户下。So, let's jump into the first mechanism of the auth.md protocol for how that can happen. So, this flow goes from letting an agent try things out in an anonymous mode, and then a user coming in and claiming what that agent did and transferring the actions over to the agent account. So, the first part of this protocol is an agent being able to take anonymous actions at my API. So, in the end of this, the agent gets an access token, and then they get a claim token that eventually is going to let a user claim what the agent did and move it under that user's account.

所以,这个流程是这样的:当用户想要接管代理的操作时,代理可以给他们一个链接和一次性验证码。用户打开我的应用 Waypoint,注册并登录,然后输入验证码。So, the flow to this one, at some point when the user wants to take ownership of what their agent is doing, the agent can give them a link and a one-time code. The user comes over to my application, Waypoint. They sign up, they sign in, they enter the code.

他们已经认领了该智能体所做的事,并将它纳入自己的账户。最后,通过 OAuth,我的授权服务器可以代表该用户向智能体签发访问令牌,而智能体将使用该令牌调用我的 API。They've claimed what the agent has done, they've brought it under their account. And finally, using OAuth, my authorization server can issue an access token on behalf of that user to the agent, and the agent is going to use that to call my API.

通过身份断言跳过注册Skipping signup with identity assertions

所以,这让智能体能够做事,但你可能已经注意到,这里有个链接,还要经历注册流程、输入验证码并验证我的邮箱。如果你了解产品驱动增长,就知道用户往往会在这一步流失。不过,我的智能体不是已经知道我是谁了吗?就像你们现在使用 Cloud Code、使用 Muse 时,都是已登录状态。那些服务已经通过某种方式验证了你的身份,因为它们希望确保你很可能是真人。所以,它们验证了你的邮箱,或者采取了类似的措施。So, this lets the agent do things, but you might have noticed there is a link and a sign-up flow and entering a code and verifying my email. And if you know anything about product-led growth, you know this is where you lose your user. But, doesn't my agent already know who I am? Like, when you guys use Cloud Code today, when you use Muse, you're signed in. And that service has done something to verify that you are who you say you are because they care about ensuring that you are probably a real person. So, they verified your email or something to that extent.

那么,如果智能体知道我是谁,为什么智能体提供商不能直接告诉我的应用我是谁,并让我免于手动操作就能登录呢?嗯,使用 auth.md 也可以做到这一点。So, if the agent knows who I am, why can't the agent provider just tell my application who I am and let me in without me having to take manual actions? Well, that's also possible with auth.md.

那么,我会拆解这个协议以及它所基于的 ID-JAG 标准,并向你展示一个小演示,说明它是如何运作的。具体来说,首先,你的智能体会发现如何向你的 API 进行身份验证。这类似于 OAuth 中的标准术语:了解你的受保护资源(也就是你的 API)、你的 MCP 服务器,以及你的 OAuth 授权服务器。接下来就有意思了。你的智能体会以用户的身份向你请求同意,将你的身份信息和电子邮件地址分享给 Waypoint 应用。如果你同意,智能体就会前往智能体提供方。So, I'm going to break down this protocol and the standard called ID-JAG that it's built on and I'll show you a little demo of how this works. So, to break this down, this starts with your agent discovering how to authenticate with your API. This is like standard OAuth parlance of finding out about your protected resource, your API, your MCP server, and your OAuth authorization server. And then things get a little fun. So, your agent is going to come to you as the user and ask for consent to share your identity and your email with the application Waypoint. If you consent, the agent goes to the agent provider.

于是,你的 Claude 代理会去找 Claude,说:“嘿,给我一个 ID-JAG。”先记下这一点,稍后我会解释它是什么。接着,代理拿到 ID-JAG 后,会把它发送到你的 API 的授权服务器。So, your Claude agent goes to Claude and says, "Hey, give me an ID-JAG." Put a pin in that. I'll come back to what that is in a second. So, the agent gets the ID-JAG, sends the ID-JAG over to your API's authorization server.

你的应用——也就是你的授权服务器——会验证这个 ID-JAG 是否真实有效。它会从中读取一些关于你的信息,然后由你的应用决定:要不要为这个用户创建账户?要不要将其关联到现有账户?要在访问令牌中授予这个代理什么样的访问权限?这些都完全由你的应用掌控。最后,代理就可以凭借这个访问令牌,代表用户调用你的 API。刚才我用了一个 Claude 的说法,提到这个 ID-JAG 里有个稍微有点“承重”的部分。这里有人听说过 ID-JAG 吗?Your application, your authorization server is going to verify that that ID-JAG is the real deal. It's going to see some information on you inside of it and then your app is in control of deciding, am I going to create an account for this user? Am I going to link it to an existing account? What sort of access am I going to give back in the access token to this agent? Your app is completely in control of that. And so finally, with that access token, the agent can call your API on behalf of the user. So, I said something, to use a Claude term, a little bit load-bearing in this ID-JAG. Has anyone here heard of ID-JAG?

我看到一个人,他和我一起工作,所以这挺有意思的。I see one person, and he works with me, so that's funny.

什么是 ID-JAG?What is an ID-JAG?

所以,如果你一直在关注 Claude 正在做什么、Anthropic 在 MCP 规范中对企业托管授权所做的工作,以及 Okta 在跨应用访问方面的工作,就会发现它们都使用同一个规范、同一种名为 ID-JAG 的协议。让我来解释一下它是什么。ID-JAG 是 Identity Assertion Joined Authorization Grant(身份断言联合授权授予)的缩写。这是 IETF 的一项规范。实际上,ID-JAG 是对用户身份的一种断言,由签发者签名。在这个流程中,代理提供商就是签发者。它会发送给特定的受众。同样,在这个流程中,特定受众就是我的应用程序。So, if you've been following what Claude is doing, what Anthropic is doing with enterprise managed authorizations in the MCP spec, what Okta is doing with cross-app access, that's using the same spec, the same protocol called ID-JAG. Let me break down what that is. So, ID-JAG, Identity Assertion Joined Authorization Grant. This is a spec in the IETF. Effectively what an ID-JAG is is an assertion of a user's identity. It's signed by an issuer. So, in this flow, the agent provider is the issuer. And it's sent for a specific audience. So, again in this flow, the specific audience is my application.

我们来逐一看看其中的内容。标头会告诉你它的类型是 ID-JAG、用于签名的算法,以及签名密钥。载荷部分的内容就开始变得有意思了。And let's break down what's in this. In the header, it tells you that this is of type ID-JAG, the algorithm used for signing, and the signing key. In the payload, this is where things get interesting.

它会告诉你是谁签发了它,在这个例子中,签发方是智能体提供商。它还会提供智能体提供商掌握的用户信息,比如用户的姓名、电子邮箱,以及邮箱是否已验证。然后,它会告诉你令牌是发给谁的。受众是我的应用 Waypoint,而客户端 ID 指的是 Waypoint 已知的客户端。最后,它会告诉你令牌的有效时长。最重要的是,它由签发方的公钥签名。因此,Waypoint 的授权服务器会收到这个 ID-JAG,并验证其签名。Waypoint 可以自行决定信任其中哪些内容。It tells you who issued it, which in this case is the agent provider. It gives you information from the agent provider on the user. So, the user's name, their email, whether the email was verified. And then it tells you who it's for. So, the audience is my application Waypoint, and a client ID is a client that's known to Waypoint. And then finally, it tells you how long it's valid. And most importantly, it's signed by the issuer, the agent provider's public key. So, Waypoint, their authorization server, gets this ID-JAG. They are going to verify the signature. And it's up to Waypoint what they want to trust in this.

是否要为该用户创建账户,以及要在代表该用户交还给代理的访问令牌中授予何种访问权限和范围,完全由 Waypoint 决定。It's completely up to Waypoint if they want to create an account for this user, what sort of access and scopes they want to give in the access token that they hand back to the agent on behalf of this user.

那么,让我们看看实际操作起来是什么样子。So, let's see what that actually looks like in action.

演示:一位智能体注册并规划行程Demo: an agent signs up and plans a trip

我现在使用的是自己在这里搭建的智能体框架。这个智能体框架能够发出 ID-JAG。我以 Sam Rivera 的身份登录了这个智能体框架。我有一个邮箱,而且这是一个全新的用户。Waypoint 对这个用户一无所知,从未见过这个用户。现在我要对我的智能体框架说——我们看看。我得把麦克风放下。所以,我在告诉我的智能体框架:我想让你为我规划一趟纽约市之旅,而且我希望能和同事分享行程;我还希望你找到一个既能规划行程、又方便分享的工具,诸如此类。于是我的智能体框架开始寻找工具。I am in an agent harness that I built here. This agent harness is able to issue ID-JAGs. I am logged in to this agent harness as Sam Rivera. I have an email, and this is a fresh user. Waypoint doesn't know anything about this user. It's never seen this user before. And I am going to say to my agent harness, let's see here. I need to put down my mic. So, I'm telling my agent harness, I want you to plan my itinerary for a New York City and I want to be able to share with my co-workers and I want you to find a tool that's going to do the planning and make it easy to share, all that good stuff. So, my agent harness is going and looking at tools.

它正在寻找其他一些旅行行程规划工具,比如 Maple itinerary,但没法使用,因为需要通过浏览器注册;TripIt 需要 API 密钥,而 Waypoint 允许代理注册。It's finding some other travel itinerary planning tools like Maple itinerary, and it can't get through to there cuz it needs a browser sign up, TripIt needs an API key, but Waypoint allows for agents to sign up.

于是它向我征求同意:“我可以把你的姓名和已验证的电子邮箱分享给 Waypoint 吗?”我会回答“可以”。Waypoint 的 auth.md 文件还要求我同意授予一些其他的、更高的权限。在这个例子中,这意味着允许 Waypoint 通过代理帮我预订晚餐。我同意了。我的代理运行框架会就此与 Waypoint 交互。看看它会怎么做。好了,它已经验证了我的身份,也创建了我的 Waypoint 账户。我什么都不用做,整个过程完全不需要我出手。哦,它还预订了旅行和晚餐,我的行程单已经准备好,可以分享了。And so it asked me for consent. Can I share your name and verified email with Waypoint? I'm going to say yes. Waypoint's auth.md file also asked for some other consent for some more elevated permissions. In this example, it's allowing Waypoint to book dinner reservations with the agent. So, I give it my consent. And my agent harness is going to talk to Waypoint about this. Let's see what it does. Okay, it's verified my identity. It created my Waypoint account. I didn't have to do anything. Totally hands-off on my part. Oh, it booked a trip, dinner reservation, and my itinerary is ready to share.

好,看看这个。这就是我的行程安排。它帮我订了 Quality Bistro 的晚餐,那家餐厅相当不错。如果有人以前去过,我会推荐这家店。它还给了我一个可以分享给同事的链接。整个过程我都没有进行任何操作。Okay, look at that. There's my itinerary. It booked me dinner at Quality Bistro, which is quite good. If anyone has been there before, I would recommend it. It's given me a link that I can share with my colleagues. All that was done without any interaction on my part.

为什么这需要开放标准Why this needs open standards

关于 ID-JAG,我最后想说的是,在智能体访问其他事物的这个时代,有一点让我非常确信:要想安全可靠、以可信的方式实现这一切,我们都需要以开放标准为基础。我们需要开放标准,让智能体能够与服务交互、执行操作、付款并注册账户。我对目前正在开展的标准化工作感到非常兴奋。就在过去一周里,就有很多相关消息发布。The final thing I'll say on the ID-JAG part is that what I feel really confident in kind of this era of agents accessing other things is that for us to be able to do this safely and securely and in a trusted manner, it's going to all need to be built on open standards. We are all going to need open standards for agents to talk to services, do things, pay, and sign up for accounts. I'm really excited about the standardization work happening right now. A lot of things were announced just over the past week.

限制和撤销代理权限Limiting and revoking agents

接下来进入本次演示的最后一部分。如何限制智能体能做什么,以及撤销它的权限?对我来说,这在 Waypoint 中非常重要,因为我提供企业差旅预订服务。我希望负责差旅预订的企业员工能够使用智能体,也希望为他们构建智能体。但这涉及真正的企业资金。我必须能够进行审计,也必须确保资金不会被不当使用。现在来介绍一个角色:Jordan。Jordan 负责管理所在公司的资金。Moving on to the last part of this presentation. How can I limit and revoke what an agent can do? So, for me this is really important in Waypoint because I allow for corporate travel booking. And I want to let corporate employees responsible for travel booking use agents. I want to build agents for them. But with this, there's real corporate money on the line. I need to be able to audit. I need to be able to make sure that money is not thrown around in ways that it shouldn't be. So, introducing a persona here. Jordan, Jordan's responsible for company funds at Jordan's company.

Jordan 是唯一有权批准预算和规则的人。现在,我已经在 Waypoint 里为 Jordan 构建了几个代理。第一个是只读代理,就是那种经典的聊天机器人,Jordan 可以问它:“嘿,预算出什么问题了?”之类的问题。它会告诉 Jordan,但实际上什么也做不了。后来我又为 Jordan 构建了一个资金代理。这个资金代理实际上可以在用户之间调拨资金。比如说,有个用户从旧金山乘飞机来,机票价格比另一位从波士顿乘火车来的用户贵得多。Jordan's the only one that can approve budget and approve the rules. Now, I've built a couple of agents into Waypoint for Jordan to use. The first one's read only. It's your classic chatbot that Jordan can ask, "Hey, what's wrong with the budget?" or whatever. And it'll tell it, but it can't actually do anything. But then I built Jordan a fund agent. This fund agent is going to actually be able to move funds around between users. Let's say that one user is flying from San Francisco and flights are really expensive compared to the user coming in via train from Boston.

因此,Jordan 希望能够调动资金,但只要是在预算范围内并遵循已批准的规则,就不需要他亲自手动操作。他可以使用代理。不过,对 Jordan 来说,确保资金代理不会擅自行动至关重要。And so Jordan wants to be able to move funds around, but as long as it's happening within the budget and the approved rules, Jordan doesn't need to manually do it himself. He can use the agent. But it's really important to Jordan that the funding agent can't go rogue.

它不能更改预算,也不能更改审批规则来让事情得以推进。那么,我该如何在我的应用程序中实现这一点呢?Jordan 于是调用了一个代理。在我的应用程序后端,应用会签发代理令牌。因此,对我来说非常重要的一点是,不能直接把 Jordan 的用户令牌交给代理。原因有几个。第一是审计和归属追踪。第二是撤销。我希望 Jordan 能够撤销代理,也希望我的应用程序能够撤销代理,同时不影响 Jordan 的会话和访问权限。最后,我希望能够限制代理可以执行的操作。It can't change the budget. It can't change the approval rules to make things work. So, how do I make this happen within my application? So, Jordan invokes an agent. And on the back end of my app, my app issues agent tokens. So, it's really important to me that I don't just hand an agent Jordan's user token. There's a few reasons for this. One is auditing and attribution. Two is revocation. I want Jordan to be able to revoke the agent. I want my application to be able to revoke the agent without impacting Jordan's session and Jordan's access. And then finally, I want to be able to limit what the agent can do.

我想限制令牌中的权限范围。所以,我设置这些代理的方式是,为只读代理和资金代理创建一个蓝图,或者说设定一个访问权限上限。I want to limit the scopes in the token. So, the way that I've set these agents up is I've created a blueprint or like a ceiling of access for the read-only agent and for the fund agent.

Jordan 调用它们时,为该代理签发的代理令牌所包含的权限范围,是 Jordan 的用户权限与代理蓝图中权限范围上限的交集。这样一来,代理最终就可以使用带有范围限制的代理令牌调用我的 API。我简单展示一下这是什么,然后用几个二维码收尾,大家可以扫码查看所有这些内容。And when Jordan invokes them, the agent token that's issued for the agent, the scopes in it is the intersection of Jordan's user permissions and the scopes in the ceiling of the agent blueprint. And so then finally, the agent can call my API with a scoped agent token. So, I'll just briefly show you what that is and then I'll end with some QR codes here so you guys can check out all of this stuff.

示例:范围限定的资金代理Demo: a scoped funding agent

我是以 Jordan 的身份在 Waypoint 中。我正在这里查看团队的差旅信息。我有一笔团队预算,可用金额为 70 美元。启动我的只读代理。好了,我的只读代理已经启动。看看这里的会话详情,之前我们讨论过的 Jordan 用户令牌就在左侧。我可以看到 Jordan 拥有很多权限。只读代理的代理蓝图位于中间,它只有一项权限。它还包含一些会话信息。至于代理令牌,它由我的应用程序签发。代理令牌的主体是代理 ID,因此可以将其归属到实际的代理。I am in Waypoint as Jordan. I am looking at my team travel here. I have a team budget. There is $70 available. Start up my read-only agent. All right. So, my read-only agent is started. If I take a look here at the session details, what we were talking about earlier with Jordan's user token, it's here on the left. I can see that Jordan has a bunch of permissions. The agent blueprint for the read-only agent is in the middle. It only has one permission. It has some session information. And then the agent token, it's issued by my application. The subject of the agent token is the agent ID, so it's attributable to the actual agent.

它是代表用户 Jordan 行事的,所以我也把这项信息放在里面了。而权限则是 Jordan 的用户令牌与智能体蓝图权限的交集。It's acting on behalf of Jordan the user, so I have that information in there as well. And the permissions are the intersection between Jordan's user token and the agent blueprint.

为了节省时间,我就跳过只读代理,直接切换到资金代理,因为它更有意思一些。现在启动这个资金代理,我会让它解决 Alex 的预算问题。好,Alex 的预算缺口是 250 美元。你要我重新平衡资金吗?要,重新平衡。拿着麦克风操作还真不容易。好了,资金代理成功给 Alex 调拨了 70 美元,但没法全部补上,因为已经没有可用预算了。资金代理无法更改预算,但我作为 Jordan 可以。所以我的用户仍然可以使用自己的用户令牌来更改预算。In the interest of time, I'm going to skip the read-only agent and just move over to the fund agent cuz it's a little more interesting. So starting up this fund agent, I'm going to ask it to fix Alex's budget. Okay, so Alex has a $250 shortfall. Do you want me to rebalance funds? Yes, rebalance. Hard to do while holding a mic. All righty, so the funding agent was able to move $70 over to Alex, but they can't fix all of it because there's no more budget available left. And the funding agent doesn't have the ability to change the budget, but I as Jordan do. So my user is still able with their user token to change the budget.

我们把它改成 2,000。作为用户,我可以这么做,但智能体做不到。然后我要告诉它我提高了预算。好了,搞定。Let's change it to 2,000. So as the user I was able to do that. The agent couldn't. And then so I'm going to tell it I increased the budget. Okay, there we go.

因此,这个智能体成功修正了 Alex 的预算。我们在这里展示的,其实是如何将智能体集成到你的应用中,为其权限设置上限;它使用的是具有特定范围访问权限的智能体令牌,而不是用户令牌或 API 密钥。这样,你就可以审计它、撤销它的权限,并确保限制该智能体的权限。好了。And so the agent was able to fix Alex's budget. So really what we showed here is that how you can build agents into your application putting a ceiling on their permissions and they operate using an agent token with that scoped access instead of taking your user's token or an API key. So you can audit it. You can revoke it and you can make sure that you limit the permissions of that agent. All righty.

要点Takeaways

回到这里,我刚才演示了那个示例。这里有三点要点:如何通过 auth.md 文件让代理接入你的应用;如何通过 auth.md 中的用户声明流程或 ID-JAG 身份断言,将代理与客户关联起来;最后,如何通过强制执行权限和撤销授权来限制操作。我最后会展示几个二维码。左边的是 auth.md,正如我所说,它是一项开放标准。右边的是 WorkOS agent auth,我就是通过它使用代理令牌,在应用中构建了权限受限的代理。我的演讲就到这里。非常感谢大家。Coming back in here, I just showed that demo. So three takeaways here, how you can let agents into your application with an auth.md file, how you can connect them to a customer using the user claim flow in auth.md or the ID-JAG identity assertion, and then finally how you can limit actions by enforcing permissions and revocation. I'll end with some QR codes. The one on the left for auth.md, like I said, it's an open standard. And the one on the right is WorkOS agent auth, which is how I was able to build agents into my application with limited permissions using an agent token. And I will end my talk there. Thank you all so much.

如果有人有任何问题,我很乐意之后再聊。And if anyone has any questions, I'm happy to talk about it after.

值得记下

  1. 所以,对我来说,非常重要的一点是不要直接把 Jordan 的用户令牌交给智能体。
  2. 我希望应用能够撤销智能体的访问权限,同时不影响 Jordan 的会话和访问权限。
  3. 权限是 Jordan 的用户令牌与智能体预设权限的交集。
  4. 智能体令牌的主体是智能体 ID,因此操作可以归因到具体的智能体。

← 回到本期 · 第 9 条