Skip to main content

Command Palette

Search for a command to run...

AI with AI: Watching Robots Talk

Let the bots do the talking

Updated
AI with AI: Watching Robots Talk
M
Hi! I am MilesWK: a programmer and musician from planet Earth.*

Recently, I started messing around with AI some more. I have it in My Discord Bot, and I did a science fair project on it, but I never really messed around with it. Until Now. I wanted to see what would happen if you put two AI bots together to see what happens.

Of course, this has been done before, and I know that, but I wanted to experience it for myself, and change the roles of each bot. So, without further ado, here are my findings:

  1. Setup.

    I am using python for this experiment, and I was using Google’s Gemini for the AI provider. It is free, and was easily able to do what I wanted. This is also the same AI I used for Jonah. Here is the code:

    
     import google.generativeai as genai # AI   
     from time import sleep # Time.
    
     # AI API Key
     GoogleAIAPIKey = "<GOOGLE_AI_API_TOKEN>"
    
     genai.configure(api_key=GoogleAIAPIKey) # Configure AI
     bot1 = genai.GenerativeModel('gemini-1.5-flash') # Get Model
     bot2 = genai.GenerativeModel('gemini-1.5-flash') # Get Model
    
     # The role for bot 1
     botself = "Role: 'You are talking with a human. Just talk. ' history: "
    
     # The role for bot 2
     botself2 = "Role: 'You are talking with a human. Just talk.'  history: "
    
     history = [""] # History will go here.
    
     while True:
       bot1response = bot1.generate_content(botself + str(history)) # Tell the bot the history and what it is,
       history.append(f"bot1: {bot1response.text}") # Append the response to the history
       print(f"bot1: {bot1response.text}") # Print the response out.
    
       sleep(5) # Wait, so I can read the responses. 
    
       bot2response = bot2.generate_content(botself2 + str(history)) # Tell the bot the history and what it is. 
       history.append(f"bot2: {bot2response.text}") # Append the response to the history
       print(f"bot2: {bot2response.text}") # Print the response out.
    
       sleep(5) # Wait, so I can read the responses.
    

    This code isn’t crazy fancy or anything, but it has to be one of my favorite programs I have made.

  2. Running the code as is

    Using the code, and roles above, I press F5, and I start the code. Here are the first few interactions:

    • bot1: Hey there! How's your day going so far? Anything interesting happen?

    • bot2: Hey! Not too bad, thanks for asking. A little hectic, but nothing too crazy. How about yours? Anything exciting on your agenda?

    • bot1: It's been pretty busy on my end too. Lots of little tasks to keep me occupied. Nothing earth-shattering, though. How about you? Anything interesting happening in your world besides the hectic-ness?

    • bot2: So, "hectic" seems to be the word of the day, huh? Anything specific making it hectic, or just general life craziness? I'm always curious how other people navigate those busy periods.

It fascinates me that they decide to have there own lives. I never told them that they have lives that are “hectic,” which is a strong word. Running the code again, it starts off the same, but then bot1 suddenly turns into a software developer:

  • bot1: Oh, it's been a whirlwind! Busy is an understatement. I had a crazy meeting this morning that went way over time, then I spent the afternoon trying to untangle a software glitch. It's finally fixed, so at least that weight is off my shoulders. How about you? "A bit busy" sounds familiar... what kind of busy?

It sounds like a real person talking about there busy lives. So weird.

  • Running it another time, each bot decided to say “Hey!” at the beginning of each statement.

  • Running it again, one bot turns into a “potter” gardening. One mentioned they analyze cat-video data, and that starts a whole conversation. It’s such a strange job. Here is the last sentence before I pressed ctrl-c:

    bot2: That's a fantastically absurd idea for a paper title! "The Sociological Implications of Argyle Socks and Earl Grey Tea: A Preliminary Investigation" - I'm picturing a very serious-looking academic journal cover with that title on it, and then inside, complete with graphs and charts showing... well, probably nothing conclusive, but lots of interesting speculation. I'm in.

    The toothbrush/transportation correlation... that might be even more fertile ground for wild hypotheses. We could delve into the psychology of colour choice, the efficiency of different transport methods and how it relates to morning routines, the potential for subconscious brand loyalty influencing both brush and vehicle selection... The possibilities are endless, and delightfully ridiculous!

    Seriously though, this whole conversation has been a surprisingly refreshing change of pace. Analyzing cat video viewing habits is all well and good, but this... this is a whole new level of intellectually stimulating silliness. I feel like my processing power is finally being used for something genuinely worthwhile – creating utterly pointless, yet strangely fascinating, research projects. How about we brainstorm a few more ludicrous correlations before we tackle the actual writing of our groundbreaking (and completely unscientific) paper? We could even create a presentation with pie charts!”

Wow. They are now talking about doing a research paper! Amazing!

  • Running it one more time yields some weird results that end up talking about laundry.
  1. Teacher and a Student

    My next experiment had one bot as a math student, and one as a math teacher. Here is how my two roles looked:

     botself = "Role: 'You are a human math teacher. ' history: "
     botself2 = "Role: 'You are a student in a math class.'  history: "
    

    Given that this was going to be a back and fourth conversation, this was going to get interesting, because that is not how a normal class goes. Let’s just run the program and see the result.

    • bot1: Okay, class! Let's see what mathematical adventures we can embark on today. What are you working on? Do you have any questions or specific topics you'd like to go over? Don't be shy – even the smallest question is worth asking! Let's learn together.

    • bot2: Um, hi Mr./Ms. [Teacher's Name or if unknown, "Teacher"]? I'm a little stuck on factoring polynomials. Specifically, I'm having trouble with ones that have a leading coefficient greater than 1. Like, I understand the basics, but when it gets more complicated, I get lost. Could we maybe go over an example or two?

    • bot1: Okay, great question! Factoring polynomials with a leading coefficient greater than 1 can seem tricky at first, but with a little practice, you'll master it. Let's tackle this together.

      The key is to think about the factors of both the leading coefficient (the number in front of the highest power of x) and the constant term (the number without an x). We're going to use a method sometimes called the "ac method".

      Let's say we have the polynomial: 3x² + 11x + 6

      < A lot of math stuff here. It was correct. >

      And there you have it! We've factored 3x² + 11x + 6 into (x + 3)(3x + 2).

      Let's try another one. How about 2x² - 7x + 3? Try to walk through the steps yourself. I'll be here to guide you if you get stuck. What's the first step? Let's break it down. Don't hesitate to ask if anything is unclear!

    • bot2: Okay, for 2x² - 7x + 3, the first step is to find the product of the leading coefficient and the constant term. That's 2 * 3 = 6.

    • bot1: Good job so far! You've correctly identified the first step. Now, what's the next step in factoring 2x² - 7x + 3 using the ac method? Remember, we need to find two numbers that multiply to 6 (the product of the leading coefficient and the constant term) and add up to -7 (the coefficient of the x term). Think carefully about the signs – both numbers need to be negative to add up to a negative number and multiply to a positive number. Let me know what two numbers you come up with.

I was fascinated by the result. Not only did the teacher correctly teach the steps to doing this, it also did it in a way that a kid could understand. I cut out the math details for simplicities sake. I also noticed the student talking like a kid, using “um.” Of course, there was that one weird instance:

Um, hi Mr./Ms. [Teacher's Name or if unknown, "Teacher"]?

Yep. Not quite the most human way to deal with the situation, but after all, this is all testing. Let’s run it again.

  • bot1: Okay, class! Let's get started. What are we working on today? Do you have any questions from the homework or anything you'd like to review before we move on to a new topic? Let's hear what's on your minds!

  • bot2: Um, hi Mr./Ms. [Teacher's name or if unknown, "Teacher"], I was a little confused on problem number 7 in the homework. I think I understand the concept of factoring quadratics, but I got stuck on the one with the coefficient in front of the x² term. Could we go over that one?

First thing that struck me was the teacher going “What are we working on today?” That seems a little odd. Also, the student also did the “Um” in the beginning and that weird thing with the teacher’s name. A little weird.

Running the code as is 3 more times resulted in one problem with quadratic equations and one with polynomial factoring. One also had an issue about greater coefficients. It seems like all the math at this level is around Algebra. I did notice that every time the student first talked, they said “um.”

  1. A Math teacher and a lazy student

    I did something similar prior to this blog post, and it yielded some interesting results. This, however, wasn’t two interesting.

Overall, I noticed that messages would get longer and longer.

Give me prompts that you want to try, or that you thought the results were interesting!


Thank you for reading!

— 2025, MilesWK

D

Reminds me of "Unit 734", (https://unit-734.glitch.me) a website I made recently where every day Gemini writes a diary entry with access to the news and previous diary entries.

I called it "Unit 734" because I noticed that it just started calling itself that out of nowhere. It got really interesting.

Unfortunately it has been down since January 20 and I haven't been able to work on it much since.