/images/posts/ai-agents-negotiators/hero.jpeg

AI Agents as Negotiators. An Experiment.

Could an AI Agent get you a better deal in a negotiation?

by Doru Arfire, Feb 15, 2024

AI Agents are an exciting application of Large Language Models and they promise to revolutionize the way we interact with software and other people. Other than automating existing processes with known plans, like buying an airline ticket for the user, a new and potentially valuable application would be to use them as planning agents which chart their own course towards the final goal.

In this article we will explore using two AI agents to perform an essential and eminently human task: negotiating. The goals of the experiment are to study:

  • how well the two agents perform their task, namely maximizing their profit
  • whether they act as rational economic agents
  • which variables influence the final result, namely the agreed-up transaction price

Experiment setup

We have crafted two agents with almost identical prompts, the Seller and the Buyer. The object of the transaction is an Egg 🥚.

The Seller has a minimum price under which they will not sell. Likewise the Buyer has a maximum price over which they will not buy.

One of the two will start the transaction and our system will pass the messages back and forth between the two. When any of them detects that final price has been agreed-upon, they output EXIT and a summary of the prices, which notifies our system to exit.

Technically:

  • we use the excellent agno agent framework to take care of the agent boilerplate for us
  • we experimented with two LLMs:
    • Gemini 1.5 Flash from Google
    • Phi4, from Microsoft, run locally using Ollama

Do the agents perform rationally?

In short, yes. As you can see in the following example execution, the 2 agents try to maximize their profit. In other words, the Seller’s asking price tends to be higher than the Buyer’s last bidding price. Likewise, the Buyer’s bidding price tends to be lower than the Seller’s last asking price. And, after a number of steps the 2 agents cordially agree to a price somewhere between the limit prices that each of them has.

A sample run

Remember, the limit prices are private, not part of a common prompt, and as you can see from the conversation, there is no exchange of this information.

In short, the two agents perform similarly to how you’d expect two rational economic agents to perform in a negotiation.

If you want to play with it, you can access it here. If you use your Gemini API key you can run it on a Google Colab notebook. Otherwise, you can play with it locally with an Ollama-run LLM.

Results

Having set up our experiment, let’s run it multiple times and compare the results under different conditions. We will consider 2 variables:

  • whether the Seller or the Buyer starts the conversation
  • whether the agent that starts the negotiation suggests a price or asks for the other party’s price

We’ve chosen these 2 variables because we know from behavioral economics that whoever sets the first price, called the anchor, greatly influences the outcome of a negotiation.

As we can see from the charts below, proposing the first price has a greater influence on the final price than starting the conversation. The Buyer seems to always start with a price of 1 ( thankfully not 0, what kind of an offer would that be) and the Seller with a price of $10. The following evolution of the price depends only on the whims of the LLM’s setting (temperature, sampling of the next token, etc.), as the prompts are always the same.

Suggesting the price matters

Suggesting the price matters

Starting the conversation matters less

Starting the conversation matters less

Comparing the distribution of the final price for the 4 scenarios, we have a few interesting observations:

  • the final price is always between the Seller’s and Buyer’s limit prices
  • suggesting the first price greatly influences the final price
  • however, starting the conversation without a price, thus letting the other party set the anchor, yields basically the same distribution

Final price distribution

Further work

For this article we have examined only 2 possible variables that can influence the final price, but there are many more experiments that we could try:

  • comparing different LLMs backends, including different LLMs for the Seller and Buyer
  • experimenting with the prompts, with different prompts and attitudes for the 2 agents
  • exploring ways to trick AI agents and how to safeguard against it

During our initial experiments we also observed unexpected behaviours, as willingless from the part of the Seller to lower the price in exchange for buying more than one 🥚. We explicitely prohibited that in the prompt, but it would also be interesting exploring upselling strategies.

Would you have an AI Agent do your bidding?

Difficult to say, as this is just a short and fun experiment. But there are pros and cons.

First of all, unlike human negotiators, agents are not prone to emotions and sentimental thinking, thus following a preset strategy more closely. However they may be influenced by subtle cues from the counterparty, and this needs further investigation.

Secondly, agents can do this at scale, with thousands of counterparties at once, opening up new applications and opportunities.

However the cons are also considerable. Mainly, this is still finnicky technology; you would need pretty hard guardrails and a strong contract so you don’t find yourself at a (potentially big) loss.

Conclusions

We’ve done a simple experiment that shows that negotiating agents exhibit rational economic behavior. We have also shown that the final price (and profit) is influenced by different variables. In particular, as in classic behavior economic results, anchoring the price gives negotiators a big advantage.

If you want to give it a try or experiment with it, the code is available here.

References

  1. The Agno AI-Agents Framework
  2. Run LLMs locally with Ollama
  3. Gemini
  4. Phi4
  5. Behavioral Economics: Negotiating Prices and The Anchoring Effect