This project sets up a conversation between two AI agents with contrasting personalities or belief systems. Each bot responds based on a custom instruction set loaded from a JSON file. The conversation is saved step-by-step, and can be read aloud using text-to-speech (TTS).
- 🔁 Two AI bots talking to each other
- 🧠 Each bot uses a unique instruction/personality
- 📁 Full conversation saved in
bot_conversation.json - 🔊 Read messages out loud using
pyttsx3(offline TTS) - 🔐 Supports separate API keys for each bot to avoid rate limits
-
Install dependencies:
pip install langchain langchain-google-genai pyttsx3 python-dotenv
-
Set your API keys: Create a
.envfile with:MODEL_API_KEY_1=your_google_api_key_1 MODEL_API_KEY_2=your_google_api_key_2 -
Add bot instructions: Create a
bot_instructions.json:{ "bot1": "You are a calm and logical philosopher who values reason and ethics.", "bot2": "You are a bold realist who believes in results over ideals." }
Run the main simulation:
python dual_bot_simulator.pyRun TTS to hear the conversation:
python read_conversation_tts.py| File | Purpose |
|---|---|
dual_bot_simulator.py |
Main script to make both bots talk |
bot_instructions.json |
Defines personality/instructions for each bot |
bot_conversation.json |
Stores the final conversation as JSON |
read_conversation_tts.py |
Reads conversation aloud using TTS |
- Bots are powered by Google Generative AI (
gemini-2.0-flash). - Each bot can use a separate API key to avoid quota issues.
- Personalities can be modified easily via the JSON file.