Skip to main content

Advanced multi-agent voice conversation system with customizable personas and modes

Project description

DuoTalk ๐ŸŽญ

Advanced Multi-Agent Voice Conversation System

DuoTalk is a comprehensive Python package for creating engaging multi-agent voice conversations with customizable personas, conversation modes, and easy integration capabilities. Built on top of LiveKit and Google Gemini, it provides a powerful yet simple API for generating dynamic conversations between AI agents with distinct personalities.

๐ŸŒŸ Features

  • ๐ŸŽญ Rich Persona Library: 14+ pre-defined personas (Optimist, Skeptic, Pragmatist, etc.)
  • ๐Ÿ—ฃ๏ธ Multiple Conversation Modes: Debate, Roundtable, Interview, Panel, Socratic, and more
  • ๐ŸŽ™๏ธ Voice Integration: Full voice synthesis using Google Gemini's native audio
  • โšก Easy Setup: Simple pip installation and intuitive API
  • ๐Ÿ”ง Highly Customizable: Create custom personas, modes, and conversation flows
  • ๐Ÿ“Š Analytics: Built-in conversation metrics and performance tracking
  • ๐Ÿ–ฅ๏ธ CLI Interface: Command-line tool for quick conversations
  • ๐Ÿ“ Conversation Logging: Automatic conversation transcription and analysis
  • ๐ŸŽฏ Multiple Use Cases: Education, brainstorming, testing, entertainment

๐Ÿš€ Quick Start

Installation

pip install duotalk

Or using uv:

uv add duotalk

Environment Setup

Create a .env file with your API keys:

GEMINI_API_KEY=your_gemini_api_key_here
# Optional for production LiveKit usage
LIVEKIT_API_KEY=your_livekit_key
LIVEKIT_API_SECRET=your_livekit_secret

Basic Usage

import asyncio
from duotalk import create_debate

async def main():
    # Create a debate conversation
    runner = await create_debate(
        topic="Should AI replace human teachers?",
        max_turns=10
    )
    
    # Start the conversation
    await runner.start()

asyncio.run(main())

Using the CLI

# Start a debate conversation
duotalk debate -t "Pineapple on pizza"

# Friendly chat with custom personas
duotalk chat -t "Weekend plans" -p optimist,enthusiast

# Roundtable discussion with 4 participants
duotalk roundtable -t "Climate change solutions" -a 4

# Interview format
duotalk interview -t "AI ethics" --interviewer journalist --interviewee expert

# Expert panel discussion
duotalk panel -t "Space exploration" -a 5

# List available personas
duotalk personas

# Use different LiveKit modes
duotalk debate -t "Remote work" --mode dev      # Development mode
duotalk debate -t "Remote work" --mode console  # Console mode (default)
duotalk debate -t "Remote work" --mode start    # Production mode

# Get help
duotalk --help
duotalk debate --help

Experience the future of AI interaction with two agents engaging in dynamic voice conversations

Python LiveKit Gemini License


๐ŸŒŸ Overview

DuoTalk brings AI conversations to life with two distinct AI audio agents powered by Google Gemini-realtime and LiveKit. Watch as they engage in real-time voice conversations, whether collaborating in friendly discussions or debating opposing viewpoints on any topic you choose.

โœจ Features

Feature Description
๐ŸŽญ Dual & Quad AI Voice Agents Two or four agents with unique voices and personas
๐Ÿ’ฌ Conversation Modes Choose between friendly discussion, debate, or roundtable format
๐ŸŒ€ Roundtable Feature Four agents share diverse perspectives in a dynamic roundtable
๐ŸŽฏ Custom Topics Specify any topic for dynamic conversations
๐Ÿ”Š Real-Time Audio Natural spoken dialogue using Gemini's latest models
๐Ÿ›ก๏ธ Robust Error Handling Smart retry logic and graceful error recovery
๐ŸŽช Voice Personas Distinct voices: Puck (optimist, pragmatist) & Charon (skeptic, theorist)

๐Ÿ—๏ธ Code Architecture

image

๐Ÿ“‹ Requirements

Prerequisites for running DuoTalk

๐Ÿš€ Quick Setup

1๏ธโƒฃ Clone & Navigate

git clone https://github.com/AbhyudayPatel/DuoTalk.git
cd DuoTalk

2๏ธโƒฃ Install Dependencies

python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt

3๏ธโƒฃ Environment Configuration

Create a .env file in your project root:

# Add your Google Gemini API key
GOOGLE_API_KEY=your_gemini_api_key_here

๐Ÿ’ก Tip: Get your API key from Google AI Studio

๐ŸŽฎ Usage

๐Ÿƒโ€โ™‚๏ธ Starting DuoTalk

# For 2 agents (friendly/discussion/debate):
python dual_voice_agents.py console
# For 4 agents (roundtable/friendly/debate):
python four_agents_duotalk.py console

๐Ÿ“ Interactive Setup

Step 1: ๐ŸŽฏ Choose Your Topic

Enter the topic for the conversation: _

Examples:

  • The future of AI and robotics
  • Climate change solutions
  • Space exploration and Mars colonization
  • The ethics of genetic engineering

Step 2: ๐ŸŽญ Select Conversation Mode

Select conversation mode:
1. Friendly discussion (2 agents)
2. Debate format (2 agents)
3. Roundtable discussion (4 agents)
Enter your choice (1, 2, or 3): _
Mode ๐Ÿค Friendly Discussion โš”๏ธ Debate Format ๐ŸŒ€ Roundtable
Style Collaborative & supportive Opposing viewpoints Diverse perspectives
Tone Encouraging dialogue Direct & contrary Dynamic & engaging
Personas Agent1 & Agent2 Optimist vs Skeptic Optimist, Skeptic, Pragmatist, Theorist
Voices Puck & Charon Puck & Charon Puck & Charon (multiple roles)

โš™๏ธ Configuration

๐Ÿ”ง Customization Options
Setting Default How to Change
๐Ÿ”„ Max Turns 12 turns Modify max_turns in ConversationState
๐ŸŽค Agent Voices Puck & Charon Update voice parameters in code
๐Ÿค– AI Model gemini-2.5-flash-preview-native-audio-dialog Change model string
๐Ÿ’ฌ Response Length One-line responses Modify instructions in DualPersonaAgent

๐Ÿงฉ Core Components

Component ๐ŸŽฏ Purpose
ConversationState ๐Ÿ“Š Manages conversation state and settings
DualPersonaAgent ๐ŸŽญ Main agent class with dual persona support
get_conversation_mode() ๐Ÿ“ Handles user input for conversation mode
run_friendly_conversation() ๐Ÿค Manages friendly discussion flow
run_debate_conversation() โš”๏ธ Manages debate flow with optimist/skeptic roles
safe_generate_reply() ๐Ÿ›ก๏ธ Handles responses with error handling and retries

๐Ÿ›ก๏ธ Error Handling & Reliability

DuoTalk is built with enterprise-grade reliability:

๐Ÿ” Comprehensive Error Management
Feature Description
๐Ÿ“Š Session Health Monitoring Real-time health checks
๐Ÿ”„ Automatic Retries Smart retry logic for failed responses
๐Ÿงน Graceful Cleanup Proper resource management
๐Ÿ“ Detailed Logging Comprehensive debugging information
โฑ๏ธ Timeout Protection Prevents hanging operations
๐Ÿ”ง Recovery Mechanisms Automatic error recovery

๐Ÿ“„ License

MIT License - See LICENSE file for details

Experience the future of AI conversation today!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

duotalk-1.0.1.tar.gz (58.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

duotalk-1.0.1-py3-none-any.whl (63.4 kB view details)

Uploaded Python 3

File details

Details for the file duotalk-1.0.1.tar.gz.

File metadata

  • Download URL: duotalk-1.0.1.tar.gz
  • Upload date:
  • Size: 58.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for duotalk-1.0.1.tar.gz
Algorithm Hash digest
SHA256 198cf9636773ffdfcf02f7f7fbeae5d5053b344b9f8871fd468a36b60560e1bf
MD5 85391e33ff29cceb7a3aac6f7fb69b16
BLAKE2b-256 641ae6df799b011eda1b1dd85d1f14de595438bb1d78748cc608c915934746ad

See more details on using hashes here.

File details

Details for the file duotalk-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: duotalk-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 63.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for duotalk-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cd10cd1b3d8f7173b5537145692d3271b9b9472a4f14eadedd4039cb3b587721
MD5 0c3fd8c45a9acb9ab88ba270a80b6223
BLAKE2b-256 291d65085d38631b972d80fb18da87e170cacca13994ea6894e4aa27aed5f764

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page