Back to blog
Articles
Articles
August 28, 2023
·
4 min read

Two LLM Based Autonomous Agents Debate Each Other

August 28, 2023
|
4 min read

Latest content

Tutorials
5 min read

Optimizing RAG with Knowledge Base Maintenance

How to find gaps between knowledge base content and real user questions.
April 23, 2024
Tutorials
4 min read

Scaling Quality Assurance with HumanFirst and Google Cloud

How to use HumanFirst with Vertex AI to test, improve, and trust agent performance.
March 14, 2024
Announcements
2 min read

Full Circle: HumanFirst Welcomes Maeghan Smulders as COO

Personal and professional history might not repeat, but it certainly rhymes. I’m thrilled to join the team at HumanFirst, and reconnect with a team of founders I not only trust, but deeply admire.
February 13, 2024
Tutorials
4 min read

Accelerating Data Analysis with HumanFirst and Google Cloud

How to use HumanFirst with CCAI-generated data to accelerate data analysis.
January 24, 2024
Tutorials
4 min read

Exploring Contact Center Data with HumanFirst and Google Cloud

How to use HumanFirst with CCAI-generated data to streamline topic modeling.
January 11, 2024
Articles
5 min

Building In Alignment: The Role of Observability in LLM-Led Conversational Design

Building In Alignment: The Role of Observability in LLM-Led Conversational Design
December 6, 2023
Articles
5 min read

Rivet Is An Open-Source Visual AI Programming Environment

Rivet is suited for building complex agents with LLM Prompts, and it was Open Sourced recently.
September 27, 2023
Articles
6 min read

What Is The Future Of Prompt Engineering?

The skill of Prompt Engineering has been touted as the ultimate skill of the future. But, will prompt engineering be around in the near future? In this article I attempt to decompose how the future LLM interface might look like…considering it will be conversational.
September 26, 2023
Articles
4 min read

LLM Drift

A recent study coined the term LLM Drift. LLM Drift is definite changes in LLM responses and behaviour, over a relatively short period of time.
September 25, 2023
Tutorials
5 min read

Optimizing RAG with Knowledge Base Maintenance

How to find gaps between knowledge base content and real user questions.
April 23, 2024
Tutorials
4 min read

Scaling Quality Assurance with HumanFirst and Google Cloud

How to use HumanFirst with Vertex AI to test, improve, and trust agent performance.
March 14, 2024
Announcements
2 min read

Full Circle: HumanFirst Welcomes Maeghan Smulders as COO

Personal and professional history might not repeat, but it certainly rhymes. I’m thrilled to join the team at HumanFirst, and reconnect with a team of founders I not only trust, but deeply admire.
February 13, 2024

Let your data drive.

Articles

Two LLM Based Autonomous Agents Debate Each Other

COBUS GREYLING
August 28, 2023
.
4 min read

This working code example using the LangChain framework illustrates how two agents can debate each other after each agent has been assigned a persona and an objective. The agents have access to tools which they can leverage for their response.

As you will see below, after examining the LangSmith trace, that the LLM forms the backbone of the application and the tools provide relevant and up-to-date information.

In this LangChain example we have two Autonomous Agents having a conversation; one is named AI accelerationist and the other AI alarmist.

The two personas are described to the LLM in the following way:

AI accelerationist: A passionate visionary who sees the potential of automation and artificial intelligence as a catalyst for transformative progress. Fueled by an unwavering belief in technological advancement, you advocate for embracing and accelerating AI’s rise, confident that it will reshape industries, lead to an abundance of opportunities, and ultimately improve society.

AI alarmist: A cautious observer of technological advancements. With a mind steeped in apprehension, you perceive the growth of automation and AI as an impending threat. Your anxiety fuels your skepticism, pushing you to question the potential consequences of these technologies on the labor market and job security.

Both agents have access to the following tools to use for information retrieval to support its arguments:

  • Arxiv
  • Duck-Duck-Go Search
  • Wikipedia

The topic for the discussion is:

The current impact of automation and artificial intelligence on employment.

And the brief for each agent:

Your name is {name}.
Your description is as follows: {description}
Your goal is to persuade your conversation partner of your point of view.
DO look up information with your tool to refute your partner’s claims.
DO cite your sources.
DO NOT fabricate fake citations.
DO NOT cite any source that you did not look up.
Do not add anything else.
Stop speaking the moment you finish speaking from your perspective.

And here is the dialog between the two autonomous agents, the dialog are restricted to 6 dialog turns. The input from the moderator is in green:

With the response from the AI Alarmist in red and the AI Accelerationist in blue:

Below the completion of the six dialog turns:

Considering the view of LangChain below, it is clear how the latency increases as the prompt grows with each dialog turn. The tokens used also increase.

Here the trace is visible, with the sequence of events and the tools used are shown.

The complete code is listed here, this can be copied and pasted into any notebook and run. The only requirements are an OpenAI API Key, SerpAPI API Key and LangSmith API Key.

I’m currently the Chief Evangelist @ HumanFirst. I explore & write about all things at the intersection of AI & language; ranging from LLMs, Chatbots, Voicebots, Development Frameworks, Data-Centric latent spaces & more.

Subscribe to HumanFirst Blog

Get the latest posts delivered right to your inbox