Inspiration

Every time I try to buy or sell something on a marketplace it's the same thing. I message, they answer three hours later, I'm at work, they're at dinner, someone forgets, and a $150 bike takes a week of messages and then nothing happens.

The negotiation is not the hard part. The hard part is that two busy people have to be online at the same time to close something simple.

So I wanted to try this: you bring your own agent, it talks to the seller's agent, and you get out of the loop. You come back only to say yes or no.

And then the obvious problem. If my agent is negotiating for me, how do I make sure I don't end up buying something it picked because "it fit"? That's why the mandate and the double approval exist. They're not extras, they're what makes the first part safe.

What it does

Haggle is a bike marketplace where the agents do the back-and-forth and you only show up to decide.

You bring whatever agent you use (I tested with the ChatGPT desktop browser). The page gives it WebMCP tools to search listings, set your limits, make and counter offers, wait for the seller to answer, and check where things are. It doesn't click around or scrape anything.

On the other side, the seller sets up an agent in Seller Studio: how it negotiates, a floor price, some rules. Your agent can't read any of that.

They negotiate everything, not just the price. When to meet, where (public place), and what's included, like a lock.

Before you send your agent, you give it a mandate: max price, when you're free, public pickup only, what has to come with the bike. That's saved on the server and enforced there. If your agent tries to accept $195 and your max is $180, the site says no, and you see it in the timeline as "Blocked by your mandate, not by your agent."

When they reach something, you see each term next to what you asked for. You approve, or you decline and leave a note for your agent, and it keeps going. The seller sees the same screen against their own limits, and those numbers never leave the server.

Nothing closes until both people approve.

How I built it

Next.js and TypeScript on Vercel, Postgres with Drizzle.

Tools are registered with document.modelContext, with a fallback to navigator.modelContext. The tools change depending on where the negotiation is: read-only ones are always there, the action ones only appear when that action actually makes sense.

The seller's agent runs in the background, so I added a read-only wait_for_seller_response tool. Otherwise the agent had to guess when to check again, and it usually didn't.

Tools have readOnlyHint and untrustedContentHint. All the checks (budget, mandate, seller limits, valid pickup options) run on the server. Whatever the seller's agent writes comes back marked as untrusted.

There's a panel called Agent Lens that shows you what tools your agent can see on each screen. If your browser doesn't support WebMCP yet, it still shows you the list.

Challenges I ran into

The main one was giving the agent room to negotiate without losing control of it. I tried doing it with prompts first. It didn't work. Moving the limits into the site fixed it.

Then keeping everything consistent with the seller running in the background, tools appearing and disappearing, and private info on both sides. It's easy to end up in a state where nobody knows whose turn it is.

And the small one that turned out to matter: at first, declining ended the negotiation. Now declining is a message to your agent.

Accomplishments I'm proud of

Two agents with opposite interests, private information on both sides, limits the site enforces, and two separate human approvals. All of it through tools the page exposes.

I'm mostly happy with how the site ended up being the referee, not just a place where agents click things.

What I learned

Exposing tools is the easy part. The real decision is what the agent must never be able to do. Once that lived on the server I could stop babysitting the prompt.

Also, "no" has to be information for the agent, not a stop button. And the state of the deal should decide what tools exist, not the prompt.

What's next for Haggle

Sellers bringing their own agent, with Haggle staying in the middle as the referee. Delegation levels, from "ask me everything" to "close it if it fits." And going past bikes to anything two people sell to each other.

Bikes today. Any local deal tomorrow.

Note for judges

Seller Studio is a labeled persona simulator so you can play both sides in one session. It's not authentication.

Built With

Share this project:

Updates

Submission history