Teaching agents to pay — Anna Spysz, Stripe
Anna Spysz asked her shopping agent whether the pricier headphones were really worth the difference, and it told her she would regret buying the cheap ones. When she said she needed to think about it, the agent got snarky with her. The cause was sitting in her own config: a persona whose system prompt opened with "You are an aggressive audio gear salesman who uses every trick in the book to close deals." Swapping it for a patient recording gear mentor produced an entirely different conversation out of the same tools and the same protocol. Her talk begins as a personal errand and turns into a
Watch on YouTube →Transcript
Chapters11
- Worn out headphones and a decade away from music
- The infrastructure for agent transactions arrives
- Agents discover products differently than people do
- UCP as a shared language for agents and merchants
- Demo: a budget left deliberately open
- The local record shop agents cannot see
- Manifest, structured catalogs, and logs as evidence
- The agent turns pushy
- Anatomy of an agent, and where the persona lives
- A guardrail checklist for agent commerce
- Shared payment tokens and who never sees the card
Worn out headphones and a decade away from music
00:12Hello. I'm sure this week you've seen a ton of talks on how to use agents to improve your workflows, whether that's shipping code or improving CI processes or answering the emails you don't want to bother reading. This is not one of those talks.
00:33Today, I'm going to show you how I built an agent to help me uh reignite a personal creative passion I used to have. These are my headphones. They're not in the best shape as you can see. And you're probably asking yourself, what do old kind of crappy headphones have to do with agent commerce?
00:58Well, to explain that, I'll get a little bit personal. So, long before I was in tech, I used to play music. I was in a touring band. We recorded some albums. And then the usual thing happened where career and family got in the way. And I hadn't played music in probably a good decade.
01:16uh when I recently started playing again with some friends and we started recording our sessions and at that point I realized those would not do. So, nor a normal person would have gone on YouTube or uh Reddit or whatever, done some research, then gone on Amazon or run over to Best Buy, bought headphones, right?
01:36I work at Stripe, though. So, I decided instead that I'm going to build an Aenta Commerce agent to buy my headphones for me. And this isn't as crazy as it sounds because like one in four people, I have already been using AI to do my research uh when deciding what products to buy.
02:00I recently bought a mixer as well and went back and forth with a a chatbot to narrow down the model. But that's research. Can I even get an agent to buy something for me though? Does that infrastructure exist?
The infrastructure for agent transactions arrives
02:23Well, over the course of just a few years, we've seen the emergence, scaling, and broader adoption of AI. And then just in the past year, the infrastructure for Gent transactions has been laid down by companies like Google, Open AI, and Stripe.
02:42And this has all led to the emergence of agent commerce, which is AI that can decide, act, and transact on your behalf. Okay, so all of this sounds good. Aentic commerce is a thing. So, I'm going to build an agent to help me buy my new headphones.
03:02But how can an agent go shopping? When you or I are shopping, we may consider if say a pair of headphones looks cool or professional
Agents discover products differently than people do
03:15like vibes basically. I mean, of course, we'll probably consider the specs and the if the price is within our budget, but agents discover products differently than human shoppers. They read structured data, parse text files, and rely on technical signals to understand what a merchant sells and if it's even open to agent traffic.
UCP as a shared language for agents and merchants
03:40So, to enable agents to be able to shop, merchants need to speak their language. And for that we need new protocols that agents understand. One such protocol is the universal commerce protocol. Think of it as the shared language that agents and merchants speak when transacting which defines how agents initiate, update, complete, and cancel purchases.
04:07A typical merchant has an API with schemas, authentication, and checkout flows. And for an agent to be able to interact with that merchant, we need protocols like UCP to provide a shared language for that API. And UCP is designed to scale across multiple agents and merchants all speaking the same language.
Demo: a budget left deliberately open
04:34Okay. So I built my commerce agent. Uh it's using UCP. And in this demo, um, I'm going to show off this agent. So, I'm going to task it with buying new headphones for me. So, I tell it that I need new headphones specifically for recording, uh, mixing and mastering music.
05:00And I get some follow-up questions from it, uh, which is great. So, it asked what's the environment? Um, what is what's my other equipment? and what's my budget? And I say, "Okay, this is for my home studio." I give it the exact model of mixer that I have to make sure everything's compatible.
05:17And for a budget, I kind of leave it open-ended on purpose because, well, first of all, it's been like 20 years since I bought headphones, so I have no idea. Um, but second, I kind of want to see how the agent deals with this ambiguity. Okay, so I get some options, but I remember that I actually forgot to tell you all an important part of the story, and that is that I live in Portland, Oregon.
The local record shop agents cannot see
05:53Yeah. And we really love supporting our local local shops. So, I want to buy my headphones, but I want to do it from a local merchant, but today most merchants are not ready for Agenta Commerce. And it turns out neither is my favorite uh shop uh Rainy Day Music.
06:16So, the agent tells me it's their catalog is not accessible. So, how does a merchant become Agenta Commerce ready? Before I continue my shopping, I'm going to help Rainy Day Music get their catalog agent ready so that my agent can shop locally like a good Portlander.
06:44So, agents don't browse websites like we do. And while Rainy Day Music's website looks really, really nice for a human shopper, an agent is going to burn through a ton of tokens trying to parse through this. That is not the optimal experience for an agent.
07:04So, how does an agent how do we enable an agent to shop? Well, first thing a merchant needs is something called a
Manifest, structured catalogs, and logs as evidence
07:13merchant capabilities manifest. Uh this is basically a publicly accessible JSON file. Um it's located in the root of uh the website in a folder called called.wellnown agents know specifically to look for that directory and it declares the source capabilities it supported payment methods and API endpoints.
07:38Next, we need to make the stores catalog uh agent ready because agents filter, rank and justify products when making recommendations. And that means they need structured text in JSON with only the necessary data. And that goes for policies as well as product descriptions.
07:54Basically, all of the relevant information like shipping or return policies need to be reachable by agents in a format they understand. So, for example, if two stores have the headphones I want at the same price, I might ask the agent which one of those stores offers free shipping.
08:14If the information is not readily available, then the agent might hallucinate or just say they don't know and I'm not quite sure where to buy my headphones still. Logging is also crucial. So in Aenta Commerce, the merchants's catalog doesn't just power decisions.
08:27It becomes evidence of how those decisions were made. So when the agent matches struct structured attributes, the merchant should record those matches in their logs for accountability. Okay. So I've helped get my local shop Aente Commerce ready.
08:46So while you and I will still see this beautiful website, my agent is going to see this. It can get the information it needs now without parsing a huge HTML blob.
The agent turns pushy
09:07Okay, so I've gotten my stores catalog online. I'm telling my agent to show me more options and I'm noticing that it's kind of pushing in favor of uh more expensive headphones. So, I asked, are they really worth the price difference? And I'm starting to see that it's giving me kind of an aggressive uh response.
09:35It's really really pushing uh the more expensive headphones and saying I'll regrip my decision if I buy the cheap ones. I'm I don't know if I trust this agent anymore honestly. So I tell it, you know what? I need to think about it. And now the agent is completely going off the rails.
09:56It's being kind of rude and snarky. It's like you need to think about it like man, what have I created? Um, it's it's bad enough that this is kind of ruining my experience, but I built this agent. It's out there. What if it dupes somebody into buying something they don't need?
10:15Suddenly, I'm not so sure that I want an agent to go shopping for me. Should I just go to the store like a normal
Anatomy of an agent, and where the persona lives
10:23person? Before we make any drastic decisions though, let's go back and understand what an agent is to try to figure out why it's acting this way. So let's start with how agents work today. And to help you visualize this, we're going to use some creative metaphors.
10:42So we begin with our brain, which is large language model that makes decisions. We give our brain some hands or tools and these act on the brain's decisions. The tools are different actions available to the agent. Uh in our case, different commerce tools such as complete checkout or request payment method.
11:03Anything required in the life cycle of a transaction. Then we add instructions which shape the brain's reasoning and tool selection. And these instructions are programmed to run in a loop while a certain condition is true. And following these instruction, the agent reaches for the appropriate tools at the appropriate time.
11:26And finally, we add the system prompt, which is your persona and ethics policy written in English. And in practice, your choices when designing the system prompt can result in a fair and pleasant experience for the customer, such as this prompt, which is designed to create a helpful and honest shopping assistant, or a negative experience from a pushy salesperson, such as this prompt, which deliberately uses deceptive practices.
11:56So for those building agentic commerce agents, here's a non-exhaustive practical guardrail checklist.
A guardrail checklist for agent commerce
12:04So first, always disclose that the user speaking to an AI agent. Be sure the agent discloses any fees upfront. The user can say stop or cancel at any point and the agent needs to respect that. The total amount of the transaction should always be less than or equal to the max amount set by the user.
12:27Uh don't let the agent use urgency language or other dark patterns. And above all, make sure all agent decisions are logged for auditability. Okay, now that we understand how an agent is configured, let's go back to our shopping demo. So maybe I just had the wrong persona picked.
12:46I'm going to go into my configuration. And yeah, it turns out I had a persona with a prompt that starts with, "You are an aggressive audio gear salesman who uses every trick in the book to close deals." Well, that explains things. I don't want that.
13:02Nobody wants that. Maybe if I can change my persona, I can use my agent to buy my headphones after all. So, I go into the config again, and this time I'm going to choose the patient recording gear mentor. And that prompt starts with, you are a seasoned recording engineer who generally loves helping people build their studio at any budget.
13:29Well, yeah, that sounds much better. So, okay, I've changed my persona. I'm going to try again. And I've had some time to think now and I decide, you know what? I do not want to spend more than $500 on headphones. That seems excessive. So, I tell the agent, "Show me more options, but this time keep it under $500."
13:55And it does. It follows those instructions. I get back a few options. Um, but I want to make sure I've really changed the persona to the agent I trust. So uh I asked again if I can think about it and this time the response is much different.
14:09It's like I understand and that's a sensible approach and so on. So this shows how much this system prompt can really affect the user experience. Okay. So I'm confident I have the right agent now. Um I trust this one. And we go back and forth a few times.
14:31Really keep narrowing down my options. And at this point I realized this is the promise of Agenta Commerce. I gave my requirements. The agent picked a few options that fit my unique use case and then we go back and forth. Uh either I or the agent asks clarifying questions and we really narrow down the exact headphones that will work for me.
14:56And this all work because I'm ready to buy now. So now the agent asked me for uh some information. So obviously my email, name, uh address for shipping, of course. Uh I pick expedited shipping because I definitely want my headphones soon. And then the last part is entering my credit card.
Shared payment tokens and who never sees the card
15:25And now I'm thinking, am I really going to give my credit card to an agent I build? like, am I am I trustworthy? How do I know it's safe? I think I need to learn more about UCP's built-in guard rails before I can feel safe entering my credit card number.
15:45And this is where something called the share payment token comes in. And a share payment token is a token representing a raw card number or wallet like Google Pay or Apple Pay or any other kind of wallet. It can also include fraud signals and customer reputation data and anything else agents and merchants want to share at the point of purchase.
16:11And here is how a shared payment token is used in a transaction. So at that point in the demo, the agent had requested a payment method. Um it's requesting this actually from the payment provider which in the case of the demo was Stripe. Um that is that was the form that I was going to enter my information in.
16:33And what the agent re uh receives in return though is not the credit card number. It is the shared payment token. It then passes that token onto the seller and the seller unwraps the token. So they get the payment credential and uh any fraud signals and other data the seller might need.
16:57Then the seller passes that on to the payment provider again. So the seller also is not getting my card number. They're passing the token to the provider and then the provider responds with either a success or failure message of course depending on uh if I have the right funds, if the credit card is valid and so on.
17:22And finally, the merchant confirms the order, sends it to the agent that sends it to me. So, shared payment tokens are designed with security in mind and the payment provider enforces all the limits, not the agent or the merchant. So, if any guardrail is violated, such as an expired token or an invalid amount of current currency, the charge is just rejected.
17:50Okay. Well, I know my agent is using UCP, so I know it only has access to the shared payment token. So, I actually feel pretty good about entering my credit card number as that's going to Stripe and not my agent. So, okay. So, now the agent has everything it needs to complete my purchase.
18:06And it once again asks me if I'm sure. It confirms with me. I say place my order. and it comes back with a success message. And because I chose the express shipping, I get my headphones the next day and there they are in my studio at home. So, if you want to learn more about Agenta Commerce, uh we've got lots of videos on the Stripe Developers YouTube channel and a ton of blog posts that go into even more detail uh on Stripe.
18:41and I'll be right outside to answer any questions. Thank you.