Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VAPI Voice Agent

A functional AI voice agent built with VAPI (Voice AI Platform) that handles natural, human-like conversations based on predefined logic and prompts.

Features

  • ✅ Natural voice conversations using VAPI
  • ✅ Complete assistant CRUD operations (create, list, get, update, delete)
  • ✅ Phone number management
  • ✅ Call management and status tracking
  • ✅ Configurable conversational flows and prompts
  • ✅ Speech-to-text and text-to-speech integration
  • ✅ Context-aware interactions
  • ✅ Flexible agent logic configuration

Setup

  1. Install dependencies:
pip install -r requirements.txt
  1. Set up environment variables:
cp env.example .env
# Edit .env with your VAPI API key
  1. Configure the agent in config/agent_config.py (optional)

  2. Run the agent:

PYTHONPATH=. python src/main.py

Quick Start

Basic Usage

from src.config_loader import load_config
from src.agent import VAPIVoiceAgent

# Load configuration
config = load_config()

# Initialize agent
agent = VAPIVoiceAgent(config)

# Create an assistant
assistant = agent.create_assistant()
print(f"Assistant ID: {assistant['id']}")

# List assistants
assistants = agent.list_assistants()

# Get assistant details
details = agent.get_assistant(assistant['id'])

# List phone numbers
phone_numbers = agent.list_phone_numbers()

# Close agent
agent.close()

Examples

See the examples/ directory for complete examples:

  • basic_usage.py - Basic usage example
  • complete_example.py - Complete example with all features
  • conversation_demo.py - Demo showing how to have a conversation with the agent

Having a Conversation

To see how the agent handles conversations, run:

PYTHONPATH=. python3 examples/conversation_demo.py

This will demonstrate a sample conversation with the agent, showing:

  • User messages
  • Agent responses
  • Conversation state transitions
  • Conversation history

For an interactive conversation (where you can type messages), run:

PYTHONPATH=. python3 examples/conversation_demo.py --interactive

Configuration

See config/agent_config.py for agent configuration options.

Documentation

See docs/ directory for detailed documentation:

  • API.md - API reference
  • USAGE.md - Usage guide

API Reference

Assistant Operations

  • create_assistant(assistant_data) - Create a new assistant
  • list_assistants() - List all assistants
  • get_assistant(assistant_id) - Get assistant details
  • update_assistant(assistant_id, assistant_data) - Update an assistant
  • delete_assistant(assistant_id) - Delete an assistant

Phone Number Operations

  • list_phone_numbers() - List all phone numbers
  • get_phone_number(phone_number_id) - Get phone number details

Call Operations

  • create_phone_call(assistant_id, phone_number_id) - Create a phone call
  • get_call_status(call_id) - Get call status
  • list_calls() - List all calls

Resources

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages